aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-04-18 22:49:35 -0400
committerLen Brown <len.brown@intel.com>2005-07-12 00:08:52 -0400
commit44f6c01242da4e162f28d8e1216a8c7a91174605 (patch)
tree53f724764f1bd9036dfb049a643d198125cc9edc
parentebb6e1a6122fd6b7c96470cfd4ce0f04150e5084 (diff)
ACPICA 20050408 from Bob Moore
Fixed three cases in the interpreter where an "index" argument to an ASL function was still (internally) 32 bits instead of the required 64 bits. This was the Index argument to the Index, Mid, and Match operators. The "strupr" function is now permanently local (acpi_ut_strupr), since this is not a POSIX-defined function and not present in most kernel-level C libraries. References to the C library strupr function have been removed from the headers. Completed the deployment of static functions/prototypes. All prototypes with the static attribute have been moved from the headers to the owning C file. ACPICA 20050329 from Bob Moore An error is now generated if an attempt is made to create a Buffer Field of length zero (A CreateField with a length operand of zero.) The interpreter now issues a warning whenever executable code at the module level is detected during ACPI table load. This will give some idea of the prevalence of this type of code. Implemented support for references to named objects (other than control methods) within package objects. Enhanced package object output for the debug object. Package objects are now completely dumped, showing all elements. Enhanced miscellaneous object output for the debug object. Any object can now be written to the debug object (for example, a device object can be written, and the type of the object will be displayed.) The "static" qualifier has been added to all local functions across the core subsystem. The number of "long" lines (> 80 chars) within the source has been significantly reduced, by about 1/3. Cleaned up all header files to ensure that all CA/iASL functions are prototyped (even static functions) and the formatting is consistent. Two new header files have been added, acopcode.h and acnames.h. Removed several obsolete functions that were no longer used. Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/dispatcher/dsfield.c58
-rw-r--r--drivers/acpi/dispatcher/dsinit.c28
-rw-r--r--drivers/acpi/dispatcher/dsmethod.c11
-rw-r--r--drivers/acpi/dispatcher/dsmthdat.c195
-rw-r--r--drivers/acpi/dispatcher/dsobject.c79
-rw-r--r--drivers/acpi/dispatcher/dsopcode.c105
-rw-r--r--drivers/acpi/dispatcher/dsutils.c41
-rw-r--r--drivers/acpi/dispatcher/dswexec.c57
-rw-r--r--drivers/acpi/dispatcher/dswload.c118
-rw-r--r--drivers/acpi/dispatcher/dswscope.c31
-rw-r--r--drivers/acpi/dispatcher/dswstate.c458
-rw-r--r--drivers/acpi/events/evevent.c33
-rw-r--r--drivers/acpi/events/evgpe.c39
-rw-r--r--drivers/acpi/events/evgpeblk.c63
-rw-r--r--drivers/acpi/events/evmisc.c97
-rw-r--r--drivers/acpi/events/evregion.c35
-rw-r--r--drivers/acpi/events/evrgnini.c14
-rw-r--r--drivers/acpi/events/evsci.c12
-rw-r--r--drivers/acpi/events/evxface.c19
-rw-r--r--drivers/acpi/events/evxfevnt.c25
-rw-r--r--drivers/acpi/executer/exconfig.c31
-rw-r--r--drivers/acpi/executer/exconvrt.c44
-rw-r--r--drivers/acpi/executer/excreate.c50
-rw-r--r--drivers/acpi/executer/exdump.c105
-rw-r--r--drivers/acpi/executer/exfield.c25
-rw-r--r--drivers/acpi/executer/exfldio.c133
-rw-r--r--drivers/acpi/executer/exmisc.c7
-rw-r--r--drivers/acpi/executer/exmutex.c45
-rw-r--r--drivers/acpi/executer/exnames.c70
-rw-r--r--drivers/acpi/executer/exoparg1.c94
-rw-r--r--drivers/acpi/executer/exoparg2.c69
-rw-r--r--drivers/acpi/executer/exoparg3.c25
-rw-r--r--drivers/acpi/executer/exoparg6.c26
-rw-r--r--drivers/acpi/executer/exprep.c104
-rw-r--r--drivers/acpi/executer/exregion.c34
-rw-r--r--drivers/acpi/executer/exresnte.c24
-rw-r--r--drivers/acpi/executer/exresolv.c63
-rw-r--r--drivers/acpi/executer/exresop.c80
-rw-r--r--drivers/acpi/executer/exstore.c260
-rw-r--r--drivers/acpi/executer/exstoren.c20
-rw-r--r--drivers/acpi/executer/exstorob.c9
-rw-r--r--drivers/acpi/executer/exsystem.c48
-rw-r--r--drivers/acpi/executer/exutils.c37
-rw-r--r--drivers/acpi/hardware/hwacpi.c19
-rw-r--r--drivers/acpi/hardware/hwgpe.c31
-rw-r--r--drivers/acpi/hardware/hwregs.c114
-rw-r--r--drivers/acpi/hardware/hwsleep.c101
-rw-r--r--drivers/acpi/hardware/hwtimer.c4
-rw-r--r--drivers/acpi/namespace/nsaccess.c5
-rw-r--r--drivers/acpi/namespace/nsalloc.c121
-rw-r--r--drivers/acpi/namespace/nsdump.c109
-rw-r--r--drivers/acpi/namespace/nsdumpdv.c18
-rw-r--r--drivers/acpi/namespace/nseval.c70
-rw-r--r--drivers/acpi/namespace/nsinit.c28
-rw-r--r--drivers/acpi/namespace/nsload.c28
-rw-r--r--drivers/acpi/namespace/nsnames.c12
-rw-r--r--drivers/acpi/namespace/nsobject.c14
-rw-r--r--drivers/acpi/namespace/nssearch.c29
-rw-r--r--drivers/acpi/namespace/nsutils.c167
-rw-r--r--drivers/acpi/namespace/nswalk.c2
-rw-r--r--drivers/acpi/namespace/nsxfeval.c16
-rw-r--r--drivers/acpi/namespace/nsxfname.c8
-rw-r--r--drivers/acpi/namespace/nsxfobj.c4
-rw-r--r--drivers/acpi/parser/psargs.c55
-rw-r--r--drivers/acpi/parser/psopcode.c298
-rw-r--r--drivers/acpi/parser/psparse.c144
-rw-r--r--drivers/acpi/parser/psscope.c45
-rw-r--r--drivers/acpi/parser/pstree.c159
-rw-r--r--drivers/acpi/parser/psutils.c15
-rw-r--r--drivers/acpi/parser/pswalk.c11
-rw-r--r--drivers/acpi/parser/psxface.c21
-rw-r--r--drivers/acpi/resources/rsaddr.c480
-rw-r--r--drivers/acpi/resources/rscalc.c144
-rw-r--r--drivers/acpi/resources/rscreate.c45
-rw-r--r--drivers/acpi/resources/rsdump.c402
-rw-r--r--drivers/acpi/resources/rsio.c197
-rw-r--r--drivers/acpi/resources/rsirq.c167
-rw-r--r--drivers/acpi/resources/rslist.c68
-rw-r--r--drivers/acpi/resources/rsmemory.c236
-rw-r--r--drivers/acpi/resources/rsmisc.c160
-rw-r--r--drivers/acpi/resources/rsutils.c53
-rw-r--r--drivers/acpi/resources/rsxface.c43
-rw-r--r--drivers/acpi/tables/tbconvrt.c105
-rw-r--r--drivers/acpi/tables/tbget.c63
-rw-r--r--drivers/acpi/tables/tbgetall.c45
-rw-r--r--drivers/acpi/tables/tbinstal.c31
-rw-r--r--drivers/acpi/tables/tbrsdt.c19
-rw-r--r--drivers/acpi/tables/tbutils.c97
-rw-r--r--drivers/acpi/tables/tbxface.c39
-rw-r--r--drivers/acpi/tables/tbxfroot.c123
-rw-r--r--drivers/acpi/utilities/utalloc.c84
-rw-r--r--drivers/acpi/utilities/utcopy.c126
-rw-r--r--drivers/acpi/utilities/utdebug.c106
-rw-r--r--drivers/acpi/utilities/utdelete.c63
-rw-r--r--drivers/acpi/utilities/uteval.c36
-rw-r--r--drivers/acpi/utilities/utglobal.c133
-rw-r--r--drivers/acpi/utilities/utinit.c36
-rw-r--r--drivers/acpi/utilities/utmath.c2
-rw-r--r--drivers/acpi/utilities/utmisc.c187
-rw-r--r--drivers/acpi/utilities/utobject.c68
-rw-r--r--drivers/acpi/utilities/utxface.c61
-rw-r--r--include/acpi/acconfig.h7
-rw-r--r--include/acpi/acdebug.h146
-rw-r--r--include/acpi/acdisasm.h114
-rw-r--r--include/acpi/acdispat.h171
-rw-r--r--include/acpi/acevents.h85
-rw-r--r--include/acpi/acexcep.h5
-rw-r--r--include/acpi/acglobal.h12
-rw-r--r--include/acpi/achware.h52
-rw-r--r--include/acpi/acinterp.h243
-rw-r--r--include/acpi/aclocal.h10
-rw-r--r--include/acpi/acmacros.h10
-rw-r--r--include/acpi/acnames.h84
-rw-r--r--include/acpi/acnamesp.h163
-rw-r--r--include/acpi/acobject.h2
-rw-r--r--include/acpi/acopcode.h325
-rw-r--r--include/acpi/acparser.h134
-rw-r--r--include/acpi/acpi.h1
-rw-r--r--include/acpi/acpiosxf.h18
-rw-r--r--include/acpi/acpixf.h13
-rw-r--r--include/acpi/acresrc.h67
-rw-r--r--include/acpi/acstruct.h1
-rw-r--r--include/acpi/actables.h70
-rw-r--r--include/acpi/actbl.h2
-rw-r--r--include/acpi/actypes.h2
-rw-r--r--include/acpi/acutils.h274
-rw-r--r--include/acpi/amlcode.h12
-rw-r--r--include/acpi/platform/acenv.h20
128 files changed, 5220 insertions, 4811 deletions
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c
index 2779211be756..84193983d6ba 100644
--- a/drivers/acpi/dispatcher/dsfield.c
+++ b/drivers/acpi/dispatcher/dsfield.c
@@ -53,13 +53,20 @@
53#define _COMPONENT ACPI_DISPATCHER 53#define _COMPONENT ACPI_DISPATCHER
54 ACPI_MODULE_NAME ("dsfield") 54 ACPI_MODULE_NAME ("dsfield")
55 55
56/* Local prototypes */
57
58static acpi_status
59acpi_ds_get_field_names (
60 struct acpi_create_field_info *info,
61 struct acpi_walk_state *walk_state,
62 union acpi_parse_object *arg);
63
56 64
57/******************************************************************************* 65/*******************************************************************************
58 * 66 *
59 * FUNCTION: acpi_ds_create_buffer_field 67 * FUNCTION: acpi_ds_create_buffer_field
60 * 68 *
61 * PARAMETERS: Opcode - The opcode to be executed 69 * PARAMETERS: Op - Current parse op (create_xXField)
62 * Operands - List of operands for the opcode
63 * walk_state - Current state 70 * walk_state - Current state
64 * 71 *
65 * RETURN: Status 72 * RETURN: Status
@@ -70,7 +77,7 @@
70 * create_word_field_op, 77 * create_word_field_op,
71 * create_dword_field_op, 78 * create_dword_field_op,
72 * create_qword_field_op, 79 * create_qword_field_op,
73 * create_field_op (all of which define fields in buffers) 80 * create_field_op (all of which define a field in a buffer)
74 * 81 *
75 ******************************************************************************/ 82 ******************************************************************************/
76 83
@@ -119,7 +126,8 @@ acpi_ds_create_buffer_field (
119 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; 126 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE;
120 } 127 }
121 else { 128 else {
122 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND; 129 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
130 ACPI_NS_ERROR_IF_FOUND;
123 } 131 }
124 132
125 /* 133 /*
@@ -134,16 +142,16 @@ acpi_ds_create_buffer_field (
134 } 142 }
135 } 143 }
136 144
137 /* We could put the returned object (Node) on the object stack for later, but 145 /* We could put the returned object (Node) on the object stack for later,
138 * for now, we will put it in the "op" object that the parser uses, so we 146 * but for now, we will put it in the "op" object that the parser uses,
139 * can get it again at the end of this scope 147 * so we can get it again at the end of this scope
140 */ 148 */
141 op->common.node = node; 149 op->common.node = node;
142 150
143 /* 151 /*
144 * If there is no object attached to the node, this node was just created and 152 * If there is no object attached to the node, this node was just created
145 * we need to create the field object. Otherwise, this was a lookup of an 153 * and we need to create the field object. Otherwise, this was a lookup
146 * existing node and we don't want to create the field object again. 154 * of an existing node and we don't want to create the field object again.
147 */ 155 */
148 obj_desc = acpi_ns_get_attached_object (node); 156 obj_desc = acpi_ns_get_attached_object (node);
149 if (obj_desc) { 157 if (obj_desc) {
@@ -205,7 +213,7 @@ cleanup:
205 * 213 *
206 ******************************************************************************/ 214 ******************************************************************************/
207 215
208acpi_status 216static acpi_status
209acpi_ds_get_field_names ( 217acpi_ds_get_field_names (
210 struct acpi_create_field_info *info, 218 struct acpi_create_field_info *info,
211 struct acpi_walk_state *walk_state, 219 struct acpi_walk_state *walk_state,
@@ -238,7 +246,8 @@ acpi_ds_get_field_names (
238 + (acpi_integer) arg->common.value.size; 246 + (acpi_integer) arg->common.value.size;
239 247
240 if (position > ACPI_UINT32_MAX) { 248 if (position > ACPI_UINT32_MAX) {
241 ACPI_REPORT_ERROR (("Bit offset within field too large (> 0xFFFFFFFF)\n")); 249 ACPI_REPORT_ERROR ((
250 "Bit offset within field too large (> 0xFFFFFFFF)\n"));
242 return_ACPI_STATUS (AE_SUPPORT); 251 return_ACPI_STATUS (AE_SUPPORT);
243 } 252 }
244 253
@@ -250,12 +259,15 @@ acpi_ds_get_field_names (
250 259
251 /* 260 /*
252 * Get a new access_type and access_attribute -- to be used for all 261 * Get a new access_type and access_attribute -- to be used for all
253 * field units that follow, until field end or another access_as keyword. 262 * field units that follow, until field end or another access_as
263 * keyword.
254 * 264 *
255 * In field_flags, preserve the flag bits other than the ACCESS_TYPE bits 265 * In field_flags, preserve the flag bits other than the
266 * ACCESS_TYPE bits
256 */ 267 */
257 info->field_flags = (u8) ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | 268 info->field_flags = (u8)
258 ((u8) ((u32) arg->common.value.integer >> 8))); 269 ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
270 ((u8) ((u32) arg->common.value.integer >> 8)));
259 271
260 info->attribute = (u8) (arg->common.value.integer); 272 info->attribute = (u8) (arg->common.value.integer);
261 break; 273 break;
@@ -267,7 +279,8 @@ acpi_ds_get_field_names (
267 279
268 status = acpi_ns_lookup (walk_state->scope_info, 280 status = acpi_ns_lookup (walk_state->scope_info,
269 (char *) &arg->named.name, 281 (char *) &arg->named.name,
270 info->field_type, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, 282 info->field_type, ACPI_IMODE_EXECUTE,
283 ACPI_NS_DONT_OPEN_SCOPE,
271 walk_state, &info->field_node); 284 walk_state, &info->field_node);
272 if (ACPI_FAILURE (status)) { 285 if (ACPI_FAILURE (status)) {
273 ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); 286 ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
@@ -295,8 +308,9 @@ acpi_ds_get_field_names (
295 + (acpi_integer) arg->common.value.size; 308 + (acpi_integer) arg->common.value.size;
296 309
297 if (position > ACPI_UINT32_MAX) { 310 if (position > ACPI_UINT32_MAX) {
298 ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", 311 ACPI_REPORT_ERROR ((
299 (char *) &info->field_node->name)); 312 "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
313 (char *) &info->field_node->name));
300 return_ACPI_STATUS (AE_SUPPORT); 314 return_ACPI_STATUS (AE_SUPPORT);
301 } 315 }
302 316
@@ -306,7 +320,8 @@ acpi_ds_get_field_names (
306 320
307 default: 321 default:
308 322
309 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n", 323 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
324 "Invalid opcode in field list: %X\n",
310 arg->common.aml_opcode)); 325 arg->common.aml_opcode));
311 return_ACPI_STATUS (AE_AML_BAD_OPCODE); 326 return_ACPI_STATUS (AE_AML_BAD_OPCODE);
312 } 327 }
@@ -435,7 +450,8 @@ acpi_ds_init_field_objects (
435 status = acpi_ns_lookup (walk_state->scope_info, 450 status = acpi_ns_lookup (walk_state->scope_info,
436 (char *) &arg->named.name, 451 (char *) &arg->named.name,
437 type, ACPI_IMODE_LOAD_PASS1, 452 type, ACPI_IMODE_LOAD_PASS1,
438 ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, 453 ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
454 ACPI_NS_ERROR_IF_FOUND,
439 walk_state, &node); 455 walk_state, &node);
440 if (ACPI_FAILURE (status)) { 456 if (ACPI_FAILURE (status)) {
441 ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); 457 ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c
index b4d264dbbf67..d7790db50178 100644
--- a/drivers/acpi/dispatcher/dsinit.c
+++ b/drivers/acpi/dispatcher/dsinit.c
@@ -49,12 +49,21 @@
49#define _COMPONENT ACPI_DISPATCHER 49#define _COMPONENT ACPI_DISPATCHER
50 ACPI_MODULE_NAME ("dsinit") 50 ACPI_MODULE_NAME ("dsinit")
51 51
52/* Local prototypes */
53
54static acpi_status
55acpi_ds_init_one_object (
56 acpi_handle obj_handle,
57 u32 level,
58 void *context,
59 void **return_value);
60
52 61
53/******************************************************************************* 62/*******************************************************************************
54 * 63 *
55 * FUNCTION: acpi_ds_init_one_object 64 * FUNCTION: acpi_ds_init_one_object
56 * 65 *
57 * PARAMETERS: obj_handle - Node 66 * PARAMETERS: obj_handle - Node for the object
58 * Level - Current nesting level 67 * Level - Current nesting level
59 * Context - Points to a init info struct 68 * Context - Points to a init info struct
60 * return_value - Not used 69 * return_value - Not used
@@ -70,7 +79,7 @@
70 * 79 *
71 ******************************************************************************/ 80 ******************************************************************************/
72 81
73acpi_status 82static acpi_status
74acpi_ds_init_one_object ( 83acpi_ds_init_one_object (
75 acpi_handle obj_handle, 84 acpi_handle obj_handle,
76 u32 level, 85 u32 level,
@@ -105,7 +114,8 @@ acpi_ds_init_one_object (
105 114
106 status = acpi_ds_initialize_region (obj_handle); 115 status = acpi_ds_initialize_region (obj_handle);
107 if (ACPI_FAILURE (status)) { 116 if (ACPI_FAILURE (status)) {
108 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n", 117 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
118 "Region %p [%4.4s] - Init failure, %s\n",
109 obj_handle, acpi_ut_get_node_name (obj_handle), 119 obj_handle, acpi_ut_get_node_name (obj_handle),
110 acpi_format_exception (status))); 120 acpi_format_exception (status)));
111 } 121 }
@@ -118,8 +128,10 @@ acpi_ds_init_one_object (
118 128
119 info->method_count++; 129 info->method_count++;
120 130
121 /* Print a dot for each method unless we are going to print the entire pathname */ 131 /*
122 132 * Print a dot for each method unless we are going to print
133 * the entire pathname
134 */
123 if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { 135 if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
124 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); 136 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
125 } 137 }
@@ -140,7 +152,8 @@ acpi_ds_init_one_object (
140 */ 152 */
141 status = acpi_ds_parse_method (obj_handle); 153 status = acpi_ds_parse_method (obj_handle);
142 if (ACPI_FAILURE (status)) { 154 if (ACPI_FAILURE (status)) {
143 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n", 155 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
156 "Method %p [%4.4s] - parse failure, %s\n",
144 obj_handle, acpi_ut_get_node_name (obj_handle), 157 obj_handle, acpi_ut_get_node_name (obj_handle),
145 acpi_format_exception (status))); 158 acpi_format_exception (status)));
146 159
@@ -154,7 +167,8 @@ acpi_ds_init_one_object (
154 * for every execution since there isn't much overhead 167 * for every execution since there isn't much overhead
155 */ 168 */
156 acpi_ns_delete_namespace_subtree (obj_handle); 169 acpi_ns_delete_namespace_subtree (obj_handle);
157 acpi_ns_delete_namespace_by_owner (((struct acpi_namespace_node *) obj_handle)->object->method.owning_id); 170 acpi_ns_delete_namespace_by_owner (
171 ((struct acpi_namespace_node *) obj_handle)->object->method.owning_id);
158 break; 172 break;
159 173
160 174
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
index 9f0456cb9bb5..9fc3f4c033eb 100644
--- a/drivers/acpi/dispatcher/dsmethod.c
+++ b/drivers/acpi/dispatcher/dsmethod.c
@@ -153,12 +153,11 @@ acpi_ds_parse_method (
153 /* 153 /*
154 * Parse the method, first pass 154 * Parse the method, first pass
155 * 155 *
156 * The first pass load is where newly declared named objects are 156 * The first pass load is where newly declared named objects are added into
157 * added into the namespace. Actual evaluation of 157 * the namespace. Actual evaluation of the named objects (what would be
158 * the named objects (what would be called a "second 158 * called a "second pass") happens during the actual execution of the
159 * pass") happens during the actual execution of the 159 * method so that operands to the named objects can take on dynamic
160 * method so that operands to the named objects can 160 * run-time values.
161 * take on dynamic run-time values.
162 */ 161 */
163 status = acpi_ps_parse_aml (walk_state); 162 status = acpi_ps_parse_aml (walk_state);
164 if (ACPI_FAILURE (status)) { 163 if (ACPI_FAILURE (status)) {
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c
index f31d095f9833..f7998306f756 100644
--- a/drivers/acpi/dispatcher/dsmthdat.c
+++ b/drivers/acpi/dispatcher/dsmthdat.c
@@ -52,6 +52,29 @@
52#define _COMPONENT ACPI_DISPATCHER 52#define _COMPONENT ACPI_DISPATCHER
53 ACPI_MODULE_NAME ("dsmthdat") 53 ACPI_MODULE_NAME ("dsmthdat")
54 54
55/* Local prototypes */
56
57static void
58acpi_ds_method_data_delete_value (
59 u16 opcode,
60 u32 index,
61 struct acpi_walk_state *walk_state);
62
63static acpi_status
64acpi_ds_method_data_set_value (
65 u16 opcode,
66 u32 index,
67 union acpi_operand_object *object,
68 struct acpi_walk_state *walk_state);
69
70#ifdef ACPI_OBSOLETE_FUNCTIONS
71acpi_object_type
72acpi_ds_method_data_get_type (
73 u16 opcode,
74 u32 index,
75 struct acpi_walk_state *walk_state);
76#endif
77
55 78
56/******************************************************************************* 79/*******************************************************************************
57 * 80 *
@@ -62,8 +85,8 @@
62 * RETURN: Status 85 * RETURN: Status
63 * 86 *
64 * DESCRIPTION: Initialize the data structures that hold the method's arguments 87 * DESCRIPTION: Initialize the data structures that hold the method's arguments
65 * and locals. The data struct is an array of NTEs for each. 88 * and locals. The data struct is an array of namespace nodes for
66 * This allows ref_of and de_ref_of to work properly for these 89 * each - this allows ref_of and de_ref_of to work properly for these
67 * special data types. 90 * special data types.
68 * 91 *
69 * NOTES: walk_state fields are initialized to zero by the 92 * NOTES: walk_state fields are initialized to zero by the
@@ -92,7 +115,8 @@ acpi_ds_method_data_init (
92 walk_state->arguments[i].name.integer |= (i << 24); 115 walk_state->arguments[i].name.integer |= (i << 24);
93 walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; 116 walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED;
94 walk_state->arguments[i].type = ACPI_TYPE_ANY; 117 walk_state->arguments[i].type = ACPI_TYPE_ANY;
95 walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG; 118 walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST |
119 ANOBJ_METHOD_ARG;
96 } 120 }
97 121
98 /* Init the method locals */ 122 /* Init the method locals */
@@ -104,7 +128,8 @@ acpi_ds_method_data_init (
104 walk_state->local_variables[i].name.integer |= (i << 24); 128 walk_state->local_variables[i].name.integer |= (i << 24);
105 walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED; 129 walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED;
106 walk_state->local_variables[i].type = ACPI_TYPE_ANY; 130 walk_state->local_variables[i].type = ACPI_TYPE_ANY;
107 walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; 131 walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST |
132 ANOBJ_METHOD_LOCAL;
108 } 133 }
109 134
110 return_VOID; 135 return_VOID;
@@ -198,15 +223,18 @@ acpi_ds_method_data_init_args (
198 return_ACPI_STATUS (AE_OK); 223 return_ACPI_STATUS (AE_OK);
199 } 224 }
200 225
201 /* Copy passed parameters into the new method stack frame */ 226 /* Copy passed parameters into the new method stack frame */
202 227
203 while ((index < ACPI_METHOD_NUM_ARGS) && (index < max_param_count) && params[index]) { 228 while ((index < ACPI_METHOD_NUM_ARGS) &&
229 (index < max_param_count) &&
230 params[index]) {
204 /* 231 /*
205 * A valid parameter. 232 * A valid parameter.
206 * Store the argument in the method/walk descriptor. 233 * Store the argument in the method/walk descriptor.
207 * Do not copy the arg in order to implement call by reference 234 * Do not copy the arg in order to implement call by reference
208 */ 235 */
209 status = acpi_ds_method_data_set_value (AML_ARG_OP, index, params[index], walk_state); 236 status = acpi_ds_method_data_set_value (AML_ARG_OP, index,
237 params[index], walk_state);
210 if (ACPI_FAILURE (status)) { 238 if (ACPI_FAILURE (status)) {
211 return_ACPI_STATUS (status); 239 return_ACPI_STATUS (status);
212 } 240 }
@@ -224,11 +252,13 @@ acpi_ds_method_data_init_args (
224 * FUNCTION: acpi_ds_method_data_get_node 252 * FUNCTION: acpi_ds_method_data_get_node
225 * 253 *
226 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP 254 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
227 * Index - which local_var or argument whose type 255 * Index - Which Local or Arg whose type to get
228 * to get
229 * walk_state - Current walk state object 256 * walk_state - Current walk state object
257 * Node - Where the node is returned.
230 * 258 *
231 * RETURN: Get the Node associated with a local or arg. 259 * RETURN: Status and node
260 *
261 * DESCRIPTION: Get the Node associated with a local or arg.
232 * 262 *
233 ******************************************************************************/ 263 ******************************************************************************/
234 264
@@ -249,7 +279,8 @@ acpi_ds_method_data_get_node (
249 case AML_LOCAL_OP: 279 case AML_LOCAL_OP:
250 280
251 if (index > ACPI_METHOD_MAX_LOCAL) { 281 if (index > ACPI_METHOD_MAX_LOCAL) {
252 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n", 282 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
283 "Local index %d is invalid (max %d)\n",
253 index, ACPI_METHOD_MAX_LOCAL)); 284 index, ACPI_METHOD_MAX_LOCAL));
254 return_ACPI_STATUS (AE_AML_INVALID_INDEX); 285 return_ACPI_STATUS (AE_AML_INVALID_INDEX);
255 } 286 }
@@ -262,7 +293,8 @@ acpi_ds_method_data_get_node (
262 case AML_ARG_OP: 293 case AML_ARG_OP:
263 294
264 if (index > ACPI_METHOD_MAX_ARG) { 295 if (index > ACPI_METHOD_MAX_ARG) {
265 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n", 296 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
297 "Arg index %d is invalid (max %d)\n",
266 index, ACPI_METHOD_MAX_ARG)); 298 index, ACPI_METHOD_MAX_ARG));
267 return_ACPI_STATUS (AE_AML_INVALID_INDEX); 299 return_ACPI_STATUS (AE_AML_INVALID_INDEX);
268 } 300 }
@@ -286,7 +318,7 @@ acpi_ds_method_data_get_node (
286 * FUNCTION: acpi_ds_method_data_set_value 318 * FUNCTION: acpi_ds_method_data_set_value
287 * 319 *
288 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP 320 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
289 * Index - which local_var or argument to get 321 * Index - Which Local or Arg to get
290 * Object - Object to be inserted into the stack entry 322 * Object - Object to be inserted into the stack entry
291 * walk_state - Current walk state object 323 * walk_state - Current walk state object
292 * 324 *
@@ -297,7 +329,7 @@ acpi_ds_method_data_get_node (
297 * 329 *
298 ******************************************************************************/ 330 ******************************************************************************/
299 331
300acpi_status 332static acpi_status
301acpi_ds_method_data_set_value ( 333acpi_ds_method_data_set_value (
302 u16 opcode, 334 u16 opcode,
303 u32 index, 335 u32 index,
@@ -340,68 +372,16 @@ acpi_ds_method_data_set_value (
340 372
341/******************************************************************************* 373/*******************************************************************************
342 * 374 *
343 * FUNCTION: acpi_ds_method_data_get_type
344 *
345 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
346 * Index - which local_var or argument whose type
347 * to get
348 * walk_state - Current walk state object
349 *
350 * RETURN: Data type of current value of the selected Arg or Local
351 *
352 ******************************************************************************/
353#ifdef ACPI_FUTURE_USAGE
354acpi_object_type
355acpi_ds_method_data_get_type (
356 u16 opcode,
357 u32 index,
358 struct acpi_walk_state *walk_state)
359{
360 acpi_status status;
361 struct acpi_namespace_node *node;
362 union acpi_operand_object *object;
363
364
365 ACPI_FUNCTION_TRACE ("ds_method_data_get_type");
366
367
368 /* Get the namespace node for the arg/local */
369
370 status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
371 if (ACPI_FAILURE (status)) {
372 return_VALUE ((ACPI_TYPE_NOT_FOUND));
373 }
374
375 /* Get the object */
376
377 object = acpi_ns_get_attached_object (node);
378 if (!object) {
379 /* Uninitialized local/arg, return TYPE_ANY */
380
381 return_VALUE (ACPI_TYPE_ANY);
382 }
383
384 /* Get the object type */
385
386 return_VALUE (ACPI_GET_OBJECT_TYPE (object));
387}
388#endif /* ACPI_FUTURE_USAGE */
389
390
391/*******************************************************************************
392 *
393 * FUNCTION: acpi_ds_method_data_get_value 375 * FUNCTION: acpi_ds_method_data_get_value
394 * 376 *
395 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP 377 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
396 * Index - which local_var or argument to get 378 * Index - which local_var or argument to get
397 * walk_state - Current walk state object 379 * walk_state - Current walk state object
398 * *dest_desc - Ptr to Descriptor into which selected Arg 380 * dest_desc - Where Arg or Local value is returned
399 * or Local value should be copied
400 * 381 *
401 * RETURN: Status 382 * RETURN: Status
402 * 383 *
403 * DESCRIPTION: Retrieve value of selected Arg or Local from the method frame 384 * DESCRIPTION: Retrieve value of selected Arg or Local for this method
404 * at the current top of the method stack.
405 * Used only in acpi_ex_resolve_to_value(). 385 * Used only in acpi_ex_resolve_to_value().
406 * 386 *
407 ******************************************************************************/ 387 ******************************************************************************/
@@ -467,14 +447,16 @@ acpi_ds_method_data_get_value (
467 else switch (opcode) { 447 else switch (opcode) {
468 case AML_ARG_OP: 448 case AML_ARG_OP:
469 449
470 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at node %p\n", 450 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
451 "Uninitialized Arg[%d] at node %p\n",
471 index, node)); 452 index, node));
472 453
473 return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); 454 return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
474 455
475 case AML_LOCAL_OP: 456 case AML_LOCAL_OP:
476 457
477 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at node %p\n", 458 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
459 "Uninitialized Local[%d] at node %p\n",
478 index, node)); 460 index, node));
479 461
480 return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); 462 return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
@@ -506,12 +488,12 @@ acpi_ds_method_data_get_value (
506 * 488 *
507 * RETURN: None 489 * RETURN: None
508 * 490 *
509 * DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts 491 * DESCRIPTION: Delete the entry at Opcode:Index. Inserts
510 * a null into the stack slot after the object is deleted. 492 * a null into the stack slot after the object is deleted.
511 * 493 *
512 ******************************************************************************/ 494 ******************************************************************************/
513 495
514void 496static void
515acpi_ds_method_data_delete_value ( 497acpi_ds_method_data_delete_value (
516 u16 opcode, 498 u16 opcode,
517 u32 index, 499 u32 index,
@@ -562,7 +544,7 @@ acpi_ds_method_data_delete_value (
562 * FUNCTION: acpi_ds_store_object_to_local 544 * FUNCTION: acpi_ds_store_object_to_local
563 * 545 *
564 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP 546 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
565 * Index - which local_var or argument to set 547 * Index - Which Local or Arg to set
566 * obj_desc - Value to be stored 548 * obj_desc - Value to be stored
567 * walk_state - Current walk state 549 * walk_state - Current walk state
568 * 550 *
@@ -651,19 +633,20 @@ acpi_ds_store_object_to_local (
651 */ 633 */
652 if (opcode == AML_ARG_OP) { 634 if (opcode == AML_ARG_OP) {
653 /* 635 /*
654 * Make sure that the object is the correct type. This may be overkill, but 636 * Make sure that the object is the correct type. This may be
655 * it is here because references were NS nodes in the past. Now they are 637 * overkill, butit is here because references were NS nodes in
656 * operand objects of type Reference. 638 * the past. Now they are operand objects of type Reference.
657 */ 639 */
658 if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) { 640 if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) {
659 ACPI_REPORT_ERROR (("Invalid descriptor type while storing to method arg: [%s]\n", 641 ACPI_REPORT_ERROR ((
660 acpi_ut_get_descriptor_name (current_obj_desc))); 642 "Invalid descriptor type while storing to method arg: [%s]\n",
643 acpi_ut_get_descriptor_name (current_obj_desc)));
661 return_ACPI_STATUS (AE_AML_INTERNAL); 644 return_ACPI_STATUS (AE_AML_INTERNAL);
662 } 645 }
663 646
664 /* 647 /*
665 * If we have a valid reference object that came from ref_of(), do the 648 * If we have a valid reference object that came from ref_of(),
666 * indirect store 649 * do the indirect store
667 */ 650 */
668 if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) && 651 if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
669 (current_obj_desc->reference.opcode == AML_REF_OF_OP)) { 652 (current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
@@ -713,3 +696,55 @@ acpi_ds_store_object_to_local (
713} 696}
714 697
715 698
699#ifdef ACPI_OBSOLETE_FUNCTIONS
700/*******************************************************************************
701 *
702 * FUNCTION: acpi_ds_method_data_get_type
703 *
704 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
705 * Index - Which Local or Arg whose type to get
706 * walk_state - Current walk state object
707 *
708 * RETURN: Data type of current value of the selected Arg or Local
709 *
710 * DESCRIPTION: Get the type of the object stored in the Local or Arg
711 *
712 ******************************************************************************/
713
714acpi_object_type
715acpi_ds_method_data_get_type (
716 u16 opcode,
717 u32 index,
718 struct acpi_walk_state *walk_state)
719{
720 acpi_status status;
721 struct acpi_namespace_node *node;
722 union acpi_operand_object *object;
723
724
725 ACPI_FUNCTION_TRACE ("ds_method_data_get_type");
726
727
728 /* Get the namespace node for the arg/local */
729
730 status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
731 if (ACPI_FAILURE (status)) {
732 return_VALUE ((ACPI_TYPE_NOT_FOUND));
733 }
734
735 /* Get the object */
736
737 object = acpi_ns_get_attached_object (node);
738 if (!object) {
739 /* Uninitialized local/arg, return TYPE_ANY */
740
741 return_VALUE (ACPI_TYPE_ANY);
742 }
743
744 /* Get the object type */
745
746 return_VALUE (ACPI_GET_OBJECT_TYPE (object));
747}
748#endif
749
750
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c
index eb8af4785bcb..bfbae4e4c667 100644
--- a/drivers/acpi/dispatcher/dsobject.c
+++ b/drivers/acpi/dispatcher/dsobject.c
@@ -52,9 +52,15 @@
52#define _COMPONENT ACPI_DISPATCHER 52#define _COMPONENT ACPI_DISPATCHER
53 ACPI_MODULE_NAME ("dsobject") 53 ACPI_MODULE_NAME ("dsobject")
54 54
55static acpi_status
56acpi_ds_build_internal_object (
57 struct acpi_walk_state *walk_state,
58 union acpi_parse_object *op,
59 union acpi_operand_object **obj_desc_ptr);
60
55 61
56#ifndef ACPI_NO_METHOD_EXECUTION 62#ifndef ACPI_NO_METHOD_EXECUTION
57/***************************************************************************** 63/*******************************************************************************
58 * 64 *
59 * FUNCTION: acpi_ds_build_internal_object 65 * FUNCTION: acpi_ds_build_internal_object
60 * 66 *
@@ -67,9 +73,9 @@
67 * DESCRIPTION: Translate a parser Op object to the equivalent namespace object 73 * DESCRIPTION: Translate a parser Op object to the equivalent namespace object
68 * Simple objects are any objects other than a package object! 74 * Simple objects are any objects other than a package object!
69 * 75 *
70 ****************************************************************************/ 76 ******************************************************************************/
71 77
72acpi_status 78static acpi_status
73acpi_ds_build_internal_object ( 79acpi_ds_build_internal_object (
74 struct acpi_walk_state *walk_state, 80 struct acpi_walk_state *walk_state,
75 union acpi_parse_object *op, 81 union acpi_parse_object *op,
@@ -90,9 +96,11 @@ acpi_ds_build_internal_object (
90 * Otherwise, go ahead and look it up now 96 * Otherwise, go ahead and look it up now
91 */ 97 */
92 if (!op->common.node) { 98 if (!op->common.node) {
93 status = acpi_ns_lookup (walk_state->scope_info, op->common.value.string, 99 status = acpi_ns_lookup (walk_state->scope_info,
100 op->common.value.string,
94 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 101 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
95 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, 102 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
103 NULL,
96 (struct acpi_namespace_node **) &(op->common.node)); 104 (struct acpi_namespace_node **) &(op->common.node));
97 105
98 if (ACPI_FAILURE (status)) { 106 if (ACPI_FAILURE (status)) {
@@ -104,12 +112,14 @@ acpi_ds_build_internal_object (
104 112
105 /* Create and init the internal ACPI object */ 113 /* Create and init the internal ACPI object */
106 114
107 obj_desc = acpi_ut_create_internal_object ((acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type); 115 obj_desc = acpi_ut_create_internal_object (
116 (acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type);
108 if (!obj_desc) { 117 if (!obj_desc) {
109 return_ACPI_STATUS (AE_NO_MEMORY); 118 return_ACPI_STATUS (AE_NO_MEMORY);
110 } 119 }
111 120
112 status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode, &obj_desc); 121 status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode,
122 &obj_desc);
113 if (ACPI_FAILURE (status)) { 123 if (ACPI_FAILURE (status)) {
114 acpi_ut_remove_reference (obj_desc); 124 acpi_ut_remove_reference (obj_desc);
115 return_ACPI_STATUS (status); 125 return_ACPI_STATUS (status);
@@ -120,7 +130,7 @@ acpi_ds_build_internal_object (
120} 130}
121 131
122 132
123/***************************************************************************** 133/*******************************************************************************
124 * 134 *
125 * FUNCTION: acpi_ds_build_internal_buffer_obj 135 * FUNCTION: acpi_ds_build_internal_buffer_obj
126 * 136 *
@@ -134,7 +144,7 @@ acpi_ds_build_internal_object (
134 * DESCRIPTION: Translate a parser Op package object to the equivalent 144 * DESCRIPTION: Translate a parser Op package object to the equivalent
135 * namespace object 145 * namespace object
136 * 146 *
137 ****************************************************************************/ 147 ******************************************************************************/
138 148
139acpi_status 149acpi_status
140acpi_ds_build_internal_buffer_obj ( 150acpi_ds_build_internal_buffer_obj (
@@ -229,7 +239,7 @@ acpi_ds_build_internal_buffer_obj (
229} 239}
230 240
231 241
232/***************************************************************************** 242/*******************************************************************************
233 * 243 *
234 * FUNCTION: acpi_ds_build_internal_package_obj 244 * FUNCTION: acpi_ds_build_internal_package_obj
235 * 245 *
@@ -243,7 +253,7 @@ acpi_ds_build_internal_buffer_obj (
243 * DESCRIPTION: Translate a parser Op package object to the equivalent 253 * DESCRIPTION: Translate a parser Op package object to the equivalent
244 * namespace object 254 * namespace object
245 * 255 *
246 ****************************************************************************/ 256 ******************************************************************************/
247 257
248acpi_status 258acpi_status
249acpi_ds_build_internal_package_obj ( 259acpi_ds_build_internal_package_obj (
@@ -331,11 +341,12 @@ acpi_ds_build_internal_package_obj (
331 if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { 341 if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
332 /* Object (package or buffer) is already built */ 342 /* Object (package or buffer) is already built */
333 343
334 obj_desc->package.elements[i] = ACPI_CAST_PTR (union acpi_operand_object, arg->common.node); 344 obj_desc->package.elements[i] =
345 ACPI_CAST_PTR (union acpi_operand_object, arg->common.node);
335 } 346 }
336 else { 347 else {
337 status = acpi_ds_build_internal_object (walk_state, arg, 348 status = acpi_ds_build_internal_object (walk_state, arg,
338 &obj_desc->package.elements[i]); 349 &obj_desc->package.elements[i]);
339 } 350 }
340 351
341 i++; 352 i++;
@@ -348,7 +359,7 @@ acpi_ds_build_internal_package_obj (
348} 359}
349 360
350 361
351/***************************************************************************** 362/*******************************************************************************
352 * 363 *
353 * FUNCTION: acpi_ds_create_node 364 * FUNCTION: acpi_ds_create_node
354 * 365 *
@@ -360,7 +371,7 @@ acpi_ds_build_internal_package_obj (
360 * 371 *
361 * DESCRIPTION: Create the object to be associated with a namespace node 372 * DESCRIPTION: Create the object to be associated with a namespace node
362 * 373 *
363 ****************************************************************************/ 374 ******************************************************************************/
364 375
365acpi_status 376acpi_status
366acpi_ds_create_node ( 377acpi_ds_create_node (
@@ -392,7 +403,8 @@ acpi_ds_create_node (
392 403
393 /* Build an internal object for the argument(s) */ 404 /* Build an internal object for the argument(s) */
394 405
395 status = acpi_ds_build_internal_object (walk_state, op->common.value.arg, &obj_desc); 406 status = acpi_ds_build_internal_object (walk_state, op->common.value.arg,
407 &obj_desc);
396 if (ACPI_FAILURE (status)) { 408 if (ACPI_FAILURE (status)) {
397 return_ACPI_STATUS (status); 409 return_ACPI_STATUS (status);
398 } 410 }
@@ -414,7 +426,7 @@ acpi_ds_create_node (
414#endif /* ACPI_NO_METHOD_EXECUTION */ 426#endif /* ACPI_NO_METHOD_EXECUTION */
415 427
416 428
417/***************************************************************************** 429/*******************************************************************************
418 * 430 *
419 * FUNCTION: acpi_ds_init_object_from_op 431 * FUNCTION: acpi_ds_init_object_from_op
420 * 432 *
@@ -429,7 +441,7 @@ acpi_ds_create_node (
429 * associated arguments. The namespace object is a more compact 441 * associated arguments. The namespace object is a more compact
430 * representation of the Op and its arguments. 442 * representation of the Op and its arguments.
431 * 443 *
432 ****************************************************************************/ 444 ******************************************************************************/
433 445
434acpi_status 446acpi_status
435acpi_ds_init_object_from_op ( 447acpi_ds_init_object_from_op (
@@ -462,7 +474,8 @@ acpi_ds_init_object_from_op (
462 /* 474 /*
463 * Defer evaluation of Buffer term_arg operand 475 * Defer evaluation of Buffer term_arg operand
464 */ 476 */
465 obj_desc->buffer.node = (struct acpi_namespace_node *) walk_state->operands[0]; 477 obj_desc->buffer.node = (struct acpi_namespace_node *)
478 walk_state->operands[0];
466 obj_desc->buffer.aml_start = op->named.data; 479 obj_desc->buffer.aml_start = op->named.data;
467 obj_desc->buffer.aml_length = op->named.length; 480 obj_desc->buffer.aml_length = op->named.length;
468 break; 481 break;
@@ -473,7 +486,8 @@ acpi_ds_init_object_from_op (
473 /* 486 /*
474 * Defer evaluation of Package term_arg operand 487 * Defer evaluation of Package term_arg operand
475 */ 488 */
476 obj_desc->package.node = (struct acpi_namespace_node *) walk_state->operands[0]; 489 obj_desc->package.node = (struct acpi_namespace_node *)
490 walk_state->operands[0];
477 obj_desc->package.aml_start = op->named.data; 491 obj_desc->package.aml_start = op->named.data;
478 obj_desc->package.aml_length = op->named.length; 492 obj_desc->package.aml_length = op->named.length;
479 break; 493 break;
@@ -486,9 +500,10 @@ acpi_ds_init_object_from_op (
486 /* 500 /*
487 * Resolve AML Constants here - AND ONLY HERE! 501 * Resolve AML Constants here - AND ONLY HERE!
488 * All constants are integers. 502 * All constants are integers.
489 * We mark the integer with a flag that indicates that it started life 503 * We mark the integer with a flag that indicates that it started
490 * as a constant -- so that stores to constants will perform as expected (noop). 504 * life as a constant -- so that stores to constants will perform
491 * (zero_op is used as a placeholder for optional target operands.) 505 * as expected (noop). zero_op is used as a placeholder for optional
506 * target operands.
492 */ 507 */
493 obj_desc->common.flags = AOPOBJ_AML_CONSTANT; 508 obj_desc->common.flags = AOPOBJ_AML_CONSTANT;
494 509
@@ -521,7 +536,8 @@ acpi_ds_init_object_from_op (
521 536
522 default: 537 default:
523 538
524 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", opcode)); 539 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
540 "Unknown constant opcode %X\n", opcode));
525 status = AE_AML_OPERAND_TYPE; 541 status = AE_AML_OPERAND_TYPE;
526 break; 542 break;
527 } 543 }
@@ -535,7 +551,8 @@ acpi_ds_init_object_from_op (
535 551
536 552
537 default: 553 default:
538 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", op_info->type)); 554 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n",
555 op_info->type));
539 status = AE_AML_OPERAND_TYPE; 556 status = AE_AML_OPERAND_TYPE;
540 break; 557 break;
541 } 558 }
@@ -570,8 +587,10 @@ acpi_ds_init_object_from_op (
570 obj_desc->reference.offset = opcode - AML_LOCAL_OP; 587 obj_desc->reference.offset = opcode - AML_LOCAL_OP;
571 588
572#ifndef ACPI_NO_METHOD_EXECUTION 589#ifndef ACPI_NO_METHOD_EXECUTION
573 status = acpi_ds_method_data_get_node (AML_LOCAL_OP, obj_desc->reference.offset, 590 status = acpi_ds_method_data_get_node (AML_LOCAL_OP,
574 walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); 591 obj_desc->reference.offset,
592 walk_state,
593 (struct acpi_namespace_node **) &obj_desc->reference.object);
575#endif 594#endif
576 break; 595 break;
577 596
@@ -584,8 +603,10 @@ acpi_ds_init_object_from_op (
584 obj_desc->reference.offset = opcode - AML_ARG_OP; 603 obj_desc->reference.offset = opcode - AML_ARG_OP;
585 604
586#ifndef ACPI_NO_METHOD_EXECUTION 605#ifndef ACPI_NO_METHOD_EXECUTION
587 status = acpi_ds_method_data_get_node (AML_ARG_OP, obj_desc->reference.offset, 606 status = acpi_ds_method_data_get_node (AML_ARG_OP,
588 walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); 607 obj_desc->reference.offset,
608 walk_state,
609 (struct acpi_namespace_node **) &obj_desc->reference.object);
589#endif 610#endif
590 break; 611 break;
591 612
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c
index 5c987a0e7b75..ba13bca28bee 100644
--- a/drivers/acpi/dispatcher/dsopcode.c
+++ b/drivers/acpi/dispatcher/dsopcode.c
@@ -54,12 +54,31 @@
54#define _COMPONENT ACPI_DISPATCHER 54#define _COMPONENT ACPI_DISPATCHER
55 ACPI_MODULE_NAME ("dsopcode") 55 ACPI_MODULE_NAME ("dsopcode")
56 56
57/* Local prototypes */
57 58
58/***************************************************************************** 59static acpi_status
60acpi_ds_execute_arguments (
61 struct acpi_namespace_node *node,
62 struct acpi_namespace_node *scope_node,
63 u32 aml_length,
64 u8 *aml_start);
65
66static acpi_status
67acpi_ds_init_buffer_field (
68 u16 aml_opcode,
69 union acpi_operand_object *obj_desc,
70 union acpi_operand_object *buffer_desc,
71 union acpi_operand_object *offset_desc,
72 union acpi_operand_object *length_desc,
73 union acpi_operand_object *result_desc);
74
75
76/*******************************************************************************
59 * 77 *
60 * FUNCTION: acpi_ds_execute_arguments 78 * FUNCTION: acpi_ds_execute_arguments
61 * 79 *
62 * PARAMETERS: Node - Parent NS node 80 * PARAMETERS: Node - Object NS node
81 * scope_node - Parent NS node
63 * aml_length - Length of executable AML 82 * aml_length - Length of executable AML
64 * aml_start - Pointer to the AML 83 * aml_start - Pointer to the AML
65 * 84 *
@@ -67,9 +86,9 @@
67 * 86 *
68 * DESCRIPTION: Late (deferred) execution of region or field arguments 87 * DESCRIPTION: Late (deferred) execution of region or field arguments
69 * 88 *
70 ****************************************************************************/ 89 ******************************************************************************/
71 90
72acpi_status 91static acpi_status
73acpi_ds_execute_arguments ( 92acpi_ds_execute_arguments (
74 struct acpi_namespace_node *node, 93 struct acpi_namespace_node *node,
75 struct acpi_namespace_node *scope_node, 94 struct acpi_namespace_node *scope_node,
@@ -162,7 +181,7 @@ acpi_ds_execute_arguments (
162} 181}
163 182
164 183
165/***************************************************************************** 184/*******************************************************************************
166 * 185 *
167 * FUNCTION: acpi_ds_get_buffer_field_arguments 186 * FUNCTION: acpi_ds_get_buffer_field_arguments
168 * 187 *
@@ -173,7 +192,7 @@ acpi_ds_execute_arguments (
173 * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late 192 * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late
174 * evaluation of these field attributes. 193 * evaluation of these field attributes.
175 * 194 *
176 ****************************************************************************/ 195 ******************************************************************************/
177 196
178acpi_status 197acpi_status
179acpi_ds_get_buffer_field_arguments ( 198acpi_ds_get_buffer_field_arguments (
@@ -208,7 +227,7 @@ acpi_ds_get_buffer_field_arguments (
208} 227}
209 228
210 229
211/***************************************************************************** 230/*******************************************************************************
212 * 231 *
213 * FUNCTION: acpi_ds_get_buffer_arguments 232 * FUNCTION: acpi_ds_get_buffer_arguments
214 * 233 *
@@ -219,7 +238,7 @@ acpi_ds_get_buffer_field_arguments (
219 * DESCRIPTION: Get Buffer length and initializer byte list. This implements 238 * DESCRIPTION: Get Buffer length and initializer byte list. This implements
220 * the late evaluation of these attributes. 239 * the late evaluation of these attributes.
221 * 240 *
222 ****************************************************************************/ 241 ******************************************************************************/
223 242
224acpi_status 243acpi_status
225acpi_ds_get_buffer_arguments ( 244acpi_ds_get_buffer_arguments (
@@ -255,7 +274,7 @@ acpi_ds_get_buffer_arguments (
255} 274}
256 275
257 276
258/***************************************************************************** 277/*******************************************************************************
259 * 278 *
260 * FUNCTION: acpi_ds_get_package_arguments 279 * FUNCTION: acpi_ds_get_package_arguments
261 * 280 *
@@ -266,7 +285,7 @@ acpi_ds_get_buffer_arguments (
266 * DESCRIPTION: Get Package length and initializer byte list. This implements 285 * DESCRIPTION: Get Package length and initializer byte list. This implements
267 * the late evaluation of these attributes. 286 * the late evaluation of these attributes.
268 * 287 *
269 ****************************************************************************/ 288 ******************************************************************************/
270 289
271acpi_status 290acpi_status
272acpi_ds_get_package_arguments ( 291acpi_ds_get_package_arguments (
@@ -353,17 +372,17 @@ acpi_ds_get_region_arguments (
353} 372}
354 373
355 374
356/***************************************************************************** 375/*******************************************************************************
357 * 376 *
358 * FUNCTION: acpi_ds_initialize_region 377 * FUNCTION: acpi_ds_initialize_region
359 * 378 *
360 * PARAMETERS: Op - A valid region Op object 379 * PARAMETERS: obj_handle - Region namespace node
361 * 380 *
362 * RETURN: Status 381 * RETURN: Status
363 * 382 *
364 * DESCRIPTION: Front end to ev_initialize_region 383 * DESCRIPTION: Front end to ev_initialize_region
365 * 384 *
366 ****************************************************************************/ 385 ******************************************************************************/
367 386
368acpi_status 387acpi_status
369acpi_ds_initialize_region ( 388acpi_ds_initialize_region (
@@ -382,7 +401,7 @@ acpi_ds_initialize_region (
382} 401}
383 402
384 403
385/***************************************************************************** 404/*******************************************************************************
386 * 405 *
387 * FUNCTION: acpi_ds_init_buffer_field 406 * FUNCTION: acpi_ds_init_buffer_field
388 * 407 *
@@ -390,16 +409,16 @@ acpi_ds_initialize_region (
390 * obj_desc - buffer_field object 409 * obj_desc - buffer_field object
391 * buffer_desc - Host Buffer 410 * buffer_desc - Host Buffer
392 * offset_desc - Offset into buffer 411 * offset_desc - Offset into buffer
393 * Length - Length of field (CREATE_FIELD_OP only) 412 * length_desc - Length of field (CREATE_FIELD_OP only)
394 * Result - Where to store the result 413 * result_desc - Where to store the result
395 * 414 *
396 * RETURN: Status 415 * RETURN: Status
397 * 416 *
398 * DESCRIPTION: Perform actual initialization of a buffer field 417 * DESCRIPTION: Perform actual initialization of a buffer field
399 * 418 *
400 ****************************************************************************/ 419 ******************************************************************************/
401 420
402acpi_status 421static acpi_status
403acpi_ds_init_buffer_field ( 422acpi_ds_init_buffer_field (
404 u16 aml_opcode, 423 u16 aml_opcode,
405 union acpi_operand_object *obj_desc, 424 union acpi_operand_object *obj_desc,
@@ -435,8 +454,10 @@ acpi_ds_init_buffer_field (
435 * after resolution in acpi_ex_resolve_operands(). 454 * after resolution in acpi_ex_resolve_operands().
436 */ 455 */
437 if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) { 456 if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) {
438 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination not a NS Node [%s]\n", 457 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
439 acpi_ps_get_opcode_name (aml_opcode), acpi_ut_get_descriptor_name (result_desc))); 458 "(%s) destination not a NS Node [%s]\n",
459 acpi_ps_get_opcode_name (aml_opcode),
460 acpi_ut_get_descriptor_name (result_desc)));
440 461
441 status = AE_AML_OPERAND_TYPE; 462 status = AE_AML_OPERAND_TYPE;
442 goto cleanup; 463 goto cleanup;
@@ -452,9 +473,18 @@ acpi_ds_init_buffer_field (
452 473
453 /* Offset is in bits, count is in bits */ 474 /* Offset is in bits, count is in bits */
454 475
476 field_flags = AML_FIELD_ACCESS_BYTE;
455 bit_offset = offset; 477 bit_offset = offset;
456 bit_count = (u32) length_desc->integer.value; 478 bit_count = (u32) length_desc->integer.value;
457 field_flags = AML_FIELD_ACCESS_BYTE; 479
480 /* Must have a valid (>0) bit count */
481
482 if (bit_count == 0) {
483 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
484 "Attempt to create_field of length 0\n"));
485 status = AE_AML_OPERAND_VALUE;
486 goto cleanup;
487 }
458 break; 488 break;
459 489
460 case AML_CREATE_BIT_FIELD_OP: 490 case AML_CREATE_BIT_FIELD_OP:
@@ -527,7 +557,8 @@ acpi_ds_init_buffer_field (
527 557
528 /* 558 /*
529 * Initialize areas of the field object that are common to all fields 559 * Initialize areas of the field object that are common to all fields
530 * For field_flags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE) 560 * For field_flags, use LOCK_RULE = 0 (NO_LOCK),
561 * UPDATE_RULE = 0 (UPDATE_PRESERVE)
531 */ 562 */
532 status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0, 563 status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0,
533 bit_offset, bit_count); 564 bit_offset, bit_count);
@@ -539,8 +570,8 @@ acpi_ds_init_buffer_field (
539 570
540 /* Reference count for buffer_desc inherits obj_desc count */ 571 /* Reference count for buffer_desc inherits obj_desc count */
541 572
542 buffer_desc->common.reference_count = (u16) (buffer_desc->common.reference_count + 573 buffer_desc->common.reference_count = (u16)
543 obj_desc->common.reference_count); 574 (buffer_desc->common.reference_count + obj_desc->common.reference_count);
544 575
545 576
546cleanup: 577cleanup:
@@ -569,7 +600,7 @@ cleanup:
569} 600}
570 601
571 602
572/***************************************************************************** 603/*******************************************************************************
573 * 604 *
574 * FUNCTION: acpi_ds_eval_buffer_field_operands 605 * FUNCTION: acpi_ds_eval_buffer_field_operands
575 * 606 *
@@ -581,7 +612,7 @@ cleanup:
581 * DESCRIPTION: Get buffer_field Buffer and Index 612 * DESCRIPTION: Get buffer_field Buffer and Index
582 * Called from acpi_ds_exec_end_op during buffer_field parse tree walk 613 * Called from acpi_ds_exec_end_op during buffer_field parse tree walk
583 * 614 *
584 ****************************************************************************/ 615 ******************************************************************************/
585 616
586acpi_status 617acpi_status
587acpi_ds_eval_buffer_field_operands ( 618acpi_ds_eval_buffer_field_operands (
@@ -656,7 +687,7 @@ acpi_ds_eval_buffer_field_operands (
656} 687}
657 688
658 689
659/***************************************************************************** 690/*******************************************************************************
660 * 691 *
661 * FUNCTION: acpi_ds_eval_region_operands 692 * FUNCTION: acpi_ds_eval_region_operands
662 * 693 *
@@ -668,7 +699,7 @@ acpi_ds_eval_buffer_field_operands (
668 * DESCRIPTION: Get region address and length 699 * DESCRIPTION: Get region address and length
669 * Called from acpi_ds_exec_end_op during op_region parse tree walk 700 * Called from acpi_ds_exec_end_op during op_region parse tree walk
670 * 701 *
671 ****************************************************************************/ 702 ******************************************************************************/
672 703
673acpi_status 704acpi_status
674acpi_ds_eval_region_operands ( 705acpi_ds_eval_region_operands (
@@ -686,7 +717,8 @@ acpi_ds_eval_region_operands (
686 717
687 718
688 /* 719 /*
689 * This is where we evaluate the address and length fields of the op_region declaration 720 * This is where we evaluate the address and length fields of the
721 * op_region declaration
690 */ 722 */
691 node = op->common.node; 723 node = op->common.node;
692 724
@@ -707,7 +739,8 @@ acpi_ds_eval_region_operands (
707 739
708 /* Resolve the length and address operands to numbers */ 740 /* Resolve the length and address operands to numbers */
709 741
710 status = acpi_ex_resolve_operands (op->common.aml_opcode, ACPI_WALK_OPERANDS, walk_state); 742 status = acpi_ex_resolve_operands (op->common.aml_opcode,
743 ACPI_WALK_OPERANDS, walk_state);
711 if (ACPI_FAILURE (status)) { 744 if (ACPI_FAILURE (status)) {
712 return_ACPI_STATUS (status); 745 return_ACPI_STATUS (status);
713 } 746 }
@@ -736,7 +769,8 @@ acpi_ds_eval_region_operands (
736 */ 769 */
737 operand_desc = walk_state->operands[walk_state->num_operands - 2]; 770 operand_desc = walk_state->operands[walk_state->num_operands - 2];
738 771
739 obj_desc->region.address = (acpi_physical_address) operand_desc->integer.value; 772 obj_desc->region.address = (acpi_physical_address)
773 operand_desc->integer.value;
740 acpi_ut_remove_reference (operand_desc); 774 acpi_ut_remove_reference (operand_desc);
741 775
742 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", 776 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n",
@@ -752,7 +786,7 @@ acpi_ds_eval_region_operands (
752} 786}
753 787
754 788
755/***************************************************************************** 789/*******************************************************************************
756 * 790 *
757 * FUNCTION: acpi_ds_eval_data_object_operands 791 * FUNCTION: acpi_ds_eval_data_object_operands
758 * 792 *
@@ -765,7 +799,7 @@ acpi_ds_eval_region_operands (
765 * DESCRIPTION: Get the operands and complete the following data object types: 799 * DESCRIPTION: Get the operands and complete the following data object types:
766 * Buffer, Package. 800 * Buffer, Package.
767 * 801 *
768 ****************************************************************************/ 802 ******************************************************************************/
769 803
770acpi_status 804acpi_status
771acpi_ds_eval_data_object_operands ( 805acpi_ds_eval_data_object_operands (
@@ -830,7 +864,7 @@ acpi_ds_eval_data_object_operands (
830 864
831 if (ACPI_SUCCESS (status)) { 865 if (ACPI_SUCCESS (status)) {
832 /* 866 /*
833 * Return the object in the walk_state, unless the parent is a package -- 867 * Return the object in the walk_state, unless the parent is a package -
834 * in this case, the return object will be stored in the parse tree 868 * in this case, the return object will be stored in the parse tree
835 * for the package. 869 * for the package.
836 */ 870 */
@@ -988,7 +1022,8 @@ acpi_ds_exec_end_control_op (
988 status = AE_CTRL_PENDING; 1022 status = AE_CTRL_PENDING;
989 } 1023 }
990 1024
991 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] termination! Op=%p\n", op)); 1025 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
1026 "[WHILE_OP] termination! Op=%p\n",op));
992 1027
993 /* Pop this control state and free it */ 1028 /* Pop this control state and free it */
994 1029
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c
index 462c5d83e747..9613349ac31d 100644
--- a/drivers/acpi/dispatcher/dsutils.c
+++ b/drivers/acpi/dispatcher/dsutils.c
@@ -100,7 +100,6 @@ acpi_ds_clear_implicit_return (
100 100
101 101
102#ifndef ACPI_NO_METHOD_EXECUTION 102#ifndef ACPI_NO_METHOD_EXECUTION
103
104/******************************************************************************* 103/*******************************************************************************
105 * 104 *
106 * FUNCTION: acpi_ds_do_implicit_return 105 * FUNCTION: acpi_ds_do_implicit_return
@@ -205,7 +204,7 @@ acpi_ds_is_result_used (
205 * NOTE: this is optional because the ASL language does not actually 204 * NOTE: this is optional because the ASL language does not actually
206 * support this behavior. 205 * support this behavior.
207 */ 206 */
208 acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE); 207 (void) acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE);
209 208
210 /* 209 /*
211 * Now determine if the parent will use the result 210 * Now determine if the parent will use the result
@@ -219,8 +218,9 @@ acpi_ds_is_result_used (
219 (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { 218 (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
220 /* No parent, the return value cannot possibly be used */ 219 /* No parent, the return value cannot possibly be used */
221 220
222 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "At Method level, result of [%s] not used\n", 221 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
223 acpi_ps_get_opcode_name (op->common.aml_opcode))); 222 "At Method level, result of [%s] not used\n",
223 acpi_ps_get_opcode_name (op->common.aml_opcode)));
224 return_VALUE (FALSE); 224 return_VALUE (FALSE);
225 } 225 }
226 226
@@ -228,7 +228,8 @@ acpi_ds_is_result_used (
228 228
229 parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode); 229 parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode);
230 if (parent_info->class == AML_CLASS_UNKNOWN) { 230 if (parent_info->class == AML_CLASS_UNKNOWN) {
231 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op)); 231 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
232 "Unknown parent opcode. Op=%p\n", op));
232 return_VALUE (FALSE); 233 return_VALUE (FALSE);
233 } 234 }
234 235
@@ -309,17 +310,19 @@ acpi_ds_is_result_used (
309 310
310 311
311result_used: 312result_used:
312 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n", 313 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
313 acpi_ps_get_opcode_name (op->common.aml_opcode), 314 "Result of [%s] used by Parent [%s] Op=%p\n",
314 acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); 315 acpi_ps_get_opcode_name (op->common.aml_opcode),
316 acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
315 317
316 return_VALUE (TRUE); 318 return_VALUE (TRUE);
317 319
318 320
319result_not_used: 321result_not_used:
320 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n", 322 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
321 acpi_ps_get_opcode_name (op->common.aml_opcode), 323 "Result of [%s] not used by Parent [%s] Op=%p\n",
322 acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); 324 acpi_ps_get_opcode_name (op->common.aml_opcode),
325 acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
323 326
324 return_VALUE (FALSE); 327 return_VALUE (FALSE);
325} 328}
@@ -522,7 +525,8 @@ acpi_ds_create_operand (
522 if ((walk_state->deferred_node) && 525 if ((walk_state->deferred_node) &&
523 (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) && 526 (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) &&
524 (arg_index != 0)) { 527 (arg_index != 0)) {
525 obj_desc = ACPI_CAST_PTR (union acpi_operand_object, walk_state->deferred_node); 528 obj_desc = ACPI_CAST_PTR (
529 union acpi_operand_object, walk_state->deferred_node);
526 status = AE_OK; 530 status = AE_OK;
527 } 531 }
528 else /* All other opcodes */ { 532 else /* All other opcodes */ {
@@ -565,7 +569,8 @@ acpi_ds_create_operand (
565 * indicate this to the interpreter, set the 569 * indicate this to the interpreter, set the
566 * object to the root 570 * object to the root
567 */ 571 */
568 obj_desc = ACPI_CAST_PTR (union acpi_operand_object, acpi_gbl_root_node); 572 obj_desc = ACPI_CAST_PTR (
573 union acpi_operand_object, acpi_gbl_root_node);
569 status = AE_OK; 574 status = AE_OK;
570 } 575 }
571 else { 576 else {
@@ -612,7 +617,8 @@ acpi_ds_create_operand (
612 */ 617 */
613 opcode = AML_ZERO_OP; /* Has no arguments! */ 618 opcode = AML_ZERO_OP; /* Has no arguments! */
614 619
615 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", arg)); 620 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
621 "Null namepath: Arg=%p\n", arg));
616 } 622 }
617 else { 623 else {
618 opcode = arg->common.aml_opcode; 624 opcode = arg->common.aml_opcode;
@@ -642,7 +648,8 @@ acpi_ds_create_operand (
642 * Only error is underflow, and this indicates 648 * Only error is underflow, and this indicates
643 * a missing or null operand! 649 * a missing or null operand!
644 */ 650 */
645 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n", 651 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
652 "Missing or null operand, %s\n",
646 acpi_format_exception (status))); 653 acpi_format_exception (status)));
647 return_ACPI_STATUS (status); 654 return_ACPI_STATUS (status);
648 } 655 }
@@ -657,8 +664,8 @@ acpi_ds_create_operand (
657 664
658 /* Initialize the new object */ 665 /* Initialize the new object */
659 666
660 status = acpi_ds_init_object_from_op (walk_state, arg, 667 status = acpi_ds_init_object_from_op (
661 opcode, &obj_desc); 668 walk_state, arg, opcode, &obj_desc);
662 if (ACPI_FAILURE (status)) { 669 if (ACPI_FAILURE (status)) {
663 acpi_ut_delete_object_desc (obj_desc); 670 acpi_ut_delete_object_desc (obj_desc);
664 return_ACPI_STATUS (status); 671 return_ACPI_STATUS (status);
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c
index 2071a0d2bbbb..10f71318e23b 100644
--- a/drivers/acpi/dispatcher/dswexec.c
+++ b/drivers/acpi/dispatcher/dswexec.c
@@ -73,11 +73,13 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
73 acpi_ex_opcode_3A_1T_1R, 73 acpi_ex_opcode_3A_1T_1R,
74 acpi_ex_opcode_6A_0T_1R}; 74 acpi_ex_opcode_6A_0T_1R};
75 75
76
76/***************************************************************************** 77/*****************************************************************************
77 * 78 *
78 * FUNCTION: acpi_ds_get_predicate_value 79 * FUNCTION: acpi_ds_get_predicate_value
79 * 80 *
80 * PARAMETERS: walk_state - Current state of the parse tree walk 81 * PARAMETERS: walk_state - Current state of the parse tree walk
82 * result_obj - if non-zero, pop result from result stack
81 * 83 *
82 * RETURN: Status 84 * RETURN: Status
83 * 85 *
@@ -124,7 +126,8 @@ acpi_ds_get_predicate_value (
124 } 126 }
125 127
126 if (!obj_desc) { 128 if (!obj_desc) {
127 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No predicate obj_desc=%p State=%p\n", 129 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
130 "No predicate obj_desc=%p State=%p\n",
128 obj_desc, walk_state)); 131 obj_desc, walk_state));
129 132
130 return_ACPI_STATUS (AE_AML_NO_OPERAND); 133 return_ACPI_STATUS (AE_AML_NO_OPERAND);
@@ -197,7 +200,7 @@ cleanup:
197 * FUNCTION: acpi_ds_exec_begin_op 200 * FUNCTION: acpi_ds_exec_begin_op
198 * 201 *
199 * PARAMETERS: walk_state - Current state of the parse tree walk 202 * PARAMETERS: walk_state - Current state of the parse tree walk
200 * out_op - Return op if a new one is created 203 * out_op - Where to return op if a new one is created
201 * 204 *
202 * RETURN: Status 205 * RETURN: Status
203 * 206 *
@@ -233,7 +236,8 @@ acpi_ds_exec_begin_op (
233 walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); 236 walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
234 237
235 if (acpi_ns_opens_scope (walk_state->op_info->object_type)) { 238 if (acpi_ns_opens_scope (walk_state->op_info->object_type)) {
236 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", 239 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
240 "(%s) Popping scope for Op %p\n",
237 acpi_ut_get_type_name (walk_state->op_info->object_type), op)); 241 acpi_ut_get_type_name (walk_state->op_info->object_type), op));
238 242
239 status = acpi_ds_scope_stack_pop (walk_state); 243 status = acpi_ds_scope_stack_pop (walk_state);
@@ -297,11 +301,10 @@ acpi_ds_exec_begin_op (
297 301
298 if (walk_state->walk_type == ACPI_WALK_METHOD) { 302 if (walk_state->walk_type == ACPI_WALK_METHOD) {
299 /* 303 /*
300 * Found a named object declaration during method 304 * Found a named object declaration during method execution;
301 * execution; we must enter this object into the 305 * we must enter this object into the namespace. The created
302 * namespace. The created object is temporary and 306 * object is temporary and will be deleted upon completion of
303 * will be deleted upon completion of the execution 307 * the execution of this method.
304 * of this method.
305 */ 308 */
306 status = acpi_ds_load2_begin_op (walk_state, NULL); 309 status = acpi_ds_load2_begin_op (walk_state, NULL);
307 } 310 }
@@ -338,8 +341,6 @@ acpi_ds_exec_begin_op (
338 * FUNCTION: acpi_ds_exec_end_op 341 * FUNCTION: acpi_ds_exec_end_op
339 * 342 *
340 * PARAMETERS: walk_state - Current state of the parse tree walk 343 * PARAMETERS: walk_state - Current state of the parse tree walk
341 * Op - Op that has been just been completed in the
342 * walk; Arguments have now been evaluated.
343 * 344 *
344 * RETURN: Status 345 * RETURN: Status
345 * 346 *
@@ -389,7 +390,7 @@ acpi_ds_exec_end_op (
389 /* Decode the Opcode Class */ 390 /* Decode the Opcode Class */
390 391
391 switch (op_class) { 392 switch (op_class) {
392 case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */ 393 case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */
393 break; 394 break;
394 395
395 396
@@ -417,12 +418,12 @@ acpi_ds_exec_end_op (
417 /* Resolve all operands */ 418 /* Resolve all operands */
418 419
419 status = acpi_ex_resolve_operands (walk_state->opcode, 420 status = acpi_ex_resolve_operands (walk_state->opcode,
420 &(walk_state->operands [walk_state->num_operands -1]), 421 &(walk_state->operands [walk_state->num_operands -1]),
421 walk_state); 422 walk_state);
422 if (ACPI_SUCCESS (status)) { 423 if (ACPI_SUCCESS (status)) {
423 ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, 424 ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
424 acpi_ps_get_opcode_name (walk_state->opcode), 425 acpi_ps_get_opcode_name (walk_state->opcode),
425 walk_state->num_operands, "after ex_resolve_operands"); 426 walk_state->num_operands, "after ex_resolve_operands");
426 } 427 }
427 } 428 }
428 429
@@ -506,7 +507,8 @@ acpi_ds_exec_end_op (
506 if ((op->asl.parent) && 507 if ((op->asl.parent) &&
507 ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) || 508 ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) ||
508 (op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) { 509 (op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) {
509 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method Reference in a Package, Op=%p\n", op)); 510 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
511 "Method Reference in a Package, Op=%p\n", op));
510 op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object; 512 op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object;
511 acpi_ut_add_reference (op->asl.value.arg->asl.node->object); 513 acpi_ut_add_reference (op->asl.value.arg->asl.node->object);
512 return_ACPI_STATUS (AE_OK); 514 return_ACPI_STATUS (AE_OK);
@@ -583,13 +585,15 @@ acpi_ds_exec_end_op (
583 case AML_NAME_OP: 585 case AML_NAME_OP:
584 586
585 /* 587 /*
586 * Put the Node on the object stack (Contains the ACPI Name of 588 * Put the Node on the object stack (Contains the ACPI Name
587 * this object) 589 * of this object)
588 */ 590 */
589 walk_state->operands[0] = (void *) op->common.parent->common.node; 591 walk_state->operands[0] = (void *) op->common.parent->common.node;
590 walk_state->num_operands = 1; 592 walk_state->num_operands = 1;
591 593
592 status = acpi_ds_create_node (walk_state, op->common.parent->common.node, op->common.parent); 594 status = acpi_ds_create_node (walk_state,
595 op->common.parent->common.node,
596 op->common.parent);
593 if (ACPI_FAILURE (status)) { 597 if (ACPI_FAILURE (status)) {
594 break; 598 break;
595 } 599 }
@@ -600,7 +604,7 @@ acpi_ds_exec_end_op (
600 case AML_INT_EVAL_SUBTREE_OP: 604 case AML_INT_EVAL_SUBTREE_OP:
601 605
602 status = acpi_ds_eval_data_object_operands (walk_state, op, 606 status = acpi_ds_eval_data_object_operands (walk_state, op,
603 acpi_ns_get_attached_object (op->common.parent->common.node)); 607 acpi_ns_get_attached_object (op->common.parent->common.node));
604 break; 608 break;
605 609
606 default: 610 default:
@@ -609,7 +613,7 @@ acpi_ds_exec_end_op (
609 break; 613 break;
610 } 614 }
611 615
612 /* Done with this result state (Now that operand stack is built) */ 616 /* Done with result state (Now that operand stack is built) */
613 617
614 status = acpi_ds_result_stack_pop (walk_state); 618 status = acpi_ds_result_stack_pop (walk_state);
615 if (ACPI_FAILURE (status)) { 619 if (ACPI_FAILURE (status)) {
@@ -620,8 +624,7 @@ acpi_ds_exec_end_op (
620 * If a result object was returned from above, push it on the 624 * If a result object was returned from above, push it on the
621 * current result stack 625 * current result stack
622 */ 626 */
623 if (ACPI_SUCCESS (status) && 627 if (walk_state->result_obj) {
624 walk_state->result_obj) {
625 status = acpi_ds_result_push (walk_state->result_obj, walk_state); 628 status = acpi_ds_result_push (walk_state->result_obj, walk_state);
626 } 629 }
627 break; 630 break;
@@ -654,7 +657,8 @@ acpi_ds_exec_end_op (
654 657
655 case AML_TYPE_UNDEFINED: 658 case AML_TYPE_UNDEFINED:
656 659
657 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", op)); 660 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
661 "Undefined opcode type Op=%p\n", op));
658 return_ACPI_STATUS (AE_NOT_IMPLEMENTED); 662 return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
659 663
660 664
@@ -709,13 +713,14 @@ cleanup:
709 status = acpi_gbl_exception_handler (status, 713 status = acpi_gbl_exception_handler (status,
710 walk_state->method_node->name.integer, walk_state->opcode, 714 walk_state->method_node->name.integer, walk_state->opcode,
711 walk_state->aml_offset, NULL); 715 walk_state->aml_offset, NULL);
712 acpi_ex_enter_interpreter (); 716 (void) acpi_ex_enter_interpreter ();
713 } 717 }
714 718
715 if (walk_state->result_obj) { 719 if (walk_state->result_obj) {
716 /* Break to debugger to display result */ 720 /* Break to debugger to display result */
717 721
718 ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, walk_state)); 722 ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj,
723 walk_state));
719 724
720 /* 725 /*
721 * Delete the result op if and only if: 726 * Delete the result op if and only if:
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c
index 06d758679588..1ac197ccfc80 100644
--- a/drivers/acpi/dispatcher/dswload.c
+++ b/drivers/acpi/dispatcher/dswload.c
@@ -79,20 +79,23 @@ acpi_ds_init_callbacks (
79 79
80 switch (pass_number) { 80 switch (pass_number) {
81 case 1: 81 case 1:
82 walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; 82 walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
83 ACPI_PARSE_DELETE_TREE;
83 walk_state->descending_callback = acpi_ds_load1_begin_op; 84 walk_state->descending_callback = acpi_ds_load1_begin_op;
84 walk_state->ascending_callback = acpi_ds_load1_end_op; 85 walk_state->ascending_callback = acpi_ds_load1_end_op;
85 break; 86 break;
86 87
87 case 2: 88 case 2:
88 walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; 89 walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
90 ACPI_PARSE_DELETE_TREE;
89 walk_state->descending_callback = acpi_ds_load2_begin_op; 91 walk_state->descending_callback = acpi_ds_load2_begin_op;
90 walk_state->ascending_callback = acpi_ds_load2_end_op; 92 walk_state->ascending_callback = acpi_ds_load2_end_op;
91 break; 93 break;
92 94
93 case 3: 95 case 3:
94#ifndef ACPI_NO_METHOD_EXECUTION 96#ifndef ACPI_NO_METHOD_EXECUTION
95 walk_state->parse_flags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE; 97 walk_state->parse_flags |= ACPI_PARSE_EXECUTE |
98 ACPI_PARSE_DELETE_TREE;
96 walk_state->descending_callback = acpi_ds_exec_begin_op; 99 walk_state->descending_callback = acpi_ds_exec_begin_op;
97 walk_state->ascending_callback = acpi_ds_exec_end_op; 100 walk_state->ascending_callback = acpi_ds_exec_end_op;
98#endif 101#endif
@@ -111,8 +114,7 @@ acpi_ds_init_callbacks (
111 * FUNCTION: acpi_ds_load1_begin_op 114 * FUNCTION: acpi_ds_load1_begin_op
112 * 115 *
113 * PARAMETERS: walk_state - Current state of the parse tree walk 116 * PARAMETERS: walk_state - Current state of the parse tree walk
114 * Op - Op that has been just been reached in the 117 * out_op - Where to return op if a new one is created
115 * walk; Arguments have not been evaluated yet.
116 * 118 *
117 * RETURN: Status 119 * RETURN: Status
118 * 120 *
@@ -146,7 +148,8 @@ acpi_ds_load1_begin_op (
146#if 0 148#if 0
147 if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || 149 if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
148 (walk_state->op_info->class == AML_CLASS_CONTROL)) { 150 (walk_state->op_info->class == AML_CLASS_CONTROL)) {
149 acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n", walk_state->op_info->name); 151 acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n",
152 walk_state->op_info->name);
150 *out_op = op; 153 *out_op = op;
151 return (AE_CTRL_SKIP); 154 return (AE_CTRL_SKIP);
152 } 155 }
@@ -191,7 +194,8 @@ acpi_ds_load1_begin_op (
191 */ 194 */
192 acpi_dm_add_to_external_list (path); 195 acpi_dm_add_to_external_list (path);
193 status = acpi_ns_lookup (walk_state->scope_info, path, object_type, 196 status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
194 ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); 197 ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
198 walk_state, &(node));
195 } 199 }
196#endif 200#endif
197 if (ACPI_FAILURE (status)) { 201 if (ACPI_FAILURE (status)) {
@@ -224,10 +228,12 @@ acpi_ds_load1_begin_op (
224 * Name (DEB, 0) 228 * Name (DEB, 0)
225 * Scope (DEB) { ... } 229 * Scope (DEB) { ... }
226 * 230 *
227 * Note: silently change the type here. On the second pass, we will report a warning 231 * Note: silently change the type here. On the second pass, we will report
232 * a warning
228 */ 233 */
229 234
230 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", 235 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
236 "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
231 path, acpi_ut_get_type_name (node->type))); 237 path, acpi_ut_get_type_name (node->type)));
232 238
233 node->type = ACPI_TYPE_ANY; 239 node->type = ACPI_TYPE_ANY;
@@ -238,7 +244,8 @@ acpi_ds_load1_begin_op (
238 244
239 /* All other types are an error */ 245 /* All other types are an error */
240 246
241 ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", 247 ACPI_REPORT_ERROR ((
248 "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n",
242 acpi_ut_get_type_name (node->type), path)); 249 acpi_ut_get_type_name (node->type), path));
243 250
244 return (AE_AML_OPERAND_TYPE); 251 return (AE_AML_OPERAND_TYPE);
@@ -249,7 +256,8 @@ acpi_ds_load1_begin_op (
249 default: 256 default:
250 257
251 /* 258 /*
252 * For all other named opcodes, we will enter the name into the namespace. 259 * For all other named opcodes, we will enter the name into
260 * the namespace.
253 * 261 *
254 * Setup the search flags. 262 * Setup the search flags.
255 * Since we are entering a name into the namespace, we do not want to 263 * Since we are entering a name into the namespace, we do not want to
@@ -279,14 +287,16 @@ acpi_ds_load1_begin_op (
279 acpi_ut_get_type_name (object_type))); 287 acpi_ut_get_type_name (object_type)));
280 } 288 }
281 else { 289 else {
282 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Both Find or Create allowed\n", 290 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
291 "[%s] Both Find or Create allowed\n",
283 acpi_ut_get_type_name (object_type))); 292 acpi_ut_get_type_name (object_type)));
284 } 293 }
285 294
286 /* 295 /*
287 * Enter the named type into the internal namespace. We enter the name 296 * Enter the named type into the internal namespace. We enter the name
288 * as we go downward in the parse tree. Any necessary subobjects that involve 297 * as we go downward in the parse tree. Any necessary subobjects that
289 * arguments to the opcode must be created as we go back up the parse tree later. 298 * involve arguments to the opcode must be created as we go back up the
299 * parse tree later.
290 */ 300 */
291 status = acpi_ns_lookup (walk_state->scope_info, path, object_type, 301 status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
292 ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); 302 ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node));
@@ -335,8 +345,6 @@ acpi_ds_load1_begin_op (
335 * FUNCTION: acpi_ds_load1_end_op 345 * FUNCTION: acpi_ds_load1_end_op
336 * 346 *
337 * PARAMETERS: walk_state - Current state of the parse tree walk 347 * PARAMETERS: walk_state - Current state of the parse tree walk
338 * Op - Op that has been just been completed in the
339 * walk; Arguments have now been evaluated.
340 * 348 *
341 * RETURN: Status 349 * RETURN: Status
342 * 350 *
@@ -383,7 +391,9 @@ acpi_ds_load1_end_op (
383 391
384 if (op->common.aml_opcode == AML_REGION_OP) { 392 if (op->common.aml_opcode == AML_REGION_OP) {
385 status = acpi_ex_create_region (op->named.data, op->named.length, 393 status = acpi_ex_create_region (op->named.data, op->named.length,
386 (acpi_adr_space_type) ((op->common.value.arg)->common.value.integer), walk_state); 394 (acpi_adr_space_type)
395 ((op->common.value.arg)->common.value.integer),
396 walk_state);
387 if (ACPI_FAILURE (status)) { 397 if (ACPI_FAILURE (status)) {
388 return (status); 398 return (status);
389 } 399 }
@@ -394,7 +404,8 @@ acpi_ds_load1_end_op (
394 /* For Name opcode, get the object type from the argument */ 404 /* For Name opcode, get the object type from the argument */
395 405
396 if (op->common.value.arg) { 406 if (op->common.value.arg) {
397 object_type = (acpi_ps_get_opcode_info ((op->common.value.arg)->common.aml_opcode))->object_type; 407 object_type = (acpi_ps_get_opcode_info (
408 (op->common.value.arg)->common.aml_opcode))->object_type;
398 op->common.node->type = (u8) object_type; 409 op->common.node->type = (u8) object_type;
399 } 410 }
400 } 411 }
@@ -448,8 +459,7 @@ acpi_ds_load1_end_op (
448 * FUNCTION: acpi_ds_load2_begin_op 459 * FUNCTION: acpi_ds_load2_begin_op
449 * 460 *
450 * PARAMETERS: walk_state - Current state of the parse tree walk 461 * PARAMETERS: walk_state - Current state of the parse tree walk
451 * Op - Op that has been just been reached in the 462 * out_op - Wher to return op if a new one is created
452 * walk; Arguments have not been evaluated yet.
453 * 463 *
454 * RETURN: Status 464 * RETURN: Status
455 * 465 *
@@ -478,14 +488,20 @@ acpi_ds_load2_begin_op (
478 if (op) { 488 if (op) {
479 /* We only care about Namespace opcodes here */ 489 /* We only care about Namespace opcodes here */
480 490
481 if ((!(walk_state->op_info->flags & AML_NSOPCODE) && (walk_state->opcode != AML_INT_NAMEPATH_OP)) || 491 if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
492 (walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
482 (!(walk_state->op_info->flags & AML_NAMED))) { 493 (!(walk_state->op_info->flags & AML_NAMED))) {
494 if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
495 (walk_state->op_info->class == AML_CLASS_CONTROL)) {
496 ACPI_REPORT_WARNING ((
497 "Encountered executable code at module level, [%s]\n",
498 acpi_ps_get_opcode_name (walk_state->opcode)));
499 }
483 return_ACPI_STATUS (AE_OK); 500 return_ACPI_STATUS (AE_OK);
484 } 501 }
485 502
486 /* 503 /* Get the name we are going to enter or lookup in the namespace */
487 * Get the name we are going to enter or lookup in the namespace 504
488 */
489 if (walk_state->opcode == AML_INT_NAMEPATH_OP) { 505 if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
490 /* For Namepath op, get the path string */ 506 /* For Namepath op, get the path string */
491 507
@@ -528,21 +544,25 @@ acpi_ds_load2_begin_op (
528 case AML_INT_NAMEPATH_OP: 544 case AML_INT_NAMEPATH_OP:
529 545
530 /* 546 /*
531 * The name_path is an object reference to an existing object. Don't enter the 547 * The name_path is an object reference to an existing object.
532 * name into the namespace, but look it up for use later 548 * Don't enter the name into the namespace, but look it up
549 * for use later.
533 */ 550 */
534 status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, 551 status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
535 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); 552 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
553 walk_state, &(node));
536 break; 554 break;
537 555
538 case AML_SCOPE_OP: 556 case AML_SCOPE_OP:
539 557
540 /* 558 /*
541 * The Path is an object reference to an existing object. Don't enter the 559 * The Path is an object reference to an existing object.
542 * name into the namespace, but look it up for use later 560 * Don't enter the name into the namespace, but look it up
561 * for use later.
543 */ 562 */
544 status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, 563 status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
545 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); 564 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
565 walk_state, &(node));
546 if (ACPI_FAILURE (status)) { 566 if (ACPI_FAILURE (status)) {
547#ifdef _ACPI_ASL_COMPILER 567#ifdef _ACPI_ASL_COMPILER
548 if (status == AE_NOT_FOUND) { 568 if (status == AE_NOT_FOUND) {
@@ -582,7 +602,8 @@ acpi_ds_load2_begin_op (
582 * Scope (DEB) { ... } 602 * Scope (DEB) { ... }
583 */ 603 */
584 604
585 ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", 605 ACPI_REPORT_WARNING ((
606 "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
586 buffer_ptr, acpi_ut_get_type_name (node->type))); 607 buffer_ptr, acpi_ut_get_type_name (node->type)));
587 608
588 node->type = ACPI_TYPE_ANY; 609 node->type = ACPI_TYPE_ANY;
@@ -593,7 +614,8 @@ acpi_ds_load2_begin_op (
593 614
594 /* All other types are an error */ 615 /* All other types are an error */
595 616
596 ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n", 617 ACPI_REPORT_ERROR ((
618 "Invalid type (%s) for target of Scope operator [%4.4s]\n",
597 acpi_ut_get_type_name (node->type), buffer_ptr)); 619 acpi_ut_get_type_name (node->type), buffer_ptr));
598 620
599 return (AE_AML_OPERAND_TYPE); 621 return (AE_AML_OPERAND_TYPE);
@@ -621,8 +643,9 @@ acpi_ds_load2_begin_op (
621 643
622 /* 644 /*
623 * Enter the named type into the internal namespace. We enter the name 645 * Enter the named type into the internal namespace. We enter the name
624 * as we go downward in the parse tree. Any necessary subobjects that involve 646 * as we go downward in the parse tree. Any necessary subobjects that
625 * arguments to the opcode must be created as we go back up the parse tree later. 647 * involve arguments to the opcode must be created as we go back up the
648 * parse tree later.
626 * 649 *
627 * Note: Name may already exist if we are executing a deferred opcode. 650 * Note: Name may already exist if we are executing a deferred opcode.
628 */ 651 */
@@ -635,7 +658,8 @@ acpi_ds_load2_begin_op (
635 } 658 }
636 659
637 status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, 660 status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
638 ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, walk_state, &(node)); 661 ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH,
662 walk_state, &(node));
639 break; 663 break;
640 } 664 }
641 665
@@ -678,8 +702,6 @@ acpi_ds_load2_begin_op (
678 * FUNCTION: acpi_ds_load2_end_op 702 * FUNCTION: acpi_ds_load2_end_op
679 * 703 *
680 * PARAMETERS: walk_state - Current state of the parse tree walk 704 * PARAMETERS: walk_state - Current state of the parse tree walk
681 * Op - Op that has been just been completed in the
682 * walk; Arguments have now been evaluated.
683 * 705 *
684 * RETURN: Status 706 * RETURN: Status
685 * 707 *
@@ -738,7 +760,8 @@ acpi_ds_load2_end_op (
738 760
739 /* Pop the scope stack */ 761 /* Pop the scope stack */
740 762
741 if (acpi_ns_opens_scope (object_type) && (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { 763 if (acpi_ns_opens_scope (object_type) &&
764 (op->common.aml_opcode != AML_INT_METHODCALL_OP)) {
742 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", 765 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
743 acpi_ut_get_type_name (object_type), op)); 766 acpi_ut_get_type_name (object_type), op));
744 767
@@ -803,7 +826,7 @@ acpi_ds_load2_end_op (
803 case AML_INDEX_FIELD_OP: 826 case AML_INDEX_FIELD_OP:
804 827
805 status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node, 828 status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node,
806 walk_state); 829 walk_state);
807 break; 830 break;
808 831
809 case AML_BANK_FIELD_OP: 832 case AML_BANK_FIELD_OP:
@@ -884,14 +907,16 @@ acpi_ds_load2_end_op (
884#ifndef ACPI_NO_METHOD_EXECUTION 907#ifndef ACPI_NO_METHOD_EXECUTION
885 case AML_REGION_OP: 908 case AML_REGION_OP:
886 /* 909 /*
887 * The op_region is not fully parsed at this time. Only valid argument is the space_id. 910 * The op_region is not fully parsed at this time. Only valid
888 * (We must save the address of the AML of the address and length operands) 911 * argument is the space_id. (We must save the address of the
912 * AML of the address and length operands)
889 */ 913 */
890 /* 914 /*
891 * If we have a valid region, initialize it 915 * If we have a valid region, initialize it
892 * Namespace is NOT locked at this point. 916 * Namespace is NOT locked at this point.
893 */ 917 */
894 status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node), FALSE); 918 status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node),
919 FALSE);
895 if (ACPI_FAILURE (status)) { 920 if (ACPI_FAILURE (status)) {
896 /* 921 /*
897 * If AE_NOT_EXIST is returned, it is not fatal 922 * If AE_NOT_EXIST is returned, it is not fatal
@@ -942,15 +967,16 @@ acpi_ds_load2_end_op (
942 if (ACPI_SUCCESS (status)) { 967 if (ACPI_SUCCESS (status)) {
943 /* 968 /*
944 * Make sure that what we found is indeed a method 969 * Make sure that what we found is indeed a method
945 * We didn't search for a method on purpose, to see if the name would resolve 970 * We didn't search for a method on purpose, to see if the name
971 * would resolve
946 */ 972 */
947 if (new_node->type != ACPI_TYPE_METHOD) { 973 if (new_node->type != ACPI_TYPE_METHOD) {
948 status = AE_AML_OPERAND_TYPE; 974 status = AE_AML_OPERAND_TYPE;
949 } 975 }
950 976
951 /* We could put the returned object (Node) on the object stack for later, but 977 /* We could put the returned object (Node) on the object stack for
952 * for now, we will put it in the "op" object that the parser uses, so we 978 * later, but for now, we will put it in the "op" object that the
953 * can get it again at the end of this scope 979 * parser uses, so we can get it again at the end of this scope
954 */ 980 */
955 op->common.node = new_node; 981 op->common.node = new_node;
956 } 982 }
diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c
index 65f456151e25..21f4548ff323 100644
--- a/drivers/acpi/dispatcher/dswscope.c
+++ b/drivers/acpi/dispatcher/dswscope.c
@@ -50,14 +50,13 @@
50 ACPI_MODULE_NAME ("dswscope") 50 ACPI_MODULE_NAME ("dswscope")
51 51
52 52
53#define STACK_POP(head) head
54
55
56/**************************************************************************** 53/****************************************************************************
57 * 54 *
58 * FUNCTION: acpi_ds_scope_stack_clear 55 * FUNCTION: acpi_ds_scope_stack_clear
59 * 56 *
60 * PARAMETERS: None 57 * PARAMETERS: walk_state - Current state
58 *
59 * RETURN: None
61 * 60 *
62 * DESCRIPTION: Pop (and free) everything on the scope stack except the 61 * DESCRIPTION: Pop (and free) everything on the scope stack except the
63 * root scope object (which remains at the stack top.) 62 * root scope object (which remains at the stack top.)
@@ -80,7 +79,8 @@ acpi_ds_scope_stack_clear (
80 walk_state->scope_info = scope_info->scope.next; 79 walk_state->scope_info = scope_info->scope.next;
81 80
82 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 81 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
83 "Popped object type (%s)\n", acpi_ut_get_type_name (scope_info->common.value))); 82 "Popped object type (%s)\n",
83 acpi_ut_get_type_name (scope_info->common.value)));
84 acpi_ut_delete_generic_state (scope_info); 84 acpi_ut_delete_generic_state (scope_info);
85 } 85 }
86} 86}
@@ -90,8 +90,11 @@ acpi_ds_scope_stack_clear (
90 * 90 *
91 * FUNCTION: acpi_ds_scope_stack_push 91 * FUNCTION: acpi_ds_scope_stack_push
92 * 92 *
93 * PARAMETERS: *Node, - Name to be made current 93 * PARAMETERS: Node - Name to be made current
94 * Type, - Type of frame being pushed 94 * Type - Type of frame being pushed
95 * walk_state - Current state
96 *
97 * RETURN: Status
95 * 98 *
96 * DESCRIPTION: Push the current scope on the scope stack, and make the 99 * DESCRIPTION: Push the current scope on the scope stack, and make the
97 * passed Node current. 100 * passed Node current.
@@ -121,7 +124,8 @@ acpi_ds_scope_stack_push (
121 /* Make sure object type is valid */ 124 /* Make sure object type is valid */
122 125
123 if (!acpi_ut_valid_object_type (type)) { 126 if (!acpi_ut_valid_object_type (type)) {
124 ACPI_REPORT_WARNING (("ds_scope_stack_push: Invalid object type: 0x%X\n", type)); 127 ACPI_REPORT_WARNING ((
128 "ds_scope_stack_push: Invalid object type: 0x%X\n", type));
125 } 129 }
126 130
127 /* Allocate a new scope object */ 131 /* Allocate a new scope object */
@@ -170,16 +174,11 @@ acpi_ds_scope_stack_push (
170 * 174 *
171 * FUNCTION: acpi_ds_scope_stack_pop 175 * FUNCTION: acpi_ds_scope_stack_pop
172 * 176 *
173 * PARAMETERS: Type - The type of frame to be found 177 * PARAMETERS: walk_state - Current state
174 * 178 *
175 * DESCRIPTION: Pop the scope stack until a frame of the requested type 179 * RETURN: Status
176 * is found.
177 * 180 *
178 * RETURN: Count of frames popped. If no frame of the requested type 181 * DESCRIPTION: Pop the scope stack once.
179 * was found, the count is returned as a negative number and
180 * the scope stack is emptied (which sets the current scope
181 * to the root). If the scope stack was empty at entry, the
182 * function is a no-op and returns 0.
183 * 182 *
184 ***************************************************************************/ 183 ***************************************************************************/
185 184
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c
index e555b3fbd5e5..9cd3db652b31 100644
--- a/drivers/acpi/dispatcher/dswstate.c
+++ b/drivers/acpi/dispatcher/dswstate.c
@@ -50,67 +50,31 @@
50#define _COMPONENT ACPI_DISPATCHER 50#define _COMPONENT ACPI_DISPATCHER
51 ACPI_MODULE_NAME ("dswstate") 51 ACPI_MODULE_NAME ("dswstate")
52 52
53/* Local prototypes */
53 54
54#ifdef ACPI_FUTURE_USAGE 55#ifdef ACPI_OBSOLETE_FUNCTIONS
55
56/*******************************************************************************
57 *
58 * FUNCTION: acpi_ds_result_insert
59 *
60 * PARAMETERS: Object - Object to push
61 * Index - Where to insert the object
62 * walk_state - Current Walk state
63 *
64 * RETURN: Status
65 *
66 * DESCRIPTION: Insert an object onto this walk's result stack
67 *
68 ******************************************************************************/
69
70acpi_status 56acpi_status
71acpi_ds_result_insert ( 57acpi_ds_result_insert (
72 void *object, 58 void *object,
73 u32 index, 59 u32 index,
74 struct acpi_walk_state *walk_state) 60 struct acpi_walk_state *walk_state);
75{
76 union acpi_generic_state *state;
77
78 61
79 ACPI_FUNCTION_NAME ("ds_result_insert"); 62acpi_status
80 63acpi_ds_obj_stack_delete_all (
81 64 struct acpi_walk_state *walk_state);
82 state = walk_state->results;
83 if (!state) {
84 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
85 walk_state));
86 return (AE_NOT_EXIST);
87 }
88
89 if (index >= ACPI_OBJ_NUM_OPERANDS) {
90 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
91 "Index out of range: %X Obj=%p State=%p Num=%X\n",
92 index, object, walk_state, state->results.num_results));
93 return (AE_BAD_PARAMETER);
94 }
95
96 if (!object) {
97 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
98 "Null Object! Index=%X Obj=%p State=%p Num=%X\n",
99 index, object, walk_state, state->results.num_results));
100 return (AE_BAD_PARAMETER);
101 }
102
103 state->results.obj_desc [index] = object;
104 state->results.num_results++;
105 65
106 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 66acpi_status
107 "Obj=%p [%s] State=%p Num=%X Cur=%X\n", 67acpi_ds_obj_stack_pop_object (
108 object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL", 68 union acpi_operand_object **object,
109 walk_state, state->results.num_results, walk_state->current_result)); 69 struct acpi_walk_state *walk_state);
110 70
111 return (AE_OK); 71void *
112} 72acpi_ds_obj_stack_get_value (
73 u32 index,
74 struct acpi_walk_state *walk_state);
75#endif
113 76
77#ifdef ACPI_FUTURE_USAGE
114 78
115/******************************************************************************* 79/*******************************************************************************
116 * 80 *
@@ -178,7 +142,6 @@ acpi_ds_result_remove (
178 142
179#endif /* ACPI_FUTURE_USAGE */ 143#endif /* ACPI_FUTURE_USAGE */
180 144
181
182/******************************************************************************* 145/*******************************************************************************
183 * 146 *
184 * FUNCTION: acpi_ds_result_pop 147 * FUNCTION: acpi_ds_result_pop
@@ -227,15 +190,18 @@ acpi_ds_result_pop (
227 *object = state->results.obj_desc [index -1]; 190 *object = state->results.obj_desc [index -1];
228 state->results.obj_desc [index -1] = NULL; 191 state->results.obj_desc [index -1] = NULL;
229 192
230 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n", 193 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
231 *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", 194 "Obj=%p [%s] Index=%X State=%p Num=%X\n",
195 *object,
196 (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
232 (u32) index -1, walk_state, state->results.num_results)); 197 (u32) index -1, walk_state, state->results.num_results));
233 198
234 return (AE_OK); 199 return (AE_OK);
235 } 200 }
236 } 201 }
237 202
238 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); 203 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
204 "No result objects! State=%p\n", walk_state));
239 return (AE_AML_NO_RETURN_VALUE); 205 return (AE_AML_NO_RETURN_VALUE);
240} 206}
241 207
@@ -274,7 +240,8 @@ acpi_ds_result_pop_from_bottom (
274 } 240 }
275 241
276 if (!state->results.num_results) { 242 if (!state->results.num_results) {
277 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); 243 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n",
244 walk_state));
278 return (AE_AML_NO_RETURN_VALUE); 245 return (AE_AML_NO_RETURN_VALUE);
279 } 246 }
280 247
@@ -293,7 +260,8 @@ acpi_ds_result_pop_from_bottom (
293 /* Check for a valid result object */ 260 /* Check for a valid result object */
294 261
295 if (!*object) { 262 if (!*object) {
296 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n", 263 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
264 "Null operand! State=%p #Ops=%X, Index=%X\n",
297 walk_state, state->results.num_results, (u32) index)); 265 walk_state, state->results.num_results, (u32) index));
298 return (AE_AML_NO_RETURN_VALUE); 266 return (AE_AML_NO_RETURN_VALUE);
299 } 267 }
@@ -344,7 +312,8 @@ acpi_ds_result_push (
344 } 312 }
345 313
346 if (!object) { 314 if (!object) {
347 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Object! Obj=%p State=%p Num=%X\n", 315 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
316 "Null Object! Obj=%p State=%p Num=%X\n",
348 object, walk_state, state->results.num_results)); 317 object, walk_state, state->results.num_results));
349 return (AE_BAD_PARAMETER); 318 return (AE_BAD_PARAMETER);
350 } 319 }
@@ -439,43 +408,6 @@ acpi_ds_result_stack_pop (
439 408
440/******************************************************************************* 409/*******************************************************************************
441 * 410 *
442 * FUNCTION: acpi_ds_obj_stack_delete_all
443 *
444 * PARAMETERS: walk_state - Current Walk state
445 *
446 * RETURN: Status
447 *
448 * DESCRIPTION: Clear the object stack by deleting all objects that are on it.
449 * Should be used with great care, if at all!
450 *
451 ******************************************************************************/
452#ifdef ACPI_FUTURE_USAGE
453acpi_status
454acpi_ds_obj_stack_delete_all (
455 struct acpi_walk_state *walk_state)
456{
457 u32 i;
458
459
460 ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state);
461
462
463 /* The stack size is configurable, but fixed */
464
465 for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) {
466 if (walk_state->operands[i]) {
467 acpi_ut_remove_reference (walk_state->operands[i]);
468 walk_state->operands[i] = NULL;
469 }
470 }
471
472 return_ACPI_STATUS (AE_OK);
473}
474#endif /* ACPI_FUTURE_USAGE */
475
476
477/*******************************************************************************
478 *
479 * FUNCTION: acpi_ds_obj_stack_push 411 * FUNCTION: acpi_ds_obj_stack_push
480 * 412 *
481 * PARAMETERS: Object - Object to push 413 * PARAMETERS: Object - Object to push
@@ -517,67 +449,6 @@ acpi_ds_obj_stack_push (
517} 449}
518 450
519 451
520#if 0
521/*******************************************************************************
522 *
523 * FUNCTION: acpi_ds_obj_stack_pop_object
524 *
525 * PARAMETERS: pop_count - Number of objects/entries to pop
526 * walk_state - Current Walk state
527 *
528 * RETURN: Status
529 *
530 * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
531 * deleted by this routine.
532 *
533 ******************************************************************************/
534
535acpi_status
536acpi_ds_obj_stack_pop_object (
537 union acpi_operand_object **object,
538 struct acpi_walk_state *walk_state)
539{
540 ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object");
541
542
543 /* Check for stack underflow */
544
545 if (walk_state->num_operands == 0) {
546 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
547 "Missing operand/stack empty! State=%p #Ops=%X\n",
548 walk_state, walk_state->num_operands));
549 *object = NULL;
550 return (AE_AML_NO_OPERAND);
551 }
552
553 /* Pop the stack */
554
555 walk_state->num_operands--;
556
557 /* Check for a valid operand */
558
559 if (!walk_state->operands [walk_state->num_operands]) {
560 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
561 "Null operand! State=%p #Ops=%X\n",
562 walk_state, walk_state->num_operands));
563 *object = NULL;
564 return (AE_AML_NO_OPERAND);
565 }
566
567 /* Get operand and set stack entry to null */
568
569 *object = walk_state->operands [walk_state->num_operands];
570 walk_state->operands [walk_state->num_operands] = NULL;
571
572 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
573 *object, acpi_ut_get_object_type_name (*object),
574 walk_state, walk_state->num_operands));
575
576 return (AE_OK);
577}
578#endif
579
580
581/******************************************************************************* 452/*******************************************************************************
582 * 453 *
583 * FUNCTION: acpi_ds_obj_stack_pop 454 * FUNCTION: acpi_ds_obj_stack_pop
@@ -680,48 +551,6 @@ acpi_ds_obj_stack_pop_and_delete (
680 551
681/******************************************************************************* 552/*******************************************************************************
682 * 553 *
683 * FUNCTION: acpi_ds_obj_stack_get_value
684 *
685 * PARAMETERS: Index - Stack index whose value is desired. Based
686 * on the top of the stack (index=0 == top)
687 * walk_state - Current Walk state
688 *
689 * RETURN: Status
690 *
691 * DESCRIPTION: Retrieve an object from this walk's object stack. Index must
692 * be within the range of the current stack pointer.
693 *
694 ******************************************************************************/
695#ifdef ACPI_FUTURE_USAGE
696void *
697acpi_ds_obj_stack_get_value (
698 u32 index,
699 struct acpi_walk_state *walk_state)
700{
701
702 ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state);
703
704
705 /* Can't do it if the stack is empty */
706
707 if (walk_state->num_operands == 0) {
708 return_PTR (NULL);
709 }
710
711 /* or if the index is past the top of the stack */
712
713 if (index > (walk_state->num_operands - (u32) 1)) {
714 return_PTR (NULL);
715 }
716
717 return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) -
718 index]);
719}
720#endif /* ACPI_FUTURE_USAGE */
721
722
723/*******************************************************************************
724 *
725 * FUNCTION: acpi_ds_get_current_walk_state 554 * FUNCTION: acpi_ds_get_current_walk_state
726 * 555 *
727 * PARAMETERS: Thread - Get current active state for this Thread 556 * PARAMETERS: Thread - Get current active state for this Thread
@@ -757,11 +586,11 @@ acpi_ds_get_current_walk_state (
757 * FUNCTION: acpi_ds_push_walk_state 586 * FUNCTION: acpi_ds_push_walk_state
758 * 587 *
759 * PARAMETERS: walk_state - State to push 588 * PARAMETERS: walk_state - State to push
760 * walk_list - The list that owns the walk stack 589 * Thread - Thread state object
761 * 590 *
762 * RETURN: None 591 * RETURN: None
763 * 592 *
764 * DESCRIPTION: Place the walk_state at the head of the state list. 593 * DESCRIPTION: Place the Thread state at the head of the state list.
765 * 594 *
766 ******************************************************************************/ 595 ******************************************************************************/
767 596
@@ -784,9 +613,9 @@ acpi_ds_push_walk_state (
784 * 613 *
785 * FUNCTION: acpi_ds_pop_walk_state 614 * FUNCTION: acpi_ds_pop_walk_state
786 * 615 *
787 * PARAMETERS: walk_list - The list that owns the walk stack 616 * PARAMETERS: Thread - Current thread state
788 * 617 *
789 * RETURN: A walk_state object popped from the stack 618 * RETURN: A walk_state object popped from the thread's stack
790 * 619 *
791 * DESCRIPTION: Remove and return the walkstate object that is at the head of 620 * DESCRIPTION: Remove and return the walkstate object that is at the head of
792 * the walk stack for the given walk list. NULL indicates that 621 * the walk stack for the given walk list. NULL indicates that
@@ -814,7 +643,7 @@ acpi_ds_pop_walk_state (
814 /* 643 /*
815 * Don't clear the NEXT field, this serves as an indicator 644 * Don't clear the NEXT field, this serves as an indicator
816 * that there is a parent WALK STATE 645 * that there is a parent WALK STATE
817 * NO: walk_state->Next = NULL; 646 * Do Not: walk_state->Next = NULL;
818 */ 647 */
819 } 648 }
820 649
@@ -826,7 +655,9 @@ acpi_ds_pop_walk_state (
826 * 655 *
827 * FUNCTION: acpi_ds_create_walk_state 656 * FUNCTION: acpi_ds_create_walk_state
828 * 657 *
829 * PARAMETERS: Origin - Starting point for this walk 658 * PARAMETERS: owner_id - ID for object creation
659 * Origin - Starting point for this walk
660 * mth_desc - Method object
830 * Thread - Current thread state 661 * Thread - Current thread state
831 * 662 *
832 * RETURN: Pointer to the new walk state. 663 * RETURN: Pointer to the new walk state.
@@ -896,8 +727,7 @@ acpi_ds_create_walk_state (
896 * method_node - Control method NS node, if any 727 * method_node - Control method NS node, if any
897 * aml_start - Start of AML 728 * aml_start - Start of AML
898 * aml_length - Length of AML 729 * aml_length - Length of AML
899 * Params - Method args, if any 730 * Info - Method info block (params, etc.)
900 * return_obj_desc - Where to store a return object, if any
901 * pass_number - 1, 2, or 3 731 * pass_number - 1, 2, or 3
902 * 732 *
903 * RETURN: Status 733 * RETURN: Status
@@ -931,7 +761,7 @@ acpi_ds_init_aml_walk (
931 761
932 /* The next_op of the next_walk will be the beginning of the method */ 762 /* The next_op of the next_walk will be the beginning of the method */
933 763
934 walk_state->next_op = NULL; 764 walk_state->next_op = NULL;
935 765
936 if (info) { 766 if (info) {
937 if (info->parameter_type == ACPI_PARAM_GPE) { 767 if (info->parameter_type == ACPI_PARAM_GPE) {
@@ -939,8 +769,8 @@ acpi_ds_init_aml_walk (
939 info->parameters); 769 info->parameters);
940 } 770 }
941 else { 771 else {
942 walk_state->params = info->parameters; 772 walk_state->params = info->parameters;
943 walk_state->caller_return_desc = &info->return_object; 773 walk_state->caller_return_desc = &info->return_object;
944 } 774 }
945 } 775 }
946 776
@@ -964,7 +794,8 @@ acpi_ds_init_aml_walk (
964 794
965 /* Init the method arguments */ 795 /* Init the method arguments */
966 796
967 status = acpi_ds_method_data_init_args (walk_state->params, ACPI_METHOD_NUM_ARGS, walk_state); 797 status = acpi_ds_method_data_init_args (walk_state->params,
798 ACPI_METHOD_NUM_ARGS, walk_state);
968 if (ACPI_FAILURE (status)) { 799 if (ACPI_FAILURE (status)) {
969 return_ACPI_STATUS (status); 800 return_ACPI_STATUS (status);
970 } 801 }
@@ -1031,12 +862,14 @@ acpi_ds_delete_walk_state (
1031 } 862 }
1032 863
1033 if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { 864 if (walk_state->data_type != ACPI_DESC_TYPE_WALK) {
1034 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", walk_state)); 865 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n",
866 walk_state));
1035 return; 867 return;
1036 } 868 }
1037 869
1038 if (walk_state->parser_state.scope) { 870 if (walk_state->parser_state.scope) {
1039 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", walk_state)); 871 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n",
872 walk_state));
1040 } 873 }
1041 874
1042 /* Always must free any linked control states */ 875 /* Always must free any linked control states */
@@ -1078,7 +911,7 @@ acpi_ds_delete_walk_state (
1078 * 911 *
1079 * PARAMETERS: None 912 * PARAMETERS: None
1080 * 913 *
1081 * RETURN: Status 914 * RETURN: None
1082 * 915 *
1083 * DESCRIPTION: Purge the global state object cache. Used during subsystem 916 * DESCRIPTION: Purge the global state object cache. Used during subsystem
1084 * termination. 917 * termination.
@@ -1098,3 +931,200 @@ acpi_ds_delete_walk_state_cache (
1098#endif 931#endif
1099 932
1100 933
934#ifdef ACPI_OBSOLETE_FUNCTIONS
935/*******************************************************************************
936 *
937 * FUNCTION: acpi_ds_result_insert
938 *
939 * PARAMETERS: Object - Object to push
940 * Index - Where to insert the object
941 * walk_state - Current Walk state
942 *
943 * RETURN: Status
944 *
945 * DESCRIPTION: Insert an object onto this walk's result stack
946 *
947 ******************************************************************************/
948
949acpi_status
950acpi_ds_result_insert (
951 void *object,
952 u32 index,
953 struct acpi_walk_state *walk_state)
954{
955 union acpi_generic_state *state;
956
957
958 ACPI_FUNCTION_NAME ("ds_result_insert");
959
960
961 state = walk_state->results;
962 if (!state) {
963 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
964 walk_state));
965 return (AE_NOT_EXIST);
966 }
967
968 if (index >= ACPI_OBJ_NUM_OPERANDS) {
969 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
970 "Index out of range: %X Obj=%p State=%p Num=%X\n",
971 index, object, walk_state, state->results.num_results));
972 return (AE_BAD_PARAMETER);
973 }
974
975 if (!object) {
976 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
977 "Null Object! Index=%X Obj=%p State=%p Num=%X\n",
978 index, object, walk_state, state->results.num_results));
979 return (AE_BAD_PARAMETER);
980 }
981
982 state->results.obj_desc [index] = object;
983 state->results.num_results++;
984
985 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
986 "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
987 object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL",
988 walk_state, state->results.num_results, walk_state->current_result));
989
990 return (AE_OK);
991}
992
993
994/*******************************************************************************
995 *
996 * FUNCTION: acpi_ds_obj_stack_delete_all
997 *
998 * PARAMETERS: walk_state - Current Walk state
999 *
1000 * RETURN: Status
1001 *
1002 * DESCRIPTION: Clear the object stack by deleting all objects that are on it.
1003 * Should be used with great care, if at all!
1004 *
1005 ******************************************************************************/
1006
1007acpi_status
1008acpi_ds_obj_stack_delete_all (
1009 struct acpi_walk_state *walk_state)
1010{
1011 u32 i;
1012
1013
1014 ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state);
1015
1016
1017 /* The stack size is configurable, but fixed */
1018
1019 for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) {
1020 if (walk_state->operands[i]) {
1021 acpi_ut_remove_reference (walk_state->operands[i]);
1022 walk_state->operands[i] = NULL;
1023 }
1024 }
1025
1026 return_ACPI_STATUS (AE_OK);
1027}
1028
1029
1030/*******************************************************************************
1031 *
1032 * FUNCTION: acpi_ds_obj_stack_pop_object
1033 *
1034 * PARAMETERS: Object - Where to return the popped object
1035 * walk_state - Current Walk state
1036 *
1037 * RETURN: Status
1038 *
1039 * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
1040 * deleted by this routine.
1041 *
1042 ******************************************************************************/
1043
1044acpi_status
1045acpi_ds_obj_stack_pop_object (
1046 union acpi_operand_object **object,
1047 struct acpi_walk_state *walk_state)
1048{
1049 ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object");
1050
1051
1052 /* Check for stack underflow */
1053
1054 if (walk_state->num_operands == 0) {
1055 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
1056 "Missing operand/stack empty! State=%p #Ops=%X\n",
1057 walk_state, walk_state->num_operands));
1058 *object = NULL;
1059 return (AE_AML_NO_OPERAND);
1060 }
1061
1062 /* Pop the stack */
1063
1064 walk_state->num_operands--;
1065
1066 /* Check for a valid operand */
1067
1068 if (!walk_state->operands [walk_state->num_operands]) {
1069 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
1070 "Null operand! State=%p #Ops=%X\n",
1071 walk_state, walk_state->num_operands));
1072 *object = NULL;
1073 return (AE_AML_NO_OPERAND);
1074 }
1075
1076 /* Get operand and set stack entry to null */
1077
1078 *object = walk_state->operands [walk_state->num_operands];
1079 walk_state->operands [walk_state->num_operands] = NULL;
1080
1081 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
1082 *object, acpi_ut_get_object_type_name (*object),
1083 walk_state, walk_state->num_operands));
1084
1085 return (AE_OK);
1086}
1087
1088
1089/*******************************************************************************
1090 *
1091 * FUNCTION: acpi_ds_obj_stack_get_value
1092 *
1093 * PARAMETERS: Index - Stack index whose value is desired. Based
1094 * on the top of the stack (index=0 == top)
1095 * walk_state - Current Walk state
1096 *
1097 * RETURN: Pointer to the requested operand
1098 *
1099 * DESCRIPTION: Retrieve an object from this walk's operand stack. Index must
1100 * be within the range of the current stack pointer.
1101 *
1102 ******************************************************************************/
1103
1104void *
1105acpi_ds_obj_stack_get_value (
1106 u32 index,
1107 struct acpi_walk_state *walk_state)
1108{
1109
1110 ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state);
1111
1112
1113 /* Can't do it if the stack is empty */
1114
1115 if (walk_state->num_operands == 0) {
1116 return_PTR (NULL);
1117 }
1118
1119 /* or if the index is past the top of the stack */
1120
1121 if (index > (walk_state->num_operands - (u32) 1)) {
1122 return_PTR (NULL);
1123 }
1124
1125 return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) -
1126 index]);
1127}
1128#endif
1129
1130
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c
index 2a213604ae51..dd3a72a869f4 100644
--- a/drivers/acpi/events/evevent.c
+++ b/drivers/acpi/events/evevent.c
@@ -47,6 +47,16 @@
47#define _COMPONENT ACPI_EVENTS 47#define _COMPONENT ACPI_EVENTS
48 ACPI_MODULE_NAME ("evevent") 48 ACPI_MODULE_NAME ("evevent")
49 49
50/* Local prototypes */
51
52static acpi_status
53acpi_ev_fixed_event_initialize (
54 void);
55
56static u32
57acpi_ev_fixed_event_dispatch (
58 u32 event);
59
50 60
51/******************************************************************************* 61/*******************************************************************************
52 * 62 *
@@ -56,7 +66,7 @@
56 * 66 *
57 * RETURN: Status 67 * RETURN: Status
58 * 68 *
59 * DESCRIPTION: Initialize global data structures for events. 69 * DESCRIPTION: Initialize global data structures for ACPI events (Fixed, GPE)
60 * 70 *
61 ******************************************************************************/ 71 ******************************************************************************/
62 72
@@ -78,9 +88,9 @@ acpi_ev_initialize_events (
78 } 88 }
79 89
80 /* 90 /*
81 * Initialize the Fixed and General Purpose Events. This is 91 * Initialize the Fixed and General Purpose Events. This is done prior to
82 * done prior to enabling SCIs to prevent interrupts from 92 * enabling SCIs to prevent interrupts from occurring before the handlers are
83 * occurring before handers are installed. 93 * installed.
84 */ 94 */
85 status = acpi_ev_fixed_event_initialize (); 95 status = acpi_ev_fixed_event_initialize ();
86 if (ACPI_FAILURE (status)) { 96 if (ACPI_FAILURE (status)) {
@@ -161,7 +171,7 @@ acpi_ev_install_xrupt_handlers (
161 * 171 *
162 ******************************************************************************/ 172 ******************************************************************************/
163 173
164acpi_status 174static acpi_status
165acpi_ev_fixed_event_initialize ( 175acpi_ev_fixed_event_initialize (
166 void) 176 void)
167{ 177{
@@ -180,7 +190,8 @@ acpi_ev_fixed_event_initialize (
180 /* Enable the fixed event */ 190 /* Enable the fixed event */
181 191
182 if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) { 192 if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) {
183 status = acpi_set_register (acpi_gbl_fixed_event_info[i].enable_register_id, 193 status = acpi_set_register (
194 acpi_gbl_fixed_event_info[i].enable_register_id,
184 0, ACPI_MTX_LOCK); 195 0, ACPI_MTX_LOCK);
185 if (ACPI_FAILURE (status)) { 196 if (ACPI_FAILURE (status)) {
186 return (status); 197 return (status);
@@ -200,7 +211,7 @@ acpi_ev_fixed_event_initialize (
200 * 211 *
201 * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED 212 * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
202 * 213 *
203 * DESCRIPTION: Checks the PM status register for fixed events 214 * DESCRIPTION: Checks the PM status register for active fixed events
204 * 215 *
205 ******************************************************************************/ 216 ******************************************************************************/
206 217
@@ -221,8 +232,10 @@ acpi_ev_fixed_event_detect (
221 * Read the fixed feature status and enable registers, as all the cases 232 * Read the fixed feature status and enable registers, as all the cases
222 * depend on their values. Ignore errors here. 233 * depend on their values. Ignore errors here.
223 */ 234 */
224 (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, &fixed_status); 235 (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
225 (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, &fixed_enable); 236 &fixed_status);
237 (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE,
238 &fixed_enable);
226 239
227 ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, 240 ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
228 "Fixed Event Block: Enable %08X Status %08X\n", 241 "Fixed Event Block: Enable %08X Status %08X\n",
@@ -259,7 +272,7 @@ acpi_ev_fixed_event_detect (
259 * 272 *
260 ******************************************************************************/ 273 ******************************************************************************/
261 274
262u32 275static u32
263acpi_ev_fixed_event_dispatch ( 276acpi_ev_fixed_event_dispatch (
264 u32 event) 277 u32 event)
265{ 278{
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c
index 118d72ac7c76..081120b109ba 100644
--- a/drivers/acpi/events/evgpe.c
+++ b/drivers/acpi/events/evgpe.c
@@ -48,6 +48,12 @@
48#define _COMPONENT ACPI_EVENTS 48#define _COMPONENT ACPI_EVENTS
49 ACPI_MODULE_NAME ("evgpe") 49 ACPI_MODULE_NAME ("evgpe")
50 50
51/* Local prototypes */
52
53static void ACPI_SYSTEM_XFACE
54acpi_ev_asynch_execute_gpe_method (
55 void *context);
56
51 57
52/******************************************************************************* 58/*******************************************************************************
53 * 59 *
@@ -335,8 +341,10 @@ acpi_ev_get_gpe_event_info (
335 gpe_block = acpi_gbl_gpe_fadt_blocks[i]; 341 gpe_block = acpi_gbl_gpe_fadt_blocks[i];
336 if (gpe_block) { 342 if (gpe_block) {
337 if ((gpe_number >= gpe_block->block_base_number) && 343 if ((gpe_number >= gpe_block->block_base_number) &&
338 (gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) { 344 (gpe_number < gpe_block->block_base_number +
339 return (&gpe_block->event_info[gpe_number - gpe_block->block_base_number]); 345 (gpe_block->register_count * 8))) {
346 return (&gpe_block->event_info[gpe_number -
347 gpe_block->block_base_number]);
340 } 348 }
341 } 349 }
342 } 350 }
@@ -437,7 +445,7 @@ acpi_ev_gpe_detect (
437 "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n", 445 "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
438 gpe_register_info->base_gpe_number, status_reg, enable_reg)); 446 gpe_register_info->base_gpe_number, status_reg, enable_reg));
439 447
440 /* First check if there is anything active at all in this register */ 448 /* Check if there is anything active at all in this register */
441 449
442 enabled_status_byte = (u8) (status_reg & enable_reg); 450 enabled_status_byte = (u8) (status_reg & enable_reg);
443 if (!enabled_status_byte) { 451 if (!enabled_status_byte) {
@@ -457,8 +465,8 @@ acpi_ev_gpe_detect (
457 * or method. 465 * or method.
458 */ 466 */
459 int_status |= acpi_ev_gpe_dispatch ( 467 int_status |= acpi_ev_gpe_dispatch (
460 &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j], 468 &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j],
461 (u32) j + gpe_register_info->base_gpe_number); 469 (u32) j + gpe_register_info->base_gpe_number);
462 } 470 }
463 } 471 }
464 } 472 }
@@ -523,7 +531,8 @@ acpi_ev_asynch_execute_gpe_method (
523 * Take a snapshot of the GPE info for this level - we copy the 531 * Take a snapshot of the GPE info for this level - we copy the
524 * info to prevent a race condition with remove_handler/remove_block. 532 * info to prevent a race condition with remove_handler/remove_block.
525 */ 533 */
526 ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info, sizeof (struct acpi_gpe_event_info)); 534 ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info,
535 sizeof (struct acpi_gpe_event_info));
527 536
528 status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); 537 status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
529 if (ACPI_FAILURE (status)) { 538 if (ACPI_FAILURE (status)) {
@@ -534,7 +543,8 @@ acpi_ev_asynch_execute_gpe_method (
534 * Must check for control method type dispatch one more 543 * Must check for control method type dispatch one more
535 * time to avoid race with ev_gpe_install_handler 544 * time to avoid race with ev_gpe_install_handler
536 */ 545 */
537 if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) { 546 if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) ==
547 ACPI_GPE_DISPATCH_METHOD) {
538 /* 548 /*
539 * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx 549 * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
540 * control method that corresponds to this GPE 550 * control method that corresponds to this GPE
@@ -553,7 +563,8 @@ acpi_ev_asynch_execute_gpe_method (
553 } 563 }
554 } 564 }
555 565
556 if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) { 566 if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
567 ACPI_GPE_LEVEL_TRIGGERED) {
557 /* 568 /*
558 * GPE is level-triggered, we clear the GPE status bit after 569 * GPE is level-triggered, we clear the GPE status bit after
559 * handling the event. 570 * handling the event.
@@ -575,7 +586,7 @@ acpi_ev_asynch_execute_gpe_method (
575 * 586 *
576 * FUNCTION: acpi_ev_gpe_dispatch 587 * FUNCTION: acpi_ev_gpe_dispatch
577 * 588 *
578 * PARAMETERS: gpe_event_info - info for this GPE 589 * PARAMETERS: gpe_event_info - Info for this GPE
579 * gpe_number - Number relative to the parent GPE block 590 * gpe_number - Number relative to the parent GPE block
580 * 591 *
581 * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED 592 * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
@@ -602,10 +613,12 @@ acpi_ev_gpe_dispatch (
602 * If edge-triggered, clear the GPE status bit now. Note that 613 * If edge-triggered, clear the GPE status bit now. Note that
603 * level-triggered events are cleared after the GPE is serviced. 614 * level-triggered events are cleared after the GPE is serviced.
604 */ 615 */
605 if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_EDGE_TRIGGERED) { 616 if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
617 ACPI_GPE_EDGE_TRIGGERED) {
606 status = acpi_hw_clear_gpe (gpe_event_info); 618 status = acpi_hw_clear_gpe (gpe_event_info);
607 if (ACPI_FAILURE (status)) { 619 if (ACPI_FAILURE (status)) {
608 ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", 620 ACPI_REPORT_ERROR ((
621 "acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n",
609 acpi_format_exception (status), gpe_number)); 622 acpi_format_exception (status), gpe_number));
610 return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); 623 return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
611 } 624 }
@@ -639,7 +652,8 @@ acpi_ev_gpe_dispatch (
639 652
640 /* It is now safe to clear level-triggered events. */ 653 /* It is now safe to clear level-triggered events. */
641 654
642 if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) { 655 if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
656 ACPI_GPE_LEVEL_TRIGGERED) {
643 status = acpi_hw_clear_gpe (gpe_event_info); 657 status = acpi_hw_clear_gpe (gpe_event_info);
644 if (ACPI_FAILURE (status)) { 658 if (ACPI_FAILURE (status)) {
645 ACPI_REPORT_ERROR (( 659 ACPI_REPORT_ERROR ((
@@ -704,7 +718,6 @@ acpi_ev_gpe_dispatch (
704 718
705 719
706#ifdef ACPI_GPE_NOTIFY_CHECK 720#ifdef ACPI_GPE_NOTIFY_CHECK
707
708/******************************************************************************* 721/*******************************************************************************
709 * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED 722 * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
710 * 723 *
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c
index 00d981f53c6a..84186a7d17b2 100644
--- a/drivers/acpi/events/evgpeblk.c
+++ b/drivers/acpi/events/evgpeblk.c
@@ -48,6 +48,39 @@
48#define _COMPONENT ACPI_EVENTS 48#define _COMPONENT ACPI_EVENTS
49 ACPI_MODULE_NAME ("evgpeblk") 49 ACPI_MODULE_NAME ("evgpeblk")
50 50
51/* Local prototypes */
52
53static acpi_status
54acpi_ev_save_method_info (
55 acpi_handle obj_handle,
56 u32 level,
57 void *obj_desc,
58 void **return_value);
59
60static acpi_status
61acpi_ev_match_prw_and_gpe (
62 acpi_handle obj_handle,
63 u32 level,
64 void *info,
65 void **return_value);
66
67static struct acpi_gpe_xrupt_info *
68acpi_ev_get_gpe_xrupt_block (
69 u32 interrupt_level);
70
71static acpi_status
72acpi_ev_delete_gpe_xrupt (
73 struct acpi_gpe_xrupt_info *gpe_xrupt);
74
75static acpi_status
76acpi_ev_install_gpe_block (
77 struct acpi_gpe_block_info *gpe_block,
78 u32 interrupt_level);
79
80static acpi_status
81acpi_ev_create_gpe_info_blocks (
82 struct acpi_gpe_block_info *gpe_block);
83
51 84
52/******************************************************************************* 85/*******************************************************************************
53 * 86 *
@@ -155,7 +188,7 @@ unlock_and_exit:
155} 188}
156 189
157 190
158/****************************************************************************** 191/*******************************************************************************
159 * 192 *
160 * FUNCTION: acpi_ev_delete_gpe_handlers 193 * FUNCTION: acpi_ev_delete_gpe_handlers
161 * 194 *
@@ -190,7 +223,8 @@ acpi_ev_delete_gpe_handlers (
190 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { 223 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
191 gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; 224 gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j];
192 225
193 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) { 226 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
227 ACPI_GPE_DISPATCH_HANDLER) {
194 ACPI_MEM_FREE (gpe_event_info->dispatch.handler); 228 ACPI_MEM_FREE (gpe_event_info->dispatch.handler);
195 gpe_event_info->dispatch.handler = NULL; 229 gpe_event_info->dispatch.handler = NULL;
196 gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; 230 gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK;
@@ -471,7 +505,7 @@ acpi_ev_get_gpe_xrupt_block (
471 ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block"); 505 ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block");
472 506
473 507
474 /* No need for spin lock since we are not changing any list elements here */ 508 /* No need for lock since we are not changing any list elements here */
475 509
476 next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; 510 next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
477 while (next_gpe_xrupt) { 511 while (next_gpe_xrupt) {
@@ -619,7 +653,7 @@ acpi_ev_install_gpe_block (
619 goto unlock_and_exit; 653 goto unlock_and_exit;
620 } 654 }
621 655
622 /* Install the new block at the end of the list for this interrupt with lock */ 656 /* Install the new block at the end of the list with lock */
623 657
624 acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); 658 acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
625 if (gpe_xrupt_block->gpe_block_list_head) { 659 if (gpe_xrupt_block->gpe_block_list_head) {
@@ -756,10 +790,12 @@ acpi_ev_create_gpe_info_blocks (
756 * per register. Initialization to zeros is sufficient. 790 * per register. Initialization to zeros is sufficient.
757 */ 791 */
758 gpe_event_info = ACPI_MEM_CALLOCATE ( 792 gpe_event_info = ACPI_MEM_CALLOCATE (
759 ((acpi_size) gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) * 793 ((acpi_size) gpe_block->register_count *
794 ACPI_GPE_REGISTER_WIDTH) *
760 sizeof (struct acpi_gpe_event_info)); 795 sizeof (struct acpi_gpe_event_info));
761 if (!gpe_event_info) { 796 if (!gpe_event_info) {
762 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the gpe_event_info table\n")); 797 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
798 "Could not allocate the gpe_event_info table\n"));
763 status = AE_NO_MEMORY; 799 status = AE_NO_MEMORY;
764 goto error_exit; 800 goto error_exit;
765 } 801 }
@@ -899,7 +935,8 @@ acpi_ev_create_gpe_block (
899 gpe_block->block_base_number = gpe_block_base_number; 935 gpe_block->block_base_number = gpe_block_base_number;
900 gpe_block->node = gpe_device; 936 gpe_block->node = gpe_device;
901 937
902 ACPI_MEMCPY (&gpe_block->block_address, gpe_block_address, sizeof (struct acpi_generic_address)); 938 ACPI_MEMCPY (&gpe_block->block_address, gpe_block_address,
939 sizeof (struct acpi_generic_address));
903 940
904 /* Create the register_info and event_info sub-structures */ 941 /* Create the register_info and event_info sub-structures */
905 942
@@ -1061,8 +1098,9 @@ acpi_ev_gpe_initialize (
1061 1098
1062 /* Install GPE Block 0 */ 1099 /* Install GPE Block 0 */
1063 1100
1064 status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, &acpi_gbl_FADT->xgpe0_blk, 1101 status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device,
1065 register_count0, 0, acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]); 1102 &acpi_gbl_FADT->xgpe0_blk, register_count0, 0,
1103 acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]);
1066 1104
1067 if (ACPI_FAILURE (status)) { 1105 if (ACPI_FAILURE (status)) {
1068 ACPI_REPORT_ERROR (( 1106 ACPI_REPORT_ERROR ((
@@ -1094,8 +1132,9 @@ acpi_ev_gpe_initialize (
1094 else { 1132 else {
1095 /* Install GPE Block 1 */ 1133 /* Install GPE Block 1 */
1096 1134
1097 status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, &acpi_gbl_FADT->xgpe1_blk, 1135 status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device,
1098 register_count1, acpi_gbl_FADT->gpe1_base, 1136 &acpi_gbl_FADT->xgpe1_blk, register_count1,
1137 acpi_gbl_FADT->gpe1_base,
1099 acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]); 1138 acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]);
1100 1139
1101 if (ACPI_FAILURE (status)) { 1140 if (ACPI_FAILURE (status)) {
@@ -1109,7 +1148,7 @@ acpi_ev_gpe_initialize (
1109 * space. However, GPE0 always starts at GPE number zero. 1148 * space. However, GPE0 always starts at GPE number zero.
1110 */ 1149 */
1111 gpe_number_max = acpi_gbl_FADT->gpe1_base + 1150 gpe_number_max = acpi_gbl_FADT->gpe1_base +
1112 ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1); 1151 ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1);
1113 } 1152 }
1114 } 1153 }
1115 1154
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c
index 2548efa7a45f..659e90956112 100644
--- a/drivers/acpi/events/evmisc.c
+++ b/drivers/acpi/events/evmisc.c
@@ -50,6 +50,35 @@
50 ACPI_MODULE_NAME ("evmisc") 50 ACPI_MODULE_NAME ("evmisc")
51 51
52 52
53#ifdef ACPI_DEBUG_OUTPUT
54static const char *acpi_notify_value_names[] =
55{
56 "Bus Check",
57 "Device Check",
58 "Device Wake",
59 "Eject request",
60 "Device Check Light",
61 "Frequency Mismatch",
62 "Bus Mode Mismatch",
63 "Power Fault"
64};
65#endif
66
67/* Local prototypes */
68
69static void ACPI_SYSTEM_XFACE
70acpi_ev_notify_dispatch (
71 void *context);
72
73static void ACPI_SYSTEM_XFACE
74acpi_ev_global_lock_thread (
75 void *context);
76
77static u32
78acpi_ev_global_lock_handler (
79 void *context);
80
81
53/******************************************************************************* 82/*******************************************************************************
54 * 83 *
55 * FUNCTION: acpi_ev_is_notify_object 84 * FUNCTION: acpi_ev_is_notify_object
@@ -98,20 +127,6 @@ acpi_ev_is_notify_object (
98 * 127 *
99 ******************************************************************************/ 128 ******************************************************************************/
100 129
101#ifdef ACPI_DEBUG_OUTPUT
102static const char *acpi_notify_value_names[] =
103{
104 "Bus Check",
105 "Device Check",
106 "Device Wake",
107 "Eject request",
108 "Device Check Light",
109 "Frequency Mismatch",
110 "Bus Mode Mismatch",
111 "Power Fault"
112};
113#endif
114
115acpi_status 130acpi_status
116acpi_ev_queue_notify_request ( 131acpi_ev_queue_notify_request (
117 struct acpi_namespace_node *node, 132 struct acpi_namespace_node *node,
@@ -128,9 +143,10 @@ acpi_ev_queue_notify_request (
128 143
129 /* 144 /*
130 * For value 3 (Ejection Request), some device method may need to be run. 145 * For value 3 (Ejection Request), some device method may need to be run.
131 * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need to be run. 146 * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need
147 * to be run.
132 * For value 0x80 (Status Change) on the power button or sleep button, 148 * For value 0x80 (Status Change) on the power button or sleep button,
133 * initiate soft-off or sleep operation? 149 * initiate soft-off or sleep operation?
134 */ 150 */
135 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 151 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
136 "Dispatching Notify(%X) on node %p\n", notify_value, node)); 152 "Dispatching Notify(%X) on node %p\n", notify_value, node));
@@ -140,8 +156,9 @@ acpi_ev_queue_notify_request (
140 acpi_notify_value_names[notify_value])); 156 acpi_notify_value_names[notify_value]));
141 } 157 }
142 else { 158 else {
143 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: 0x%2.2X **Device Specific**\n", 159 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
144 notify_value)); 160 "Notify value: 0x%2.2X **Device Specific**\n",
161 notify_value));
145 } 162 }
146 163
147 /* Get the notify object attached to the NS Node */ 164 /* Get the notify object attached to the NS Node */
@@ -210,7 +227,7 @@ acpi_ev_queue_notify_request (
210 * 227 *
211 * FUNCTION: acpi_ev_notify_dispatch 228 * FUNCTION: acpi_ev_notify_dispatch
212 * 229 *
213 * PARAMETERS: Context - To be passsed to the notify handler 230 * PARAMETERS: Context - To be passed to the notify handler
214 * 231 *
215 * RETURN: None. 232 * RETURN: None.
216 * 233 *
@@ -219,7 +236,7 @@ acpi_ev_queue_notify_request (
219 * 236 *
220 ******************************************************************************/ 237 ******************************************************************************/
221 238
222void ACPI_SYSTEM_XFACE 239static void ACPI_SYSTEM_XFACE
223acpi_ev_notify_dispatch ( 240acpi_ev_notify_dispatch (
224 void *context) 241 void *context)
225{ 242{
@@ -234,7 +251,8 @@ acpi_ev_notify_dispatch (
234 251
235 /* 252 /*
236 * We will invoke a global notify handler if installed. 253 * We will invoke a global notify handler if installed.
237 * This is done _before_ we invoke the per-device handler attached to the device. 254 * This is done _before_ we invoke the per-device handler attached
255 * to the device.
238 */ 256 */
239 if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { 257 if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) {
240 /* Global system notification handler */ 258 /* Global system notification handler */
@@ -256,15 +274,17 @@ acpi_ev_notify_dispatch (
256 /* Invoke the system handler first, if present */ 274 /* Invoke the system handler first, if present */
257 275
258 if (global_handler) { 276 if (global_handler) {
259 global_handler (notify_info->notify.node, notify_info->notify.value, global_context); 277 global_handler (notify_info->notify.node, notify_info->notify.value,
278 global_context);
260 } 279 }
261 280
262 /* Now invoke the per-device handler, if present */ 281 /* Now invoke the per-device handler, if present */
263 282
264 handler_obj = notify_info->notify.handler_obj; 283 handler_obj = notify_info->notify.handler_obj;
265 if (handler_obj) { 284 if (handler_obj) {
266 handler_obj->notify.handler (notify_info->notify.node, notify_info->notify.value, 285 handler_obj->notify.handler (notify_info->notify.node,
267 handler_obj->notify.context); 286 notify_info->notify.value,
287 handler_obj->notify.context);
268 } 288 }
269 289
270 /* All done with the info object */ 290 /* All done with the info object */
@@ -370,7 +390,8 @@ acpi_ev_global_lock_handler (
370 ******************************************************************************/ 390 ******************************************************************************/
371 391
372acpi_status 392acpi_status
373acpi_ev_init_global_lock_handler (void) 393acpi_ev_init_global_lock_handler (
394 void)
374{ 395{
375 acpi_status status; 396 acpi_status status;
376 397
@@ -380,7 +401,7 @@ acpi_ev_init_global_lock_handler (void)
380 401
381 acpi_gbl_global_lock_present = TRUE; 402 acpi_gbl_global_lock_present = TRUE;
382 status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL, 403 status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL,
383 acpi_ev_global_lock_handler, NULL); 404 acpi_ev_global_lock_handler, NULL);
384 405
385 /* 406 /*
386 * If the global lock does not exist on this platform, the attempt 407 * If the global lock does not exist on this platform, the attempt
@@ -433,8 +454,10 @@ acpi_ev_acquire_global_lock (
433 454
434 acpi_gbl_global_lock_thread_count++; 455 acpi_gbl_global_lock_thread_count++;
435 456
436 /* If we (OS side vs. BIOS side) have the hardware lock already, we are done */ 457 /*
437 458 * If we (OS side vs. BIOS side) have the hardware lock already,
459 * we are done
460 */
438 if (acpi_gbl_global_lock_acquired) { 461 if (acpi_gbl_global_lock_acquired) {
439 return_ACPI_STATUS (AE_OK); 462 return_ACPI_STATUS (AE_OK);
440 } 463 }
@@ -480,7 +503,8 @@ acpi_ev_acquire_global_lock (
480 ******************************************************************************/ 503 ******************************************************************************/
481 504
482acpi_status 505acpi_status
483acpi_ev_release_global_lock (void) 506acpi_ev_release_global_lock (
507 void)
484{ 508{
485 u8 pending = FALSE; 509 u8 pending = FALSE;
486 acpi_status status = AE_OK; 510 acpi_status status = AE_OK;
@@ -490,7 +514,8 @@ acpi_ev_release_global_lock (void)
490 514
491 515
492 if (!acpi_gbl_global_lock_thread_count) { 516 if (!acpi_gbl_global_lock_thread_count) {
493 ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n")); 517 ACPI_REPORT_WARNING((
518 "Cannot release HW Global Lock, it has not been acquired\n"));
494 return_ACPI_STATUS (AE_NOT_ACQUIRED); 519 return_ACPI_STATUS (AE_NOT_ACQUIRED);
495 } 520 }
496 521
@@ -515,7 +540,8 @@ acpi_ev_release_global_lock (void)
515 * register 540 * register
516 */ 541 */
517 if (pending) { 542 if (pending) {
518 status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK); 543 status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE,
544 1, ACPI_MTX_LOCK);
519 } 545 }
520 546
521 return_ACPI_STATUS (status); 547 return_ACPI_STATUS (status);
@@ -535,7 +561,8 @@ acpi_ev_release_global_lock (void)
535 ******************************************************************************/ 561 ******************************************************************************/
536 562
537void 563void
538acpi_ev_terminate (void) 564acpi_ev_terminate (
565 void)
539{ 566{
540 acpi_native_uint i; 567 acpi_native_uint i;
541 acpi_status status; 568 acpi_status status;
@@ -555,7 +582,8 @@ acpi_ev_terminate (void)
555 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { 582 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
556 status = acpi_disable_event ((u32) i, 0); 583 status = acpi_disable_event ((u32) i, 0);
557 if (ACPI_FAILURE (status)) { 584 if (ACPI_FAILURE (status)) {
558 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable fixed event %d\n", (u32) i)); 585 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
586 "Could not disable fixed event %d\n", (u32) i));
559 } 587 }
560 } 588 }
561 589
@@ -567,7 +595,8 @@ acpi_ev_terminate (void)
567 595
568 status = acpi_ev_remove_sci_handler (); 596 status = acpi_ev_remove_sci_handler ();
569 if (ACPI_FAILURE(status)) { 597 if (ACPI_FAILURE(status)) {
570 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not remove SCI handler\n")); 598 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
599 "Could not remove SCI handler\n"));
571 } 600 }
572 } 601 }
573 602
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c
index 772342708a7a..a1d7276c5742 100644
--- a/drivers/acpi/events/evregion.c
+++ b/drivers/acpi/events/evregion.c
@@ -58,6 +58,22 @@ static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPA
58 ACPI_ADR_SPACE_PCI_CONFIG, 58 ACPI_ADR_SPACE_PCI_CONFIG,
59 ACPI_ADR_SPACE_DATA_TABLE}; 59 ACPI_ADR_SPACE_DATA_TABLE};
60 60
61/* Local prototypes */
62
63static acpi_status
64acpi_ev_reg_run (
65 acpi_handle obj_handle,
66 u32 level,
67 void *context,
68 void **return_value);
69
70static acpi_status
71acpi_ev_install_handler (
72 acpi_handle obj_handle,
73 u32 level,
74 void *context,
75 void **return_value);
76
61 77
62/******************************************************************************* 78/*******************************************************************************
63 * 79 *
@@ -179,8 +195,8 @@ acpi_ev_initialize_op_regions (
179 * 195 *
180 * FUNCTION: acpi_ev_execute_reg_method 196 * FUNCTION: acpi_ev_execute_reg_method
181 * 197 *
182 * PARAMETERS: region_obj - Object structure 198 * PARAMETERS: region_obj - Region object
183 * Function - Passed to _REG: On (1) or Off (0) 199 * Function - Passed to _REG: On (1) or Off (0)
184 * 200 *
185 * RETURN: Status 201 * RETURN: Status
186 * 202 *
@@ -323,14 +339,16 @@ acpi_ev_address_space_dispatch (
323 if (!region_setup) { 339 if (!region_setup) {
324 /* No initialization routine, exit with error */ 340 /* No initialization routine, exit with error */
325 341
326 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No init routine for region(%p) [%s]\n", 342 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
343 "No init routine for region(%p) [%s]\n",
327 region_obj, acpi_ut_get_region_name (region_obj->region.space_id))); 344 region_obj, acpi_ut_get_region_name (region_obj->region.space_id)));
328 return_ACPI_STATUS (AE_NOT_EXIST); 345 return_ACPI_STATUS (AE_NOT_EXIST);
329 } 346 }
330 347
331 /* 348 /*
332 * We must exit the interpreter because the region setup will potentially 349 * We must exit the interpreter because the region
333 * execute control methods (e.g., _REG method for this region) 350 * setup will potentially execute control methods
351 * (e.g., _REG method for this region)
334 */ 352 */
335 acpi_ex_exit_interpreter (); 353 acpi_ex_exit_interpreter ();
336 354
@@ -621,7 +639,7 @@ acpi_ev_attach_region (
621 * 639 *
622 ******************************************************************************/ 640 ******************************************************************************/
623 641
624acpi_status 642static acpi_status
625acpi_ev_install_handler ( 643acpi_ev_install_handler (
626 acpi_handle obj_handle, 644 acpi_handle obj_handle,
627 u32 level, 645 u32 level,
@@ -848,7 +866,8 @@ acpi_ev_install_space_handler (
848 if (handler_obj->address_space.handler == handler) { 866 if (handler_obj->address_space.handler == handler) {
849 /* 867 /*
850 * It is (relatively) OK to attempt to install the SAME 868 * It is (relatively) OK to attempt to install the SAME
851 * handler twice. This can easily happen with PCI_Config space. 869 * handler twice. This can easily happen
870 * with PCI_Config space.
852 */ 871 */
853 status = AE_SAME_HANDLER; 872 status = AE_SAME_HANDLER;
854 goto unlock_and_exit; 873 goto unlock_and_exit;
@@ -1011,7 +1030,7 @@ acpi_ev_execute_reg_methods (
1011 * 1030 *
1012 ******************************************************************************/ 1031 ******************************************************************************/
1013 1032
1014acpi_status 1033static acpi_status
1015acpi_ev_reg_run ( 1034acpi_ev_reg_run (
1016 acpi_handle obj_handle, 1035 acpi_handle obj_handle,
1017 u32 level, 1036 u32 level,
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c
index 4983a3378be5..95bc09c73a6a 100644
--- a/drivers/acpi/events/evrgnini.c
+++ b/drivers/acpi/events/evrgnini.c
@@ -61,7 +61,7 @@
61 * 61 *
62 * RETURN: Status 62 * RETURN: Status
63 * 63 *
64 * DESCRIPTION: Do any prep work for region handling, a nop for now 64 * DESCRIPTION: Setup a system_memory operation region
65 * 65 *
66 ******************************************************************************/ 66 ******************************************************************************/
67 67
@@ -115,7 +115,7 @@ acpi_ev_system_memory_region_setup (
115 * 115 *
116 * RETURN: Status 116 * RETURN: Status
117 * 117 *
118 * DESCRIPTION: Do any prep work for region handling 118 * DESCRIPTION: Setup a IO operation region
119 * 119 *
120 ******************************************************************************/ 120 ******************************************************************************/
121 121
@@ -144,14 +144,14 @@ acpi_ev_io_space_region_setup (
144 * 144 *
145 * FUNCTION: acpi_ev_pci_config_region_setup 145 * FUNCTION: acpi_ev_pci_config_region_setup
146 * 146 *
147 * PARAMETERS: Handle - Region we are interested in 147 * PARAMETERS: Handle - Region we are interested in
148 * Function - Start or stop 148 * Function - Start or stop
149 * handler_context - Address space handler context 149 * handler_context - Address space handler context
150 * region_context - Region specific context 150 * region_context - Region specific context
151 * 151 *
152 * RETURN: Status 152 * RETURN: Status
153 * 153 *
154 * DESCRIPTION: Do any prep work for region handling 154 * DESCRIPTION: Setup a PCI_Config operation region
155 * 155 *
156 * MUTEX: Assumes namespace is not locked 156 * MUTEX: Assumes namespace is not locked
157 * 157 *
@@ -324,7 +324,7 @@ acpi_ev_pci_config_region_setup (
324 * 324 *
325 * RETURN: Status 325 * RETURN: Status
326 * 326 *
327 * DESCRIPTION: Do any prep work for region handling 327 * DESCRIPTION: Setup a pci_bAR operation region
328 * 328 *
329 * MUTEX: Assumes namespace is not locked 329 * MUTEX: Assumes namespace is not locked
330 * 330 *
@@ -355,7 +355,7 @@ acpi_ev_pci_bar_region_setup (
355 * 355 *
356 * RETURN: Status 356 * RETURN: Status
357 * 357 *
358 * DESCRIPTION: Do any prep work for region handling 358 * DESCRIPTION: Setup a CMOS operation region
359 * 359 *
360 * MUTEX: Assumes namespace is not locked 360 * MUTEX: Assumes namespace is not locked
361 * 361 *
@@ -386,7 +386,7 @@ acpi_ev_cmos_region_setup (
386 * 386 *
387 * RETURN: Status 387 * RETURN: Status
388 * 388 *
389 * DESCRIPTION: Do any prep work for region handling 389 * DESCRIPTION: Default region initialization
390 * 390 *
391 ******************************************************************************/ 391 ******************************************************************************/
392 392
diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c
index 46b31995c827..f3123c26ae98 100644
--- a/drivers/acpi/events/evsci.c
+++ b/drivers/acpi/events/evsci.c
@@ -49,6 +49,12 @@
49#define _COMPONENT ACPI_EVENTS 49#define _COMPONENT ACPI_EVENTS
50 ACPI_MODULE_NAME ("evsci") 50 ACPI_MODULE_NAME ("evsci")
51 51
52/* Local prototypes */
53
54static u32 ACPI_SYSTEM_XFACE
55acpi_ev_sci_xrupt_handler (
56 void *context);
57
52 58
53/******************************************************************************* 59/*******************************************************************************
54 * 60 *
@@ -146,7 +152,8 @@ acpi_ev_gpe_xrupt_handler (
146 ******************************************************************************/ 152 ******************************************************************************/
147 153
148u32 154u32
149acpi_ev_install_sci_handler (void) 155acpi_ev_install_sci_handler (
156 void)
150{ 157{
151 u32 status = AE_OK; 158 u32 status = AE_OK;
152 159
@@ -180,7 +187,8 @@ acpi_ev_install_sci_handler (void)
180 ******************************************************************************/ 187 ******************************************************************************/
181 188
182acpi_status 189acpi_status
183acpi_ev_remove_sci_handler (void) 190acpi_ev_remove_sci_handler (
191 void)
184{ 192{
185 acpi_status status; 193 acpi_status status;
186 194
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
index 0bfec10a5f1e..4092d47f6758 100644
--- a/drivers/acpi/events/evxface.c
+++ b/drivers/acpi/events/evxface.c
@@ -64,6 +64,7 @@
64 * DESCRIPTION: Saves the pointer to the handler function 64 * DESCRIPTION: Saves the pointer to the handler function
65 * 65 *
66 ******************************************************************************/ 66 ******************************************************************************/
67
67#ifdef ACPI_FUTURE_USAGE 68#ifdef ACPI_FUTURE_USAGE
68acpi_status 69acpi_status
69acpi_install_exception_handler ( 70acpi_install_exception_handler (
@@ -457,7 +458,8 @@ acpi_remove_notify_handler (
457 /* Root Object */ 458 /* Root Object */
458 459
459 if (device == ACPI_ROOT_OBJECT) { 460 if (device == ACPI_ROOT_OBJECT) {
460 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n")); 461 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
462 "Removing notify handler for ROOT object.\n"));
461 463
462 if (((handler_type & ACPI_SYSTEM_NOTIFY) && 464 if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
463 !acpi_gbl_system_notify.handler) || 465 !acpi_gbl_system_notify.handler) ||
@@ -564,8 +566,9 @@ EXPORT_SYMBOL(acpi_remove_notify_handler);
564 * 566 *
565 * FUNCTION: acpi_install_gpe_handler 567 * FUNCTION: acpi_install_gpe_handler
566 * 568 *
567 * PARAMETERS: gpe_number - The GPE number within the GPE block 569 * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT
568 * gpe_block - GPE block (NULL == FADT GPEs) 570 * defined GPEs)
571 * gpe_number - The GPE number within the GPE block
569 * Type - Whether this GPE should be treated as an 572 * Type - Whether this GPE should be treated as an
570 * edge- or level-triggered interrupt. 573 * edge- or level-triggered interrupt.
571 * Address - Address of the handler 574 * Address - Address of the handler
@@ -662,8 +665,9 @@ EXPORT_SYMBOL(acpi_install_gpe_handler);
662 * 665 *
663 * FUNCTION: acpi_remove_gpe_handler 666 * FUNCTION: acpi_remove_gpe_handler
664 * 667 *
665 * PARAMETERS: gpe_number - The event to remove a handler 668 * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT
666 * gpe_block - GPE block (NULL == FADT GPEs) 669 * defined GPEs)
670 * gpe_number - The event to remove a handler
667 * Address - Address of the handler 671 * Address - Address of the handler
668 * 672 *
669 * RETURN: Status 673 * RETURN: Status
@@ -766,7 +770,8 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler);
766 * FUNCTION: acpi_acquire_global_lock 770 * FUNCTION: acpi_acquire_global_lock
767 * 771 *
768 * PARAMETERS: Timeout - How long the caller is willing to wait 772 * PARAMETERS: Timeout - How long the caller is willing to wait
769 * out_handle - A handle to the lock if acquired 773 * Handle - Where the handle to the lock is returned
774 * (if acquired)
770 * 775 *
771 * RETURN: Status 776 * RETURN: Status
772 * 777 *
@@ -812,7 +817,7 @@ EXPORT_SYMBOL(acpi_acquire_global_lock);
812 * 817 *
813 * RETURN: Status 818 * RETURN: Status
814 * 819 *
815 * DESCRIPTION: Release the ACPI Global Lock 820 * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid.
816 * 821 *
817 ******************************************************************************/ 822 ******************************************************************************/
818 823
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c
index fa8d5f25be62..f337dc2cc569 100644
--- a/drivers/acpi/events/evxfevnt.c
+++ b/drivers/acpi/events/evxfevnt.c
@@ -64,7 +64,8 @@
64 ******************************************************************************/ 64 ******************************************************************************/
65 65
66acpi_status 66acpi_status
67acpi_enable (void) 67acpi_enable (
68 void)
68{ 69{
69 acpi_status status = AE_OK; 70 acpi_status status = AE_OK;
70 71
@@ -91,7 +92,8 @@ acpi_enable (void)
91 return_ACPI_STATUS (status); 92 return_ACPI_STATUS (status);
92 } 93 }
93 94
94 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Transition to ACPI mode successful\n")); 95 ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
96 "Transition to ACPI mode successful\n"));
95 } 97 }
96 98
97 return_ACPI_STATUS (status); 99 return_ACPI_STATUS (status);
@@ -106,12 +108,13 @@ acpi_enable (void)
106 * 108 *
107 * RETURN: Status 109 * RETURN: Status
108 * 110 *
109 * DESCRIPTION: Transfers the system into LEGACY mode. 111 * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
110 * 112 *
111 ******************************************************************************/ 113 ******************************************************************************/
112 114
113acpi_status 115acpi_status
114acpi_disable (void) 116acpi_disable (
117 void)
115{ 118{
116 acpi_status status = AE_OK; 119 acpi_status status = AE_OK;
117 120
@@ -125,7 +128,8 @@ acpi_disable (void)
125 } 128 }
126 129
127 if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { 130 if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
128 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in legacy (non-ACPI) mode\n")); 131 ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
132 "System is already in legacy (non-ACPI) mode\n"));
129 } 133 }
130 else { 134 else {
131 /* Transition to LEGACY mode */ 135 /* Transition to LEGACY mode */
@@ -133,7 +137,8 @@ acpi_disable (void)
133 status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY); 137 status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY);
134 138
135 if (ACPI_FAILURE (status)) { 139 if (ACPI_FAILURE (status)) {
136 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not exit ACPI mode to legacy mode")); 140 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
141 "Could not exit ACPI mode to legacy mode"));
137 return_ACPI_STATUS (status); 142 return_ACPI_STATUS (status);
138 } 143 }
139 144
@@ -214,7 +219,7 @@ EXPORT_SYMBOL(acpi_enable_event);
214 * 219 *
215 * RETURN: Status 220 * RETURN: Status
216 * 221 *
217 * DESCRIPTION: Enable an ACPI event (general purpose) 222 * DESCRIPTION: Set the type of an individual GPE
218 * 223 *
219 ******************************************************************************/ 224 ******************************************************************************/
220 225
@@ -519,13 +524,12 @@ unlock_and_exit:
519 524
520 525
521#ifdef ACPI_FUTURE_USAGE 526#ifdef ACPI_FUTURE_USAGE
522
523/******************************************************************************* 527/*******************************************************************************
524 * 528 *
525 * FUNCTION: acpi_get_event_status 529 * FUNCTION: acpi_get_event_status
526 * 530 *
527 * PARAMETERS: Event - The fixed event 531 * PARAMETERS: Event - The fixed event
528 * Event Status - Where the current status of the event will 532 * event_status - Where the current status of the event will
529 * be returned 533 * be returned
530 * 534 *
531 * RETURN: Status 535 * RETURN: Status
@@ -571,7 +575,7 @@ acpi_get_event_status (
571 * PARAMETERS: gpe_device - Parent GPE Device 575 * PARAMETERS: gpe_device - Parent GPE Device
572 * gpe_number - GPE level within the GPE block 576 * gpe_number - GPE level within the GPE block
573 * Flags - Called from an ISR or not 577 * Flags - Called from an ISR or not
574 * Event Status - Where the current status of the event will 578 * event_status - Where the current status of the event will
575 * be returned 579 * be returned
576 * 580 *
577 * RETURN: Status 581 * RETURN: Status
@@ -775,4 +779,5 @@ unlock_and_exit:
775 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); 779 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
776 return_ACPI_STATUS (status); 780 return_ACPI_STATUS (status);
777} 781}
782
778EXPORT_SYMBOL(acpi_remove_gpe_block); 783EXPORT_SYMBOL(acpi_remove_gpe_block);
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c
index ac3c061967f2..734b2f24af48 100644
--- a/drivers/acpi/executer/exconfig.c
+++ b/drivers/acpi/executer/exconfig.c
@@ -54,6 +54,14 @@
54#define _COMPONENT ACPI_EXECUTER 54#define _COMPONENT ACPI_EXECUTER
55 ACPI_MODULE_NAME ("exconfig") 55 ACPI_MODULE_NAME ("exconfig")
56 56
57/* Local prototypes */
58
59static acpi_status
60acpi_ex_add_table (
61 struct acpi_table_header *table,
62 struct acpi_namespace_node *parent_node,
63 union acpi_operand_object **ddb_handle);
64
57 65
58/******************************************************************************* 66/*******************************************************************************
59 * 67 *
@@ -70,7 +78,7 @@
70 * 78 *
71 ******************************************************************************/ 79 ******************************************************************************/
72 80
73acpi_status 81static acpi_status
74acpi_ex_add_table ( 82acpi_ex_add_table (
75 struct acpi_table_header *table, 83 struct acpi_table_header *table,
76 struct acpi_namespace_node *parent_node, 84 struct acpi_namespace_node *parent_node,
@@ -95,10 +103,10 @@ acpi_ex_add_table (
95 103
96 ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc)); 104 ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc));
97 105
98 table_info.type = ACPI_TABLE_SSDT; 106 table_info.type = ACPI_TABLE_SSDT;
99 table_info.pointer = table; 107 table_info.pointer = table;
100 table_info.length = (acpi_size) table->length; 108 table_info.length = (acpi_size) table->length;
101 table_info.allocation = ACPI_MEM_ALLOCATED; 109 table_info.allocation = ACPI_MEM_ALLOCATED;
102 110
103 status = acpi_tb_install_table (&table_info); 111 status = acpi_tb_install_table (&table_info);
104 if (ACPI_FAILURE (status)) { 112 if (ACPI_FAILURE (status)) {
@@ -226,11 +234,10 @@ acpi_ex_load_table_op (
226 start_node = parent_node; 234 start_node = parent_node;
227 } 235 }
228 236
229 /* 237 /* Find the node referenced by the parameter_path_string */
230 * Find the node referenced by the parameter_path_string 238
231 */
232 status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node, 239 status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node,
233 ACPI_NS_SEARCH_PARENT, &parameter_node); 240 ACPI_NS_SEARCH_PARENT, &parameter_node);
234 if (ACPI_FAILURE (status)) { 241 if (ACPI_FAILURE (status)) {
235 return_ACPI_STATUS (status); 242 return_ACPI_STATUS (status);
236 } 243 }
@@ -248,7 +255,8 @@ acpi_ex_load_table_op (
248 if (parameter_node) { 255 if (parameter_node) {
249 /* Store the parameter data into the optional parameter object */ 256 /* Store the parameter data into the optional parameter object */
250 257
251 status = acpi_ex_store (operand[5], ACPI_CAST_PTR (union acpi_operand_object, parameter_node), 258 status = acpi_ex_store (operand[5],
259 ACPI_CAST_PTR (union acpi_operand_object, parameter_node),
252 walk_state); 260 walk_state);
253 if (ACPI_FAILURE (status)) { 261 if (ACPI_FAILURE (status)) {
254 (void) acpi_ex_unload_table (ddb_handle); 262 (void) acpi_ex_unload_table (ddb_handle);
@@ -371,7 +379,8 @@ acpi_ex_load_op (
371 goto cleanup; 379 goto cleanup;
372 } 380 }
373 381
374 table_ptr = ACPI_CAST_PTR (struct acpi_table_header, buffer_desc->buffer.pointer); 382 table_ptr = ACPI_CAST_PTR (struct acpi_table_header,
383 buffer_desc->buffer.pointer);
375 384
376 /* Sanity check the table length */ 385 /* Sanity check the table length */
377 386
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c
index df7ba1219bf6..97856c48bd74 100644
--- a/drivers/acpi/executer/exconvrt.c
+++ b/drivers/acpi/executer/exconvrt.c
@@ -50,6 +50,15 @@
50#define _COMPONENT ACPI_EXECUTER 50#define _COMPONENT ACPI_EXECUTER
51 ACPI_MODULE_NAME ("exconvrt") 51 ACPI_MODULE_NAME ("exconvrt")
52 52
53/* Local prototypes */
54
55static u32
56acpi_ex_convert_to_ascii (
57 acpi_integer integer,
58 u16 base,
59 u8 *string,
60 u8 max_length);
61
53 62
54/******************************************************************************* 63/*******************************************************************************
55 * 64 *
@@ -115,9 +124,8 @@ acpi_ex_convert_to_integer (
115 */ 124 */
116 result = 0; 125 result = 0;
117 126
118 /* 127 /* String conversion is different than Buffer conversion */
119 * String conversion is different than Buffer conversion 128
120 */
121 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { 129 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
122 case ACPI_TYPE_STRING: 130 case ACPI_TYPE_STRING:
123 131
@@ -168,9 +176,8 @@ acpi_ex_convert_to_integer (
168 break; 176 break;
169 } 177 }
170 178
171 /* 179 /* Create a new integer */
172 * Create a new integer 180
173 */
174 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 181 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
175 if (!return_desc) { 182 if (!return_desc) {
176 return_ACPI_STATUS (AE_NO_MEMORY); 183 return_ACPI_STATUS (AE_NO_MEMORY);
@@ -251,7 +258,8 @@ acpi_ex_convert_to_buffer (
251 * ASL/AML code that depends on the null being transferred to the new 258 * ASL/AML code that depends on the null being transferred to the new
252 * buffer. 259 * buffer.
253 */ 260 */
254 return_desc = acpi_ut_create_buffer_object ((acpi_size) obj_desc->string.length + 1); 261 return_desc = acpi_ut_create_buffer_object (
262 (acpi_size) obj_desc->string.length + 1);
255 if (!return_desc) { 263 if (!return_desc) {
256 return_ACPI_STATUS (AE_NO_MEMORY); 264 return_ACPI_STATUS (AE_NO_MEMORY);
257 } 265 }
@@ -291,7 +299,7 @@ acpi_ex_convert_to_buffer (
291 * 299 *
292 ******************************************************************************/ 300 ******************************************************************************/
293 301
294u32 302static u32
295acpi_ex_convert_to_ascii ( 303acpi_ex_convert_to_ascii (
296 acpi_integer integer, 304 acpi_integer integer,
297 u16 base, 305 u16 base,
@@ -357,8 +365,9 @@ acpi_ex_convert_to_ascii (
357 365
358 case 16: 366 case 16:
359 367
360 hex_length = ACPI_MUL_2 (data_width); /* 2 ascii hex chars per data byte */ 368 /* hex_length: 2 ascii hex chars per data byte */
361 369
370 hex_length = ACPI_MUL_2 (data_width);
362 for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) { 371 for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) {
363 /* Get one hex digit, most significant digits first */ 372 /* Get one hex digit, most significant digits first */
364 373
@@ -475,7 +484,7 @@ acpi_ex_convert_to_string (
475 /* Setup string length, base, and separator */ 484 /* Setup string length, base, and separator */
476 485
477 switch (type) { 486 switch (type) {
478 case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string operator */ 487 case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */
479 /* 488 /*
480 * From ACPI: "If Data is a buffer, it is converted to a string of 489 * From ACPI: "If Data is a buffer, it is converted to a string of
481 * decimal values separated by commas." 490 * decimal values separated by commas."
@@ -509,7 +518,7 @@ acpi_ex_convert_to_string (
509 string_length = (obj_desc->buffer.length * 3); 518 string_length = (obj_desc->buffer.length * 3);
510 break; 519 break;
511 520
512 case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string operator */ 521 case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */
513 /* 522 /*
514 * From ACPI: "If Data is a buffer, it is converted to a string of 523 * From ACPI: "If Data is a buffer, it is converted to a string of
515 * hexadecimal values separated by commas." 524 * hexadecimal values separated by commas."
@@ -530,9 +539,8 @@ acpi_ex_convert_to_string (
530 return_ACPI_STATUS (AE_AML_STRING_LIMIT); 539 return_ACPI_STATUS (AE_AML_STRING_LIMIT);
531 } 540 }
532 541
533 /* 542 /* Create a new string object and string buffer */
534 * Create a new string object and string buffer 543
535 */
536 return_desc = acpi_ut_create_string_object ((acpi_size) string_length); 544 return_desc = acpi_ut_create_string_object ((acpi_size) string_length);
537 if (!return_desc) { 545 if (!return_desc) {
538 return_ACPI_STATUS (AE_NO_MEMORY); 546 return_ACPI_STATUS (AE_NO_MEMORY);
@@ -551,8 +559,10 @@ acpi_ex_convert_to_string (
551 *new_buf++ = separator; /* each separated by a comma or space */ 559 *new_buf++ = separator; /* each separated by a comma or space */
552 } 560 }
553 561
554 /* Null terminate the string (overwrites final comma/space from above) */ 562 /*
555 563 * Null terminate the string
564 * (overwrites final comma/space from above)
565 */
556 new_buf--; 566 new_buf--;
557 *new_buf = 0; 567 *new_buf = 0;
558 break; 568 break;
@@ -645,7 +655,6 @@ acpi_ex_convert_to_target_type (
645 655
646 656
647 case ACPI_TYPE_STRING: 657 case ACPI_TYPE_STRING:
648
649 /* 658 /*
650 * The operand must be a String. We can convert an 659 * The operand must be a String. We can convert an
651 * Integer or Buffer if necessary 660 * Integer or Buffer if necessary
@@ -656,7 +665,6 @@ acpi_ex_convert_to_target_type (
656 665
657 666
658 case ACPI_TYPE_BUFFER: 667 case ACPI_TYPE_BUFFER:
659
660 /* 668 /*
661 * The operand must be a Buffer. We can convert an 669 * The operand must be a Buffer. We can convert an
662 * Integer or String if necessary 670 * Integer or String if necessary
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c
index d94c260dac6d..812cdcb2e370 100644
--- a/drivers/acpi/executer/excreate.c
+++ b/drivers/acpi/executer/excreate.c
@@ -55,7 +55,7 @@
55 55
56 56
57#ifndef ACPI_NO_METHOD_EXECUTION 57#ifndef ACPI_NO_METHOD_EXECUTION
58/***************************************************************************** 58/*******************************************************************************
59 * 59 *
60 * FUNCTION: acpi_ex_create_alias 60 * FUNCTION: acpi_ex_create_alias
61 * 61 *
@@ -65,7 +65,7 @@
65 * 65 *
66 * DESCRIPTION: Create a new named alias 66 * DESCRIPTION: Create a new named alias
67 * 67 *
68 ****************************************************************************/ 68 ******************************************************************************/
69 69
70acpi_status 70acpi_status
71acpi_ex_create_alias ( 71acpi_ex_create_alias (
@@ -140,8 +140,7 @@ acpi_ex_create_alias (
140 * target node or the alias Node 140 * target node or the alias Node
141 */ 141 */
142 status = acpi_ns_attach_object (alias_node, 142 status = acpi_ns_attach_object (alias_node,
143 acpi_ns_get_attached_object (target_node), 143 acpi_ns_get_attached_object (target_node), target_node->type);
144 target_node->type);
145 break; 144 break;
146 } 145 }
147 146
@@ -151,7 +150,7 @@ acpi_ex_create_alias (
151} 150}
152 151
153 152
154/***************************************************************************** 153/*******************************************************************************
155 * 154 *
156 * FUNCTION: acpi_ex_create_event 155 * FUNCTION: acpi_ex_create_event
157 * 156 *
@@ -161,7 +160,7 @@ acpi_ex_create_alias (
161 * 160 *
162 * DESCRIPTION: Create a new event object 161 * DESCRIPTION: Create a new event object
163 * 162 *
164 ****************************************************************************/ 163 ******************************************************************************/
165 164
166acpi_status 165acpi_status
167acpi_ex_create_event ( 166acpi_ex_create_event (
@@ -185,7 +184,7 @@ acpi_ex_create_event (
185 * that the event is created in an unsignalled state 184 * that the event is created in an unsignalled state
186 */ 185 */
187 status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, 186 status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0,
188 &obj_desc->event.semaphore); 187 &obj_desc->event.semaphore);
189 if (ACPI_FAILURE (status)) { 188 if (ACPI_FAILURE (status)) {
190 goto cleanup; 189 goto cleanup;
191 } 190 }
@@ -193,7 +192,7 @@ acpi_ex_create_event (
193 /* Attach object to the Node */ 192 /* Attach object to the Node */
194 193
195 status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0], 194 status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0],
196 obj_desc, ACPI_TYPE_EVENT); 195 obj_desc, ACPI_TYPE_EVENT);
197 196
198cleanup: 197cleanup:
199 /* 198 /*
@@ -205,7 +204,7 @@ cleanup:
205} 204}
206 205
207 206
208/***************************************************************************** 207/*******************************************************************************
209 * 208 *
210 * FUNCTION: acpi_ex_create_mutex 209 * FUNCTION: acpi_ex_create_mutex
211 * 210 *
@@ -217,7 +216,7 @@ cleanup:
217 * 216 *
218 * Mutex (Name[0], sync_level[1]) 217 * Mutex (Name[0], sync_level[1])
219 * 218 *
220 ****************************************************************************/ 219 ******************************************************************************/
221 220
222acpi_status 221acpi_status
223acpi_ex_create_mutex ( 222acpi_ex_create_mutex (
@@ -267,20 +266,20 @@ cleanup:
267} 266}
268 267
269 268
270/***************************************************************************** 269/*******************************************************************************
271 * 270 *
272 * FUNCTION: acpi_ex_create_region 271 * FUNCTION: acpi_ex_create_region
273 * 272 *
274 * PARAMETERS: aml_start - Pointer to the region declaration AML 273 * PARAMETERS: aml_start - Pointer to the region declaration AML
275 * aml_length - Max length of the declaration AML 274 * aml_length - Max length of the declaration AML
276 * Operands - List of operands for the opcode 275 * region_space - space_iD for the region
277 * walk_state - Current state 276 * walk_state - Current state
278 * 277 *
279 * RETURN: Status 278 * RETURN: Status
280 * 279 *
281 * DESCRIPTION: Create a new operation region object 280 * DESCRIPTION: Create a new operation region object
282 * 281 *
283 ****************************************************************************/ 282 ******************************************************************************/
284 283
285acpi_status 284acpi_status
286acpi_ex_create_region ( 285acpi_ex_create_region (
@@ -321,7 +320,7 @@ acpi_ex_create_region (
321 } 320 }
322 321
323 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", 322 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
324 acpi_ut_get_region_name (region_space), region_space)); 323 acpi_ut_get_region_name (region_space), region_space));
325 324
326 /* Create the region descriptor */ 325 /* Create the region descriptor */
327 326
@@ -360,7 +359,7 @@ cleanup:
360} 359}
361 360
362 361
363/***************************************************************************** 362/*******************************************************************************
364 * 363 *
365 * FUNCTION: acpi_ex_create_table_region 364 * FUNCTION: acpi_ex_create_table_region
366 * 365 *
@@ -370,7 +369,7 @@ cleanup:
370 * 369 *
371 * DESCRIPTION: Create a new data_table_region object 370 * DESCRIPTION: Create a new data_table_region object
372 * 371 *
373 ****************************************************************************/ 372 ******************************************************************************/
374 373
375acpi_status 374acpi_status
376acpi_ex_create_table_region ( 375acpi_ex_create_table_region (
@@ -455,7 +454,7 @@ cleanup:
455} 454}
456 455
457 456
458/***************************************************************************** 457/*******************************************************************************
459 * 458 *
460 * FUNCTION: acpi_ex_create_processor 459 * FUNCTION: acpi_ex_create_processor
461 * 460 *
@@ -467,7 +466,7 @@ cleanup:
467 * 466 *
468 * Processor (Name[0], cpu_iD[1], pblock_addr[2], pblock_length[3]) 467 * Processor (Name[0], cpu_iD[1], pblock_addr[2], pblock_length[3])
469 * 468 *
470 ****************************************************************************/ 469 ******************************************************************************/
471 470
472acpi_status 471acpi_status
473acpi_ex_create_processor ( 472acpi_ex_create_processor (
@@ -488,9 +487,8 @@ acpi_ex_create_processor (
488 return_ACPI_STATUS (AE_NO_MEMORY); 487 return_ACPI_STATUS (AE_NO_MEMORY);
489 } 488 }
490 489
491 /* 490 /* Initialize the processor object from the operands */
492 * Initialize the processor object from the operands 491
493 */
494 obj_desc->processor.proc_id = (u8) operand[1]->integer.value; 492 obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
495 obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value; 493 obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value;
496 obj_desc->processor.length = (u8) operand[3]->integer.value; 494 obj_desc->processor.length = (u8) operand[3]->integer.value;
@@ -507,7 +505,7 @@ acpi_ex_create_processor (
507} 505}
508 506
509 507
510/***************************************************************************** 508/*******************************************************************************
511 * 509 *
512 * FUNCTION: acpi_ex_create_power_resource 510 * FUNCTION: acpi_ex_create_power_resource
513 * 511 *
@@ -519,7 +517,7 @@ acpi_ex_create_processor (
519 * 517 *
520 * power_resource (Name[0], system_level[1], resource_order[2]) 518 * power_resource (Name[0], system_level[1], resource_order[2])
521 * 519 *
522 ****************************************************************************/ 520 ******************************************************************************/
523 521
524acpi_status 522acpi_status
525acpi_ex_create_power_resource ( 523acpi_ex_create_power_resource (
@@ -555,10 +553,10 @@ acpi_ex_create_power_resource (
555 acpi_ut_remove_reference (obj_desc); 553 acpi_ut_remove_reference (obj_desc);
556 return_ACPI_STATUS (status); 554 return_ACPI_STATUS (status);
557} 555}
558
559#endif 556#endif
560 557
561/***************************************************************************** 558
559/*******************************************************************************
562 * 560 *
563 * FUNCTION: acpi_ex_create_method 561 * FUNCTION: acpi_ex_create_method
564 * 562 *
@@ -570,7 +568,7 @@ acpi_ex_create_power_resource (
570 * 568 *
571 * DESCRIPTION: Create a new method object 569 * DESCRIPTION: Create a new method object
572 * 570 *
573 ****************************************************************************/ 571 ******************************************************************************/
574 572
575acpi_status 573acpi_status
576acpi_ex_create_method ( 574acpi_ex_create_method (
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c
index e2f7c32f28de..408500648114 100644
--- a/drivers/acpi/executer/exdump.c
+++ b/drivers/acpi/executer/exdump.c
@@ -51,23 +51,48 @@
51#define _COMPONENT ACPI_EXECUTER 51#define _COMPONENT ACPI_EXECUTER
52 ACPI_MODULE_NAME ("exdump") 52 ACPI_MODULE_NAME ("exdump")
53 53
54/* Local prototypes */
55
56#ifdef ACPI_FUTURE_USAGE
57static void
58acpi_ex_out_string (
59 char *title,
60 char *value);
61
62static void
63acpi_ex_out_pointer (
64 char *title,
65 void *value);
66
67static void
68acpi_ex_out_integer (
69 char *title,
70 u32 value);
71
72static void
73acpi_ex_out_address (
74 char *title,
75 acpi_physical_address value);
76#endif /* ACPI_FUTURE_USAGE */
77
54 78
55/* 79/*
56 * The following routines are used for debug output only 80 * The following routines are used for debug output only
57 */ 81 */
58#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 82#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
59 83
60/***************************************************************************** 84/*******************************************************************************
61 * 85 *
62 * FUNCTION: acpi_ex_dump_operand 86 * FUNCTION: acpi_ex_dump_operand
63 * 87 *
64 * PARAMETERS: *obj_desc - Pointer to entry to be dumped 88 * PARAMETERS: *obj_desc - Pointer to entry to be dumped
89 * Depth - Current nesting depth
65 * 90 *
66 * RETURN: None 91 * RETURN: None
67 * 92 *
68 * DESCRIPTION: Dump an operand object 93 * DESCRIPTION: Dump an operand object
69 * 94 *
70 ****************************************************************************/ 95 ******************************************************************************/
71 96
72void 97void
73acpi_ex_dump_operand ( 98acpi_ex_dump_operand (
@@ -86,9 +111,8 @@ acpi_ex_dump_operand (
86 } 111 }
87 112
88 if (!obj_desc) { 113 if (!obj_desc) {
89 /* 114 /* This could be a null element of a package */
90 * This could be a null element of a package 115
91 */
92 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); 116 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
93 return; 117 return;
94 } 118 }
@@ -117,6 +141,8 @@ acpi_ex_dump_operand (
117 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc)); 141 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc));
118 } 142 }
119 143
144 /* Decode object type */
145
120 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { 146 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
121 case ACPI_TYPE_LOCAL_REFERENCE: 147 case ACPI_TYPE_LOCAL_REFERENCE:
122 148
@@ -274,7 +300,9 @@ acpi_ex_dump_operand (
274 case ACPI_TYPE_STRING: 300 case ACPI_TYPE_STRING:
275 301
276 acpi_os_printf ("String length %X @ %p ", 302 acpi_os_printf ("String length %X @ %p ",
277 obj_desc->string.length, obj_desc->string.pointer); 303 obj_desc->string.length,
304 obj_desc->string.pointer);
305
278 acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX); 306 acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX);
279 acpi_os_printf ("\n"); 307 acpi_os_printf ("\n");
280 break; 308 break;
@@ -290,10 +318,13 @@ acpi_ex_dump_operand (
290 318
291 acpi_os_printf ( 319 acpi_os_printf (
292 "region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", 320 "region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
293 obj_desc->field.bit_length, obj_desc->field.access_byte_width, 321 obj_desc->field.bit_length,
322 obj_desc->field.access_byte_width,
294 obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, 323 obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
295 obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK, 324 obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK,
296 obj_desc->field.base_byte_offset, obj_desc->field.start_field_bit_offset); 325 obj_desc->field.base_byte_offset,
326 obj_desc->field.start_field_bit_offset);
327
297 acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1); 328 acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1);
298 break; 329 break;
299 330
@@ -308,13 +339,15 @@ acpi_ex_dump_operand (
308 339
309 acpi_os_printf ( 340 acpi_os_printf (
310 "buffer_field: %X bits at byte %X bit %X of \n", 341 "buffer_field: %X bits at byte %X bit %X of \n",
311 obj_desc->buffer_field.bit_length, obj_desc->buffer_field.base_byte_offset, 342 obj_desc->buffer_field.bit_length,
343 obj_desc->buffer_field.base_byte_offset,
312 obj_desc->buffer_field.start_field_bit_offset); 344 obj_desc->buffer_field.start_field_bit_offset);
313 345
314 if (!obj_desc->buffer_field.buffer_obj) { 346 if (!obj_desc->buffer_field.buffer_obj) {
315 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n")); 347 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n"));
316 } 348 }
317 else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) != ACPI_TYPE_BUFFER) { 349 else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) !=
350 ACPI_TYPE_BUFFER) {
318 acpi_os_printf ("*not a Buffer* \n"); 351 acpi_os_printf ("*not a Buffer* \n");
319 } 352 }
320 else { 353 else {
@@ -331,10 +364,10 @@ acpi_ex_dump_operand (
331 364
332 case ACPI_TYPE_METHOD: 365 case ACPI_TYPE_METHOD:
333 366
334 acpi_os_printf ( 367 acpi_os_printf ("Method(%X) @ %p:%X\n",
335 "Method(%X) @ %p:%X\n",
336 obj_desc->method.param_count, 368 obj_desc->method.param_count,
337 obj_desc->method.aml_start, obj_desc->method.aml_length); 369 obj_desc->method.aml_start,
370 obj_desc->method.aml_length);
338 break; 371 break;
339 372
340 373
@@ -379,7 +412,7 @@ acpi_ex_dump_operand (
379} 412}
380 413
381 414
382/***************************************************************************** 415/*******************************************************************************
383 * 416 *
384 * FUNCTION: acpi_ex_dump_operands 417 * FUNCTION: acpi_ex_dump_operands
385 * 418 *
@@ -393,7 +426,7 @@ acpi_ex_dump_operand (
393 * 426 *
394 * DESCRIPTION: Dump the object stack 427 * DESCRIPTION: Dump the object stack
395 * 428 *
396 ****************************************************************************/ 429 ******************************************************************************/
397 430
398void 431void
399acpi_ex_dump_operands ( 432acpi_ex_dump_operands (
@@ -441,10 +474,9 @@ acpi_ex_dump_operands (
441 474
442 475
443#ifdef ACPI_FUTURE_USAGE 476#ifdef ACPI_FUTURE_USAGE
444 477/*******************************************************************************
445/*****************************************************************************
446 * 478 *
447 * FUNCTION: acpi_ex_out* 479 * FUNCTION: acpi_ex_out* functions
448 * 480 *
449 * PARAMETERS: Title - Descriptive text 481 * PARAMETERS: Title - Descriptive text
450 * Value - Value to be displayed 482 * Value - Value to be displayed
@@ -453,9 +485,9 @@ acpi_ex_dump_operands (
453 * reduce the number of format strings required and keeps them 485 * reduce the number of format strings required and keeps them
454 * all in one place for easy modification. 486 * all in one place for easy modification.
455 * 487 *
456 ****************************************************************************/ 488 ******************************************************************************/
457 489
458void 490static void
459acpi_ex_out_string ( 491acpi_ex_out_string (
460 char *title, 492 char *title,
461 char *value) 493 char *value)
@@ -463,7 +495,7 @@ acpi_ex_out_string (
463 acpi_os_printf ("%20s : %s\n", title, value); 495 acpi_os_printf ("%20s : %s\n", title, value);
464} 496}
465 497
466void 498static void
467acpi_ex_out_pointer ( 499acpi_ex_out_pointer (
468 char *title, 500 char *title,
469 void *value) 501 void *value)
@@ -471,7 +503,7 @@ acpi_ex_out_pointer (
471 acpi_os_printf ("%20s : %p\n", title, value); 503 acpi_os_printf ("%20s : %p\n", title, value);
472} 504}
473 505
474void 506static void
475acpi_ex_out_integer ( 507acpi_ex_out_integer (
476 char *title, 508 char *title,
477 u32 value) 509 u32 value)
@@ -479,7 +511,7 @@ acpi_ex_out_integer (
479 acpi_os_printf ("%20s : %X\n", title, value); 511 acpi_os_printf ("%20s : %X\n", title, value);
480} 512}
481 513
482void 514static void
483acpi_ex_out_address ( 515acpi_ex_out_address (
484 char *title, 516 char *title,
485 acpi_physical_address value) 517 acpi_physical_address value)
@@ -493,16 +525,16 @@ acpi_ex_out_address (
493} 525}
494 526
495 527
496/***************************************************************************** 528/*******************************************************************************
497 * 529 *
498 * FUNCTION: acpi_ex_dump_node 530 * FUNCTION: acpi_ex_dump_node
499 * 531 *
500 * PARAMETERS: *Node - Descriptor to dump 532 * PARAMETERS: *Node - Descriptor to dump
501 * Flags - Force display 533 * Flags - Force display if TRUE
502 * 534 *
503 * DESCRIPTION: Dumps the members of the given.Node 535 * DESCRIPTION: Dumps the members of the given.Node
504 * 536 *
505 ****************************************************************************/ 537 ******************************************************************************/
506 538
507void 539void
508acpi_ex_dump_node ( 540acpi_ex_dump_node (
@@ -531,16 +563,16 @@ acpi_ex_dump_node (
531} 563}
532 564
533 565
534/***************************************************************************** 566/*******************************************************************************
535 * 567 *
536 * FUNCTION: acpi_ex_dump_object_descriptor 568 * FUNCTION: acpi_ex_dump_object_descriptor
537 * 569 *
538 * PARAMETERS: *Object - Descriptor to dump 570 * PARAMETERS: *Object - Descriptor to dump
539 * Flags - Force display 571 * Flags - Force display if TRUE
540 * 572 *
541 * DESCRIPTION: Dumps the members of the object descriptor given. 573 * DESCRIPTION: Dumps the members of the object descriptor given.
542 * 574 *
543 ****************************************************************************/ 575 ******************************************************************************/
544 576
545void 577void
546acpi_ex_dump_object_descriptor ( 578acpi_ex_dump_object_descriptor (
@@ -553,6 +585,10 @@ acpi_ex_dump_object_descriptor (
553 ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor"); 585 ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor");
554 586
555 587
588 if (!obj_desc) {
589 return_VOID;
590 }
591
556 if (!flags) { 592 if (!flags) {
557 if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) { 593 if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
558 return_VOID; 594 return_VOID;
@@ -747,11 +783,17 @@ acpi_ex_dump_object_descriptor (
747 case ACPI_TYPE_LOCAL_REFERENCE: 783 case ACPI_TYPE_LOCAL_REFERENCE:
748 784
749 acpi_ex_out_integer ("target_type", obj_desc->reference.target_type); 785 acpi_ex_out_integer ("target_type", obj_desc->reference.target_type);
750 acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name); 786 acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info (
787 obj_desc->reference.opcode))->name);
751 acpi_ex_out_integer ("Offset", obj_desc->reference.offset); 788 acpi_ex_out_integer ("Offset", obj_desc->reference.offset);
752 acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object); 789 acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object);
753 acpi_ex_out_pointer ("Node", obj_desc->reference.node); 790 acpi_ex_out_pointer ("Node", obj_desc->reference.node);
754 acpi_ex_out_pointer ("Where", obj_desc->reference.where); 791 acpi_ex_out_pointer ("Where", obj_desc->reference.where);
792
793 if (obj_desc->reference.object) {
794 acpi_os_printf ("\nReferenced Object:\n");
795 acpi_ex_dump_object_descriptor (obj_desc->reference.object, flags);
796 }
755 break; 797 break;
756 798
757 799
@@ -788,6 +830,5 @@ acpi_ex_dump_object_descriptor (
788} 830}
789 831
790#endif /* ACPI_FUTURE_USAGE */ 832#endif /* ACPI_FUTURE_USAGE */
791
792#endif 833#endif
793 834
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c
index be7f2124fa02..22c8fa480f60 100644
--- a/drivers/acpi/executer/exfield.c
+++ b/drivers/acpi/executer/exfield.c
@@ -120,8 +120,8 @@ acpi_ex_read_data_from_field (
120 * Note: Smbus protocol value is passed in upper 16-bits of Function 120 * Note: Smbus protocol value is passed in upper 16-bits of Function
121 */ 121 */
122 status = acpi_ex_access_region (obj_desc, 0, 122 status = acpi_ex_access_region (obj_desc, 0,
123 ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer), 123 ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer),
124 ACPI_READ | (obj_desc->field.attribute << 16)); 124 ACPI_READ | (obj_desc->field.attribute << 16));
125 acpi_ex_release_global_lock (locked); 125 acpi_ex_release_global_lock (locked);
126 goto exit; 126 goto exit;
127 } 127 }
@@ -196,6 +196,7 @@ exit:
196 * 196 *
197 * PARAMETERS: source_desc - Contains data to write 197 * PARAMETERS: source_desc - Contains data to write
198 * obj_desc - The named field 198 * obj_desc - The named field
199 * result_desc - Where the return value is returned, if any
199 * 200 *
200 * RETURN: Status 201 * RETURN: Status
201 * 202 *
@@ -250,12 +251,15 @@ acpi_ex_write_data_to_field (
250 if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) { 251 if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) {
251 ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n", 252 ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n",
252 acpi_ut_get_object_type_name (source_desc))); 253 acpi_ut_get_object_type_name (source_desc)));
254
253 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 255 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
254 } 256 }
255 257
256 if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { 258 if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) {
257 ACPI_REPORT_ERROR (("SMBus write requires Buffer of length %X, found length %X\n", 259 ACPI_REPORT_ERROR ((
260 "SMBus write requires Buffer of length %X, found length %X\n",
258 ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length)); 261 ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length));
262
259 return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); 263 return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
260 } 264 }
261 265
@@ -265,14 +269,16 @@ acpi_ex_write_data_to_field (
265 } 269 }
266 270
267 buffer = buffer_desc->buffer.pointer; 271 buffer = buffer_desc->buffer.pointer;
268 ACPI_MEMCPY (buffer, source_desc->buffer.pointer, ACPI_SMBUS_BUFFER_SIZE); 272 ACPI_MEMCPY (buffer, source_desc->buffer.pointer,
273 ACPI_SMBUS_BUFFER_SIZE);
269 274
270 /* Lock entire transaction if requested */ 275 /* Lock entire transaction if requested */
271 276
272 locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); 277 locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
273 278
274 /* 279 /*
275 * Perform the write (returns status and perhaps data in the same buffer) 280 * Perform the write (returns status and perhaps data in the
281 * same buffer)
276 * Note: SMBus protocol type is passed in upper 16-bits of Function. 282 * Note: SMBus protocol type is passed in upper 16-bits of Function.
277 */ 283 */
278 status = acpi_ex_access_region (obj_desc, 0, 284 status = acpi_ex_access_region (obj_desc, 0,
@@ -284,9 +290,8 @@ acpi_ex_write_data_to_field (
284 return_ACPI_STATUS (status); 290 return_ACPI_STATUS (status);
285 } 291 }
286 292
287 /* 293 /* Get a pointer to the data to be written */
288 * Get a pointer to the data to be written 294
289 */
290 switch (ACPI_GET_OBJECT_TYPE (source_desc)) { 295 switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
291 case ACPI_TYPE_INTEGER: 296 case ACPI_TYPE_INTEGER:
292 buffer = &source_desc->integer.value; 297 buffer = &source_desc->integer.value;
@@ -314,7 +319,8 @@ acpi_ex_write_data_to_field (
314 * the ACPI specification. 319 * the ACPI specification.
315 */ 320 */
316 new_buffer = NULL; 321 new_buffer = NULL;
317 required_length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length); 322 required_length = ACPI_ROUND_BITS_UP_TO_BYTES (
323 obj_desc->common_field.bit_length);
318 324
319 if (length < required_length) { 325 if (length < required_length) {
320 /* We need to create a new buffer */ 326 /* We need to create a new buffer */
@@ -338,6 +344,7 @@ acpi_ex_write_data_to_field (
338 "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", 344 "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
339 source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)), 345 source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)),
340 ACPI_GET_OBJECT_TYPE (source_desc), buffer, length)); 346 ACPI_GET_OBJECT_TYPE (source_desc), buffer, length));
347
341 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 348 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
342 "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", 349 "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
343 obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)), 350 obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)),
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c
index 9d0f9d2e9061..3c2f89e00f78 100644
--- a/drivers/acpi/executer/exfldio.c
+++ b/drivers/acpi/executer/exfldio.c
@@ -52,12 +52,31 @@
52#define _COMPONENT ACPI_EXECUTER 52#define _COMPONENT ACPI_EXECUTER
53 ACPI_MODULE_NAME ("exfldio") 53 ACPI_MODULE_NAME ("exfldio")
54 54
55/* Local prototypes */
56
57static acpi_status
58acpi_ex_field_datum_io (
59 union acpi_operand_object *obj_desc,
60 u32 field_datum_byte_offset,
61 acpi_integer *value,
62 u32 read_write);
63
64static u8
65acpi_ex_register_overflow (
66 union acpi_operand_object *obj_desc,
67 acpi_integer value);
68
69static acpi_status
70acpi_ex_setup_region (
71 union acpi_operand_object *obj_desc,
72 u32 field_datum_byte_offset);
73
55 74
56/******************************************************************************* 75/*******************************************************************************
57 * 76 *
58 * FUNCTION: acpi_ex_setup_region 77 * FUNCTION: acpi_ex_setup_region
59 * 78 *
60 * PARAMETERS: *obj_desc - Field to be read or written 79 * PARAMETERS: obj_desc - Field to be read or written
61 * field_datum_byte_offset - Byte offset of this datum within the 80 * field_datum_byte_offset - Byte offset of this datum within the
62 * parent field 81 * parent field
63 * 82 *
@@ -69,7 +88,7 @@
69 * 88 *
70 ******************************************************************************/ 89 ******************************************************************************/
71 90
72acpi_status 91static acpi_status
73acpi_ex_setup_region ( 92acpi_ex_setup_region (
74 union acpi_operand_object *obj_desc, 93 union acpi_operand_object *obj_desc,
75 u32 field_datum_byte_offset) 94 u32 field_datum_byte_offset)
@@ -127,9 +146,9 @@ acpi_ex_setup_region (
127 * length of one field datum (access width) must fit within the region. 146 * length of one field datum (access width) must fit within the region.
128 * (Region length is specified in bytes) 147 * (Region length is specified in bytes)
129 */ 148 */
130 if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset 149 if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset +
131 + field_datum_byte_offset 150 field_datum_byte_offset +
132 + obj_desc->common_field.access_byte_width)) { 151 obj_desc->common_field.access_byte_width)) {
133 if (acpi_gbl_enable_interpreter_slack) { 152 if (acpi_gbl_enable_interpreter_slack) {
134 /* 153 /*
135 * Slack mode only: We will go ahead and allow access to this 154 * Slack mode only: We will go ahead and allow access to this
@@ -155,7 +174,8 @@ acpi_ex_setup_region (
155 "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", 174 "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
156 acpi_ut_get_node_name (obj_desc->common_field.node), 175 acpi_ut_get_node_name (obj_desc->common_field.node),
157 obj_desc->common_field.access_byte_width, 176 obj_desc->common_field.access_byte_width,
158 acpi_ut_get_node_name (rgn_desc->region.node), rgn_desc->region.length)); 177 acpi_ut_get_node_name (rgn_desc->region.node),
178 rgn_desc->region.length));
159 } 179 }
160 180
161 /* 181 /*
@@ -167,7 +187,8 @@ acpi_ex_setup_region (
167 acpi_ut_get_node_name (obj_desc->common_field.node), 187 acpi_ut_get_node_name (obj_desc->common_field.node),
168 obj_desc->common_field.base_byte_offset, 188 obj_desc->common_field.base_byte_offset,
169 field_datum_byte_offset, obj_desc->common_field.access_byte_width, 189 field_datum_byte_offset, obj_desc->common_field.access_byte_width,
170 acpi_ut_get_node_name (rgn_desc->region.node), rgn_desc->region.length)); 190 acpi_ut_get_node_name (rgn_desc->region.node),
191 rgn_desc->region.length));
171 192
172 return_ACPI_STATUS (AE_AML_REGION_LIMIT); 193 return_ACPI_STATUS (AE_AML_REGION_LIMIT);
173 } 194 }
@@ -180,10 +201,10 @@ acpi_ex_setup_region (
180 * 201 *
181 * FUNCTION: acpi_ex_access_region 202 * FUNCTION: acpi_ex_access_region
182 * 203 *
183 * PARAMETERS: *obj_desc - Field to be read 204 * PARAMETERS: obj_desc - Field to be read
184 * field_datum_byte_offset - Byte offset of this datum within the 205 * field_datum_byte_offset - Byte offset of this datum within the
185 * parent field 206 * parent field
186 * *Value - Where to store value (must at least 207 * Value - Where to store value (must at least
187 * the size of acpi_integer) 208 * the size of acpi_integer)
188 * Function - Read or Write flag plus other region- 209 * Function - Read or Write flag plus other region-
189 * dependent flags 210 * dependent flags
@@ -226,9 +247,9 @@ acpi_ex_access_region (
226 * 3) The current offset into the field 247 * 3) The current offset into the field
227 */ 248 */
228 rgn_desc = obj_desc->common_field.region_obj; 249 rgn_desc = obj_desc->common_field.region_obj;
229 address = rgn_desc->region.address 250 address = rgn_desc->region.address +
230 + obj_desc->common_field.base_byte_offset 251 obj_desc->common_field.base_byte_offset +
231 + field_datum_byte_offset; 252 field_datum_byte_offset;
232 253
233 if ((function & ACPI_IO_MASK) == ACPI_READ) { 254 if ((function & ACPI_IO_MASK) == ACPI_READ) {
234 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]")); 255 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]"));
@@ -249,7 +270,8 @@ acpi_ex_access_region (
249 /* Invoke the appropriate address_space/op_region handler */ 270 /* Invoke the appropriate address_space/op_region handler */
250 271
251 status = acpi_ev_address_space_dispatch (rgn_desc, function, 272 status = acpi_ev_address_space_dispatch (rgn_desc, function,
252 address, ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value); 273 address,
274 ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value);
253 275
254 if (ACPI_FAILURE (status)) { 276 if (ACPI_FAILURE (status)) {
255 if (status == AE_NOT_IMPLEMENTED) { 277 if (status == AE_NOT_IMPLEMENTED) {
@@ -274,7 +296,7 @@ acpi_ex_access_region (
274 * 296 *
275 * FUNCTION: acpi_ex_register_overflow 297 * FUNCTION: acpi_ex_register_overflow
276 * 298 *
277 * PARAMETERS: *obj_desc - Register(Field) to be written 299 * PARAMETERS: obj_desc - Register(Field) to be written
278 * Value - Value to be stored 300 * Value - Value to be stored
279 * 301 *
280 * RETURN: TRUE if value overflows the field, FALSE otherwise 302 * RETURN: TRUE if value overflows the field, FALSE otherwise
@@ -287,7 +309,7 @@ acpi_ex_access_region (
287 * 309 *
288 ******************************************************************************/ 310 ******************************************************************************/
289 311
290u8 312static u8
291acpi_ex_register_overflow ( 313acpi_ex_register_overflow (
292 union acpi_operand_object *obj_desc, 314 union acpi_operand_object *obj_desc,
293 acpi_integer value) 315 acpi_integer value)
@@ -319,10 +341,10 @@ acpi_ex_register_overflow (
319 * 341 *
320 * FUNCTION: acpi_ex_field_datum_io 342 * FUNCTION: acpi_ex_field_datum_io
321 * 343 *
322 * PARAMETERS: *obj_desc - Field to be read 344 * PARAMETERS: obj_desc - Field to be read
323 * field_datum_byte_offset - Byte offset of this datum within the 345 * field_datum_byte_offset - Byte offset of this datum within the
324 * parent field 346 * parent field
325 * *Value - Where to store value (must be 64 bits) 347 * Value - Where to store value (must be 64 bits)
326 * read_write - Read or Write flag 348 * read_write - Read or Write flag
327 * 349 *
328 * RETURN: Status 350 * RETURN: Status
@@ -333,7 +355,7 @@ acpi_ex_register_overflow (
333 * 355 *
334 ******************************************************************************/ 356 ******************************************************************************/
335 357
336acpi_status 358static acpi_status
337acpi_ex_field_datum_io ( 359acpi_ex_field_datum_io (
338 union acpi_operand_object *obj_desc, 360 union acpi_operand_object *obj_desc,
339 u32 field_datum_byte_offset, 361 u32 field_datum_byte_offset,
@@ -350,7 +372,9 @@ acpi_ex_field_datum_io (
350 if (read_write == ACPI_READ) { 372 if (read_write == ACPI_READ) {
351 if (!value) { 373 if (!value) {
352 local_value = 0; 374 local_value = 0;
353 value = &local_value; /* To support reads without saving return value */ 375
376 /* To support reads without saving return value */
377 value = &local_value;
354 } 378 }
355 379
356 /* Clear the entire return buffer first, [Very Important!] */ 380 /* Clear the entire return buffer first, [Very Important!] */
@@ -363,8 +387,10 @@ acpi_ex_field_datum_io (
363 * 387 *
364 * buffer_field - Read/write from/to a Buffer 388 * buffer_field - Read/write from/to a Buffer
365 * region_field - Read/write from/to a Operation Region. 389 * region_field - Read/write from/to a Operation Region.
366 * bank_field - Write to a Bank Register, then read/write from/to an op_region 390 * bank_field - Write to a Bank Register, then read/write from/to an
367 * index_field - Write to an Index Register, then read/write from/to a Data Register 391 * operation_region
392 * index_field - Write to an Index Register, then read/write from/to a
393 * Data Register
368 */ 394 */
369 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { 395 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
370 case ACPI_TYPE_BUFFER_FIELD: 396 case ACPI_TYPE_BUFFER_FIELD:
@@ -384,19 +410,20 @@ acpi_ex_field_datum_io (
384 * Copy the data from the source buffer. 410 * Copy the data from the source buffer.
385 * Length is the field width in bytes. 411 * Length is the field width in bytes.
386 */ 412 */
387 ACPI_MEMCPY (value, (obj_desc->buffer_field.buffer_obj)->buffer.pointer 413 ACPI_MEMCPY (value,
388 + obj_desc->buffer_field.base_byte_offset 414 (obj_desc->buffer_field.buffer_obj)->buffer.pointer +
389 + field_datum_byte_offset, 415 obj_desc->buffer_field.base_byte_offset +
390 obj_desc->common_field.access_byte_width); 416 field_datum_byte_offset,
417 obj_desc->common_field.access_byte_width);
391 } 418 }
392 else { 419 else {
393 /* 420 /*
394 * Copy the data to the target buffer. 421 * Copy the data to the target buffer.
395 * Length is the field width in bytes. 422 * Length is the field width in bytes.
396 */ 423 */
397 ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer 424 ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer +
398 + obj_desc->buffer_field.base_byte_offset 425 obj_desc->buffer_field.base_byte_offset +
399 + field_datum_byte_offset, 426 field_datum_byte_offset,
400 value, obj_desc->common_field.access_byte_width); 427 value, obj_desc->common_field.access_byte_width);
401 } 428 }
402 429
@@ -406,8 +433,10 @@ acpi_ex_field_datum_io (
406 433
407 case ACPI_TYPE_LOCAL_BANK_FIELD: 434 case ACPI_TYPE_LOCAL_BANK_FIELD:
408 435
409 /* Ensure that the bank_value is not beyond the capacity of the register */ 436 /*
410 437 * Ensure that the bank_value is not beyond the capacity of
438 * the register
439 */
411 if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj, 440 if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj,
412 (acpi_integer) obj_desc->bank_field.value)) { 441 (acpi_integer) obj_desc->bank_field.value)) {
413 return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); 442 return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
@@ -445,8 +474,10 @@ acpi_ex_field_datum_io (
445 case ACPI_TYPE_LOCAL_INDEX_FIELD: 474 case ACPI_TYPE_LOCAL_INDEX_FIELD:
446 475
447 476
448 /* Ensure that the index_value is not beyond the capacity of the register */ 477 /*
449 478 * Ensure that the index_value is not beyond the capacity of
479 * the register
480 */
450 if (acpi_ex_register_overflow (obj_desc->index_field.index_obj, 481 if (acpi_ex_register_overflow (obj_desc->index_field.index_obj,
451 (acpi_integer) obj_desc->index_field.value)) { 482 (acpi_integer) obj_desc->index_field.value)) {
452 return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); 483 return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
@@ -496,14 +527,16 @@ acpi_ex_field_datum_io (
496 527
497 if (ACPI_SUCCESS (status)) { 528 if (ACPI_SUCCESS (status)) {
498 if (read_write == ACPI_READ) { 529 if (read_write == ACPI_READ) {
499 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read %8.8X%8.8X, Width %d\n", 530 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
500 ACPI_FORMAT_UINT64 (*value), 531 "Value Read %8.8X%8.8X, Width %d\n",
501 obj_desc->common_field.access_byte_width)); 532 ACPI_FORMAT_UINT64 (*value),
533 obj_desc->common_field.access_byte_width));
502 } 534 }
503 else { 535 else {
504 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written %8.8X%8.8X, Width %d\n", 536 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
505 ACPI_FORMAT_UINT64 (*value), 537 "Value Written %8.8X%8.8X, Width %d\n",
506 obj_desc->common_field.access_byte_width)); 538 ACPI_FORMAT_UINT64 (*value),
539 obj_desc->common_field.access_byte_width));
507 } 540 }
508 } 541 }
509 542
@@ -515,8 +548,10 @@ acpi_ex_field_datum_io (
515 * 548 *
516 * FUNCTION: acpi_ex_write_with_update_rule 549 * FUNCTION: acpi_ex_write_with_update_rule
517 * 550 *
518 * PARAMETERS: *obj_desc - Field to be set 551 * PARAMETERS: obj_desc - Field to be written
519 * Value - Value to store 552 * Mask - bitmask within field datum
553 * field_value - Value to write
554 * field_datum_byte_offset - Offset of datum within field
520 * 555 *
521 * RETURN: Status 556 * RETURN: Status
522 * 557 *
@@ -689,7 +724,8 @@ acpi_ex_extract_from_field (
689 /* Merge with previous datum if necessary */ 724 /* Merge with previous datum if necessary */
690 725
691 merged_datum |= raw_datum << 726 merged_datum |= raw_datum <<
692 (obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); 727 (obj_desc->common_field.access_bit_width -
728 obj_desc->common_field.start_field_bit_offset);
693 729
694 if (i == datum_count) { 730 if (i == datum_count) {
695 break; 731 break;
@@ -707,7 +743,8 @@ acpi_ex_extract_from_field (
707 743
708 /* Mask off any extra bits in the last datum */ 744 /* Mask off any extra bits in the last datum */
709 745
710 buffer_tail_bits = obj_desc->common_field.bit_length % obj_desc->common_field.access_bit_width; 746 buffer_tail_bits = obj_desc->common_field.bit_length %
747 obj_desc->common_field.access_bit_width;
711 if (buffer_tail_bits) { 748 if (buffer_tail_bits) {
712 merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); 749 merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits);
713 } 750 }
@@ -791,7 +828,8 @@ acpi_ex_insert_into_field (
791 /* Write merged datum to the target field */ 828 /* Write merged datum to the target field */
792 829
793 merged_datum &= mask; 830 merged_datum &= mask;
794 status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, field_offset); 831 status = acpi_ex_write_with_update_rule (obj_desc, mask,
832 merged_datum, field_offset);
795 if (ACPI_FAILURE (status)) { 833 if (ACPI_FAILURE (status)) {
796 return_ACPI_STATUS (status); 834 return_ACPI_STATUS (status);
797 } 835 }
@@ -800,7 +838,8 @@ acpi_ex_insert_into_field (
800 838
801 field_offset += obj_desc->common_field.access_byte_width; 839 field_offset += obj_desc->common_field.access_byte_width;
802 merged_datum = raw_datum >> 840 merged_datum = raw_datum >>
803 (obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); 841 (obj_desc->common_field.access_bit_width -
842 obj_desc->common_field.start_field_bit_offset);
804 mask = ACPI_INTEGER_MAX; 843 mask = ACPI_INTEGER_MAX;
805 844
806 if (i == datum_count) { 845 if (i == datum_count) {
@@ -819,7 +858,8 @@ acpi_ex_insert_into_field (
819 /* Mask off any extra bits in the last datum */ 858 /* Mask off any extra bits in the last datum */
820 859
821 buffer_tail_bits = (obj_desc->common_field.bit_length + 860 buffer_tail_bits = (obj_desc->common_field.bit_length +
822 obj_desc->common_field.start_field_bit_offset) % obj_desc->common_field.access_bit_width; 861 obj_desc->common_field.start_field_bit_offset) %
862 obj_desc->common_field.access_bit_width;
823 if (buffer_tail_bits) { 863 if (buffer_tail_bits) {
824 mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); 864 mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits);
825 } 865 }
@@ -827,7 +867,8 @@ acpi_ex_insert_into_field (
827 /* Write the last datum to the field */ 867 /* Write the last datum to the field */
828 868
829 merged_datum &= mask; 869 merged_datum &= mask;
830 status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, field_offset); 870 status = acpi_ex_write_with_update_rule (obj_desc,
871 mask, merged_datum, field_offset);
831 872
832 return_ACPI_STATUS (status); 873 return_ACPI_STATUS (status);
833} 874}
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c
index b542dcd58c07..022f281345b8 100644
--- a/drivers/acpi/executer/exmisc.c
+++ b/drivers/acpi/executer/exmisc.c
@@ -139,8 +139,9 @@ acpi_ex_get_object_reference (
139 reference_obj->reference.object = referenced_obj; 139 reference_obj->reference.object = referenced_obj;
140 *return_desc = reference_obj; 140 *return_desc = reference_obj;
141 141
142 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p Type [%s], returning Reference %p\n", 142 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
143 obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc)); 143 "Object %p Type [%s], returning Reference %p\n",
144 obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc));
144 145
145 return_ACPI_STATUS (AE_OK); 146 return_ACPI_STATUS (AE_OK);
146} 147}
@@ -456,7 +457,7 @@ acpi_ex_do_math_op (
456 return (integer0 * integer1); 457 return (integer0 * integer1);
457 458
458 459
459 case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ 460 case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result)*/
460 461
461 return (integer0 << integer1); 462 return (integer0 << integer1);
462 463
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c
index 68c4bb1970a5..c3cb714d2cba 100644
--- a/drivers/acpi/executer/exmutex.c
+++ b/drivers/acpi/executer/exmutex.c
@@ -49,6 +49,13 @@
49#define _COMPONENT ACPI_EXECUTER 49#define _COMPONENT ACPI_EXECUTER
50 ACPI_MODULE_NAME ("exmutex") 50 ACPI_MODULE_NAME ("exmutex")
51 51
52/* Local prototypes */
53
54static void
55acpi_ex_link_mutex (
56 union acpi_operand_object *obj_desc,
57 struct acpi_thread_state *thread);
58
52 59
53/******************************************************************************* 60/*******************************************************************************
54 * 61 *
@@ -56,7 +63,7 @@
56 * 63 *
57 * PARAMETERS: obj_desc - The mutex to be unlinked 64 * PARAMETERS: obj_desc - The mutex to be unlinked
58 * 65 *
59 * RETURN: Status 66 * RETURN: None
60 * 67 *
61 * DESCRIPTION: Remove a mutex from the "acquired_mutex" list 68 * DESCRIPTION: Remove a mutex from the "acquired_mutex" list
62 * 69 *
@@ -92,16 +99,16 @@ acpi_ex_unlink_mutex (
92 * 99 *
93 * FUNCTION: acpi_ex_link_mutex 100 * FUNCTION: acpi_ex_link_mutex
94 * 101 *
95 * PARAMETERS: obj_desc - The mutex to be linked 102 * PARAMETERS: obj_desc - The mutex to be linked
96 * list_head - head of the "acquired_mutex" list 103 * Thread - Current executing thread object
97 * 104 *
98 * RETURN: Status 105 * RETURN: None
99 * 106 *
100 * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk 107 * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk
101 * 108 *
102 ******************************************************************************/ 109 ******************************************************************************/
103 110
104void 111static void
105acpi_ex_link_mutex ( 112acpi_ex_link_mutex (
106 union acpi_operand_object *obj_desc, 113 union acpi_operand_object *obj_desc,
107 struct acpi_thread_state *thread) 114 struct acpi_thread_state *thread)
@@ -132,8 +139,9 @@ acpi_ex_link_mutex (
132 * 139 *
133 * FUNCTION: acpi_ex_acquire_mutex 140 * FUNCTION: acpi_ex_acquire_mutex
134 * 141 *
135 * PARAMETERS: time_desc - The 'time to delay' object descriptor 142 * PARAMETERS: time_desc - Timeout integer
136 * obj_desc - The object descriptor for this op 143 * obj_desc - Mutex object
144 * walk_state - Current method execution state
137 * 145 *
138 * RETURN: Status 146 * RETURN: Status
139 * 147 *
@@ -161,7 +169,7 @@ acpi_ex_acquire_mutex (
161 169
162 if (!walk_state->thread) { 170 if (!walk_state->thread) {
163 ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n", 171 ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n",
164 acpi_ut_get_node_name (obj_desc->mutex.node))); 172 acpi_ut_get_node_name (obj_desc->mutex.node)));
165 return_ACPI_STATUS (AE_AML_INTERNAL); 173 return_ACPI_STATUS (AE_AML_INTERNAL);
166 } 174 }
167 175
@@ -170,8 +178,9 @@ acpi_ex_acquire_mutex (
170 * mutex. This mechanism provides some deadlock prevention 178 * mutex. This mechanism provides some deadlock prevention
171 */ 179 */
172 if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { 180 if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) {
173 ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], incorrect sync_level\n", 181 ACPI_REPORT_ERROR ((
174 acpi_ut_get_node_name (obj_desc->mutex.node))); 182 "Cannot acquire Mutex [%4.4s], incorrect sync_level\n",
183 acpi_ut_get_node_name (obj_desc->mutex.node)));
175 return_ACPI_STATUS (AE_AML_MUTEX_ORDER); 184 return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
176 } 185 }
177 186
@@ -180,8 +189,10 @@ acpi_ex_acquire_mutex (
180 if (obj_desc->mutex.owner_thread) { 189 if (obj_desc->mutex.owner_thread) {
181 /* Special case for Global Lock, allow all threads */ 190 /* Special case for Global Lock, allow all threads */
182 191
183 if ((obj_desc->mutex.owner_thread->thread_id == walk_state->thread->thread_id) || 192 if ((obj_desc->mutex.owner_thread->thread_id ==
184 (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore)) { 193 walk_state->thread->thread_id) ||
194 (obj_desc->mutex.semaphore ==
195 acpi_gbl_global_lock_semaphore)) {
185 /* 196 /*
186 * The mutex is already owned by this thread, 197 * The mutex is already owned by this thread,
187 * just increment the acquisition depth 198 * just increment the acquisition depth
@@ -221,6 +232,7 @@ acpi_ex_acquire_mutex (
221 * FUNCTION: acpi_ex_release_mutex 232 * FUNCTION: acpi_ex_release_mutex
222 * 233 *
223 * PARAMETERS: obj_desc - The object descriptor for this op 234 * PARAMETERS: obj_desc - The object descriptor for this op
235 * walk_state - Current method execution state
224 * 236 *
225 * RETURN: Status 237 * RETURN: Status
226 * 238 *
@@ -278,8 +290,9 @@ acpi_ex_release_mutex (
278 * equal to the current sync level 290 * equal to the current sync level
279 */ 291 */
280 if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { 292 if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) {
281 ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], incorrect sync_level\n", 293 ACPI_REPORT_ERROR ((
282 acpi_ut_get_node_name (obj_desc->mutex.node))); 294 "Cannot release Mutex [%4.4s], incorrect sync_level\n",
295 acpi_ut_get_node_name (obj_desc->mutex.node)));
283 return_ACPI_STATUS (AE_AML_MUTEX_ORDER); 296 return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
284 } 297 }
285 298
@@ -313,11 +326,11 @@ acpi_ex_release_mutex (
313 * 326 *
314 * FUNCTION: acpi_ex_release_all_mutexes 327 * FUNCTION: acpi_ex_release_all_mutexes
315 * 328 *
316 * PARAMETERS: mutex_list - Head of the mutex list 329 * PARAMETERS: Thread - Current executing thread object
317 * 330 *
318 * RETURN: Status 331 * RETURN: Status
319 * 332 *
320 * DESCRIPTION: Release all mutexes in the list 333 * DESCRIPTION: Release all mutexes held by this thread
321 * 334 *
322 ******************************************************************************/ 335 ******************************************************************************/
323 336
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c
index 7911c533c265..639f0bd3f6d8 100644
--- a/drivers/acpi/executer/exnames.c
+++ b/drivers/acpi/executer/exnames.c
@@ -50,13 +50,17 @@
50#define _COMPONENT ACPI_EXECUTER 50#define _COMPONENT ACPI_EXECUTER
51 ACPI_MODULE_NAME ("exnames") 51 ACPI_MODULE_NAME ("exnames")
52 52
53/* Local prototypes */
53 54
54/* AML Package Length encodings */ 55static char *
56acpi_ex_allocate_name_string (
57 u32 prefix_count,
58 u32 num_name_segs);
55 59
56#define ACPI_AML_PACKAGE_TYPE1 0x40 60static acpi_status
57#define ACPI_AML_PACKAGE_TYPE2 0x4000 61acpi_ex_name_segment (
58#define ACPI_AML_PACKAGE_TYPE3 0x400000 62 u8 **in_aml_address,
59#define ACPI_AML_PACKAGE_TYPE4 0x40000000 63 char *name_string);
60 64
61 65
62/******************************************************************************* 66/*******************************************************************************
@@ -64,7 +68,7 @@
64 * FUNCTION: acpi_ex_allocate_name_string 68 * FUNCTION: acpi_ex_allocate_name_string
65 * 69 *
66 * PARAMETERS: prefix_count - Count of parent levels. Special cases: 70 * PARAMETERS: prefix_count - Count of parent levels. Special cases:
67 * (-1) = root, 0 = none 71 * (-1)==root, 0==none
68 * num_name_segs - count of 4-character name segments 72 * num_name_segs - count of 4-character name segments
69 * 73 *
70 * RETURN: A pointer to the allocated string segment. This segment must 74 * RETURN: A pointer to the allocated string segment. This segment must
@@ -75,7 +79,7 @@
75 * 79 *
76 ******************************************************************************/ 80 ******************************************************************************/
77 81
78char * 82static char *
79acpi_ex_allocate_name_string ( 83acpi_ex_allocate_name_string (
80 u32 prefix_count, 84 u32 prefix_count,
81 u32 num_name_segs) 85 u32 num_name_segs)
@@ -88,7 +92,7 @@ acpi_ex_allocate_name_string (
88 92
89 93
90 /* 94 /*
91 * Allow room for all \ and ^ prefixes, all segments, and a multi_name_prefix. 95 * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix.
92 * Also, one byte for the null terminator. 96 * Also, one byte for the null terminator.
93 * This may actually be somewhat longer than needed. 97 * This may actually be somewhat longer than needed.
94 */ 98 */
@@ -107,7 +111,8 @@ acpi_ex_allocate_name_string (
107 */ 111 */
108 name_string = ACPI_MEM_ALLOCATE (size_needed); 112 name_string = ACPI_MEM_ALLOCATE (size_needed);
109 if (!name_string) { 113 if (!name_string) {
110 ACPI_REPORT_ERROR (("ex_allocate_name_string: Could not allocate size %d\n", size_needed)); 114 ACPI_REPORT_ERROR ((
115 "ex_allocate_name_string: Could not allocate size %d\n", size_needed));
111 return_PTR (NULL); 116 return_PTR (NULL);
112 } 117 }
113 118
@@ -152,15 +157,17 @@ acpi_ex_allocate_name_string (
152 * 157 *
153 * FUNCTION: acpi_ex_name_segment 158 * FUNCTION: acpi_ex_name_segment
154 * 159 *
155 * PARAMETERS: interpreter_mode - Current running mode (load1/Load2/Exec) 160 * PARAMETERS: in_aml_address - Pointer to the name in the AML code
161 * name_string - Where to return the name. The name is appended
162 * to any existing string to form a namepath
156 * 163 *
157 * RETURN: Status 164 * RETURN: Status
158 * 165 *
159 * DESCRIPTION: Execute a name segment (4 bytes) 166 * DESCRIPTION: Extract an ACPI name (4 bytes) from the AML byte stream
160 * 167 *
161 ******************************************************************************/ 168 ******************************************************************************/
162 169
163acpi_status 170static acpi_status
164acpi_ex_name_segment ( 171acpi_ex_name_segment (
165 u8 **in_aml_address, 172 u8 **in_aml_address,
166 char *name_string) 173 char *name_string)
@@ -223,10 +230,13 @@ acpi_ex_name_segment (
223 status = AE_CTRL_PENDING; 230 status = AE_CTRL_PENDING;
224 } 231 }
225 else { 232 else {
226 /* Segment started with one or more valid characters, but fewer than 4 */ 233 /*
227 234 * Segment started with one or more valid characters, but fewer than
235 * the required 4
236 */
228 status = AE_AML_BAD_NAME; 237 status = AE_AML_BAD_NAME;
229 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad character %02x in name, at %p\n", 238 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
239 "Bad character %02x in name, at %p\n",
230 *aml_address, aml_address)); 240 *aml_address, aml_address));
231 } 241 }
232 242
@@ -239,11 +249,16 @@ acpi_ex_name_segment (
239 * 249 *
240 * FUNCTION: acpi_ex_get_name_string 250 * FUNCTION: acpi_ex_get_name_string
241 * 251 *
242 * PARAMETERS: data_type - Data type to be associated with this name 252 * PARAMETERS: data_type - Object type to be associated with this
253 * name
254 * in_aml_address - Pointer to the namestring in the AML code
255 * out_name_string - Where the namestring is returned
256 * out_name_length - Length of the returned string
243 * 257 *
244 * RETURN: Status 258 * RETURN: Status, namestring and length
245 * 259 *
246 * DESCRIPTION: Get a name, including any prefixes. 260 * DESCRIPTION: Extract a full namepath from the AML byte stream,
261 * including any prefixes.
247 * 262 *
248 ******************************************************************************/ 263 ******************************************************************************/
249 264
@@ -286,7 +301,8 @@ acpi_ex_get_name_string (
286 switch (*aml_address) { 301 switch (*aml_address) {
287 case AML_ROOT_PREFIX: 302 case AML_ROOT_PREFIX:
288 303
289 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n", aml_address)); 304 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n",
305 aml_address));
290 306
291 /* 307 /*
292 * Remember that we have a root_prefix -- 308 * Remember that we have a root_prefix --
@@ -303,7 +319,8 @@ acpi_ex_get_name_string (
303 /* Increment past possibly multiple parent prefixes */ 319 /* Increment past possibly multiple parent prefixes */
304 320
305 do { 321 do {
306 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n", aml_address)); 322 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n",
323 aml_address));
307 324
308 aml_address++; 325 aml_address++;
309 prefix_count++; 326 prefix_count++;
@@ -321,13 +338,13 @@ acpi_ex_get_name_string (
321 break; 338 break;
322 } 339 }
323 340
324
325 /* Examine first character of name for name segment prefix operator */ 341 /* Examine first character of name for name segment prefix operator */
326 342
327 switch (*aml_address) { 343 switch (*aml_address) {
328 case AML_DUAL_NAME_PREFIX: 344 case AML_DUAL_NAME_PREFIX:
329 345
330 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n", aml_address)); 346 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n",
347 aml_address));
331 348
332 aml_address++; 349 aml_address++;
333 name_string = acpi_ex_allocate_name_string (prefix_count, 2); 350 name_string = acpi_ex_allocate_name_string (prefix_count, 2);
@@ -349,7 +366,8 @@ acpi_ex_get_name_string (
349 366
350 case AML_MULTI_NAME_PREFIX_OP: 367 case AML_MULTI_NAME_PREFIX_OP:
351 368
352 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n", aml_address)); 369 ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n",
370 aml_address));
353 371
354 /* Fetch count of segments remaining in name path */ 372 /* Fetch count of segments remaining in name path */
355 373
@@ -368,7 +386,8 @@ acpi_ex_get_name_string (
368 has_prefix = TRUE; 386 has_prefix = TRUE;
369 387
370 while (num_segments && 388 while (num_segments &&
371 (status = acpi_ex_name_segment (&aml_address, name_string)) == AE_OK) { 389 (status = acpi_ex_name_segment (&aml_address, name_string)) ==
390 AE_OK) {
372 num_segments--; 391 num_segments--;
373 } 392 }
374 393
@@ -380,7 +399,8 @@ acpi_ex_get_name_string (
380 /* null_name valid as of 8-12-98 ASL/AML Grammar Update */ 399 /* null_name valid as of 8-12-98 ASL/AML Grammar Update */
381 400
382 if (prefix_count == ACPI_UINT32_MAX) { 401 if (prefix_count == ACPI_UINT32_MAX) {
383 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "name_seg is \"\\\" followed by NULL\n")); 402 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
403 "name_seg is \"\\\" followed by NULL\n"));
384 } 404 }
385 405
386 /* Consume the NULL byte */ 406 /* Consume the NULL byte */
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c
index 8482aefaf38b..dbdf8262ba00 100644
--- a/drivers/acpi/executer/exoparg1.c
+++ b/drivers/acpi/executer/exoparg1.c
@@ -97,7 +97,8 @@ acpi_ex_opcode_0A_0T_1R (
97 union acpi_operand_object *return_desc = NULL; 97 union acpi_operand_object *return_desc = NULL;
98 98
99 99
100 ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); 100 ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R",
101 acpi_ps_get_opcode_name (walk_state->opcode));
101 102
102 103
103 /* Examine the AML opcode */ 104 /* Examine the AML opcode */
@@ -161,7 +162,8 @@ acpi_ex_opcode_1A_0T_0R (
161 acpi_status status = AE_OK; 162 acpi_status status = AE_OK;
162 163
163 164
164 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); 165 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R",
166 acpi_ps_get_opcode_name (walk_state->opcode));
165 167
166 168
167 /* Examine the AML opcode */ 169 /* Examine the AML opcode */
@@ -236,7 +238,8 @@ acpi_ex_opcode_1A_1T_0R (
236 union acpi_operand_object **operand = &walk_state->operands[0]; 238 union acpi_operand_object **operand = &walk_state->operands[0];
237 239
238 240
239 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); 241 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R",
242 acpi_ps_get_opcode_name (walk_state->opcode));
240 243
241 244
242 /* Examine the AML opcode */ 245 /* Examine the AML opcode */
@@ -289,7 +292,8 @@ acpi_ex_opcode_1A_1T_1R (
289 acpi_integer digit; 292 acpi_integer digit;
290 293
291 294
292 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); 295 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R",
296 acpi_ps_get_opcode_name (walk_state->opcode));
293 297
294 298
295 /* Examine the AML opcode */ 299 /* Examine the AML opcode */
@@ -409,8 +413,10 @@ acpi_ex_opcode_1A_1T_1R (
409 for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { 413 for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) {
410 (void) acpi_ut_short_divide (digit, 10, &digit, &temp32); 414 (void) acpi_ut_short_divide (digit, 10, &digit, &temp32);
411 415
412 /* Insert the BCD digit that resides in the remainder from above */ 416 /*
413 417 * Insert the BCD digit that resides in the
418 * remainder from above
419 */
414 return_desc->integer.value |= (((acpi_integer) temp32) << 420 return_desc->integer.value |= (((acpi_integer) temp32) <<
415 ACPI_MUL_4 (i)); 421 ACPI_MUL_4 (i));
416 } 422 }
@@ -445,7 +451,8 @@ acpi_ex_opcode_1A_1T_1R (
445 451
446 /* Get the object reference, store it, and remove our reference */ 452 /* Get the object reference, store it, and remove our reference */
447 453
448 status = acpi_ex_get_object_reference (operand[0], &return_desc2, walk_state); 454 status = acpi_ex_get_object_reference (operand[0],
455 &return_desc2, walk_state);
449 if (ACPI_FAILURE (status)) { 456 if (ACPI_FAILURE (status)) {
450 goto cleanup; 457 goto cleanup;
451 } 458 }
@@ -482,10 +489,10 @@ acpi_ex_opcode_1A_1T_1R (
482 489
483 if (!walk_state->result_obj) { 490 if (!walk_state->result_obj) {
484 /* 491 /*
485 * Normally, we would remove a reference on the Operand[0] parameter; 492 * Normally, we would remove a reference on the Operand[0]
486 * But since it is being used as the internal return object 493 * parameter; But since it is being used as the internal return
487 * (meaning we would normally increment it), the two cancel out, 494 * object (meaning we would normally increment it), the two
488 * and we simply don't do anything. 495 * cancel out, and we simply don't do anything.
489 */ 496 */
490 walk_state->result_obj = operand[0]; 497 walk_state->result_obj = operand[0];
491 walk_state->operands[0] = NULL; /* Prevent deletion */ 498 walk_state->operands[0] = NULL; /* Prevent deletion */
@@ -549,9 +556,8 @@ acpi_ex_opcode_1A_1T_1R (
549 case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ 556 case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */
550 case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ 557 case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */
551 558
552 /* 559 /* These are two obsolete opcodes */
553 * These are two obsolete opcodes 560
554 */
555 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 561 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
556 "%s is obsolete and not implemented\n", 562 "%s is obsolete and not implemented\n",
557 acpi_ps_get_opcode_name (walk_state->opcode))); 563 acpi_ps_get_opcode_name (walk_state->opcode)));
@@ -568,9 +574,8 @@ acpi_ex_opcode_1A_1T_1R (
568 } 574 }
569 575
570 if (ACPI_SUCCESS (status)) { 576 if (ACPI_SUCCESS (status)) {
571 /* 577 /* Store the return value computed above into the target object */
572 * Store the return value computed above into the target object 578
573 */
574 status = acpi_ex_store (return_desc, operand[1], walk_state); 579 status = acpi_ex_store (return_desc, operand[1], walk_state);
575 } 580 }
576 581
@@ -615,7 +620,8 @@ acpi_ex_opcode_1A_0T_1R (
615 acpi_integer value; 620 acpi_integer value;
616 621
617 622
618 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); 623 ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R",
624 acpi_ps_get_opcode_name (walk_state->opcode));
619 625
620 626
621 /* Examine the AML opcode */ 627 /* Examine the AML opcode */
@@ -706,9 +712,9 @@ acpi_ex_opcode_1A_0T_1R (
706 712
707 /* 713 /*
708 * Note: The operand is not resolved at this point because we want to 714 * Note: The operand is not resolved at this point because we want to
709 * get the associated object, not its value. For example, we don't want 715 * get the associated object, not its value. For example, we don't
710 * to resolve a field_unit to its value, we want the actual field_unit 716 * want to resolve a field_unit to its value, we want the actual
711 * object. 717 * field_unit object.
712 */ 718 */
713 719
714 /* Get the type of the base object */ 720 /* Get the type of the base object */
@@ -738,7 +744,8 @@ acpi_ex_opcode_1A_0T_1R (
738 744
739 /* Get the base object */ 745 /* Get the base object */
740 746
741 status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, &temp_desc); 747 status = acpi_ex_resolve_multiple (walk_state,
748 operand[0], &type, &temp_desc);
742 if (ACPI_FAILURE (status)) { 749 if (ACPI_FAILURE (status)) {
743 goto cleanup; 750 goto cleanup;
744 } 751 }
@@ -818,8 +825,10 @@ acpi_ex_opcode_1A_0T_1R (
818 825
819 /* Set Operand[0] to the value of the local/arg */ 826 /* Set Operand[0] to the value of the local/arg */
820 827
821 status = acpi_ds_method_data_get_value (operand[0]->reference.opcode, 828 status = acpi_ds_method_data_get_value (
822 operand[0]->reference.offset, walk_state, &temp_desc); 829 operand[0]->reference.opcode,
830 operand[0]->reference.offset,
831 walk_state, &temp_desc);
823 if (ACPI_FAILURE (status)) { 832 if (ACPI_FAILURE (status)) {
824 goto cleanup; 833 goto cleanup;
825 } 834 }
@@ -852,21 +861,26 @@ acpi_ex_opcode_1A_0T_1R (
852 case ACPI_TYPE_STRING: 861 case ACPI_TYPE_STRING:
853 862
854 /* 863 /*
855 * This is a deref_of (String). The string is a reference to a named ACPI object. 864 * This is a deref_of (String). The string is a reference
865 * to a named ACPI object.
856 * 866 *
857 * 1) Find the owning Node 867 * 1) Find the owning Node
858 * 2) Dereference the node to an actual object. Could be a Field, so we nee 868 * 2) Dereference the node to an actual object. Could be a
859 * to resolve the node to a value. 869 * Field, so we need to resolve the node to a value.
860 */ 870 */
861 status = acpi_ns_get_node_by_path (operand[0]->string.pointer, 871 status = acpi_ns_get_node_by_path (operand[0]->string.pointer,
862 walk_state->scope_info->scope.node, ACPI_NS_SEARCH_PARENT, 872 walk_state->scope_info->scope.node,
863 ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &return_desc)); 873 ACPI_NS_SEARCH_PARENT,
874 ACPI_CAST_INDIRECT_PTR (
875 struct acpi_namespace_node, &return_desc));
864 if (ACPI_FAILURE (status)) { 876 if (ACPI_FAILURE (status)) {
865 goto cleanup; 877 goto cleanup;
866 } 878 }
867 879
868 status = acpi_ex_resolve_node_to_value ( 880 status = acpi_ex_resolve_node_to_value (
869 ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &return_desc), walk_state); 881 ACPI_CAST_INDIRECT_PTR (
882 struct acpi_namespace_node, &return_desc),
883 walk_state);
870 goto cleanup; 884 goto cleanup;
871 885
872 886
@@ -883,14 +897,16 @@ acpi_ex_opcode_1A_0T_1R (
883 /* 897 /*
884 * This is a deref_of (object_reference) 898 * This is a deref_of (object_reference)
885 * Get the actual object from the Node (This is the dereference). 899 * Get the actual object from the Node (This is the dereference).
886 * -- This case may only happen when a local_x or arg_x is dereferenced above. 900 * This case may only happen when a local_x or arg_x is
901 * dereferenced above.
887 */ 902 */
888 return_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) operand[0]); 903 return_desc = acpi_ns_get_attached_object (
904 (struct acpi_namespace_node *) operand[0]);
889 } 905 }
890 else { 906 else {
891 /* 907 /*
892 * This must be a reference object produced by either the Index() or 908 * This must be a reference object produced by either the
893 * ref_of() operator 909 * Index() or ref_of() operator
894 */ 910 */
895 switch (operand[0]->reference.opcode) { 911 switch (operand[0]->reference.opcode) {
896 case AML_INDEX_OP: 912 case AML_INDEX_OP:
@@ -931,8 +947,8 @@ acpi_ex_opcode_1A_0T_1R (
931 case ACPI_TYPE_PACKAGE: 947 case ACPI_TYPE_PACKAGE:
932 948
933 /* 949 /*
934 * Return the referenced element of the package. We must add 950 * Return the referenced element of the package. We must
935 * another reference to the referenced object, however. 951 * add another reference to the referenced object, however.
936 */ 952 */
937 return_desc = *(operand[0]->reference.where); 953 return_desc = *(operand[0]->reference.where);
938 if (!return_desc) { 954 if (!return_desc) {
@@ -967,9 +983,11 @@ acpi_ex_opcode_1A_0T_1R (
967 983
968 return_desc = operand[0]->reference.object; 984 return_desc = operand[0]->reference.object;
969 985
970 if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) == ACPI_DESC_TYPE_NAMED) { 986 if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) ==
987 ACPI_DESC_TYPE_NAMED) {
971 988
972 return_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) return_desc); 989 return_desc = acpi_ns_get_attached_object (
990 (struct acpi_namespace_node *) return_desc);
973 } 991 }
974 992
975 /* Add another reference to the object! */ 993 /* Add another reference to the object! */
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c
index 8be4d80ceed5..7429032c2b6c 100644
--- a/drivers/acpi/executer/exoparg2.c
+++ b/drivers/acpi/executer/exoparg2.c
@@ -118,7 +118,7 @@ acpi_ex_opcode_2A_0T_0R (
118 118
119 value = (u32) operand[1]->integer.value; 119 value = (u32) operand[1]->integer.value;
120 120
121 /* Notifies allowed on this object? */ 121 /* Are notifies allowed on this object? */
122 122
123 if (!acpi_ev_is_notify_object (node)) { 123 if (!acpi_ev_is_notify_object (node)) {
124 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 124 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
@@ -203,11 +203,12 @@ acpi_ex_opcode_2A_2T_1R (
203 acpi_ps_get_opcode_name (walk_state->opcode)); 203 acpi_ps_get_opcode_name (walk_state->opcode));
204 204
205 205
206 /* 206 /* Execute the opcode */
207 * Execute the opcode 207
208 */
209 switch (walk_state->opcode) { 208 switch (walk_state->opcode) {
210 case AML_DIVIDE_OP: /* Divide (Dividend, Divisor, remainder_result quotient_result) */ 209 case AML_DIVIDE_OP:
210
211 /* Divide (Dividend, Divisor, remainder_result quotient_result) */
211 212
212 return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 213 return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
213 if (!return_desc1) { 214 if (!return_desc1) {
@@ -241,7 +242,6 @@ acpi_ex_opcode_2A_2T_1R (
241 goto cleanup; 242 goto cleanup;
242 } 243 }
243 244
244
245 /* Store the results to the target reference operands */ 245 /* Store the results to the target reference operands */
246 246
247 status = acpi_ex_store (return_desc2, operand[2], walk_state); 247 status = acpi_ex_store (return_desc2, operand[2], walk_state);
@@ -295,7 +295,7 @@ acpi_ex_opcode_2A_1T_1R (
295{ 295{
296 union acpi_operand_object **operand = &walk_state->operands[0]; 296 union acpi_operand_object **operand = &walk_state->operands[0];
297 union acpi_operand_object *return_desc = NULL; 297 union acpi_operand_object *return_desc = NULL;
298 u32 index; 298 acpi_integer index;
299 acpi_status status = AE_OK; 299 acpi_status status = AE_OK;
300 acpi_size length; 300 acpi_size length;
301 301
@@ -304,9 +304,8 @@ acpi_ex_opcode_2A_1T_1R (
304 acpi_ps_get_opcode_name (walk_state->opcode)); 304 acpi_ps_get_opcode_name (walk_state->opcode));
305 305
306 306
307 /* 307 /* Execute the opcode */
308 * Execute the opcode 308
309 */
310 if (walk_state->op_info->flags & AML_MATH) { 309 if (walk_state->op_info->flags & AML_MATH) {
311 /* All simple math opcodes (add, etc.) */ 310 /* All simple math opcodes (add, etc.) */
312 311
@@ -322,9 +321,8 @@ acpi_ex_opcode_2A_1T_1R (
322 goto store_result_to_target; 321 goto store_result_to_target;
323 } 322 }
324 323
325
326 switch (walk_state->opcode) { 324 switch (walk_state->opcode) {
327 case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */ 325 case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */
328 326
329 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 327 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
330 if (!return_desc) { 328 if (!return_desc) {
@@ -341,18 +339,19 @@ acpi_ex_opcode_2A_1T_1R (
341 break; 339 break;
342 340
343 341
344 case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ 342 case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
345 343
346 status = acpi_ex_do_concatenate (operand[0], operand[1], 344 status = acpi_ex_do_concatenate (operand[0], operand[1],
347 &return_desc, walk_state); 345 &return_desc, walk_state);
348 break; 346 break;
349 347
350 348
351 case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ 349 case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */
352 350
353 /* 351 /*
354 * Input object is guaranteed to be a buffer at this point (it may have 352 * Input object is guaranteed to be a buffer at this point (it may have
355 * been converted.) Copy the raw buffer data to a new object of type String. 353 * been converted.) Copy the raw buffer data to a new object of
354 * type String.
356 */ 355 */
357 356
358 /* 357 /*
@@ -383,14 +382,16 @@ acpi_ex_opcode_2A_1T_1R (
383 goto cleanup; 382 goto cleanup;
384 } 383 }
385 384
386 /* Copy the raw buffer data with no transform. NULL terminated already. */ 385 /* Copy the raw buffer data with no transform. NULL terminated already*/
387 386
388 ACPI_MEMCPY (return_desc->string.pointer, 387 ACPI_MEMCPY (return_desc->string.pointer,
389 operand[0]->buffer.pointer, length); 388 operand[0]->buffer.pointer, length);
390 break; 389 break;
391 390
392 391
393 case AML_CONCAT_RES_OP: /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ 392 case AML_CONCAT_RES_OP:
393
394 /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
394 395
395 status = acpi_ex_concat_template (operand[0], operand[1], 396 status = acpi_ex_concat_template (operand[0], operand[1],
396 &return_desc, walk_state); 397 &return_desc, walk_state);
@@ -407,33 +408,33 @@ acpi_ex_opcode_2A_1T_1R (
407 goto cleanup; 408 goto cleanup;
408 } 409 }
409 410
410 index = (u32) operand[1]->integer.value; 411 index = operand[1]->integer.value;
412
413 /* At this point, the Source operand is a Package, Buffer, or String */
411 414
412 /*
413 * At this point, the Source operand is a Package, Buffer, or String
414 */
415 if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) { 415 if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) {
416 /* Object to be indexed is a Package */ 416 /* Object to be indexed is a Package */
417 417
418 if (index >= operand[0]->package.count) { 418 if (index >= operand[0]->package.count) {
419 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 419 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
420 "Index value (%X) beyond package end (%X)\n", 420 "Index value (%X%8.8X) beyond package end (%X)\n",
421 index, operand[0]->package.count)); 421 ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
422 status = AE_AML_PACKAGE_LIMIT; 422 status = AE_AML_PACKAGE_LIMIT;
423 goto cleanup; 423 goto cleanup;
424 } 424 }
425 425
426 return_desc->reference.target_type = ACPI_TYPE_PACKAGE; 426 return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
427 return_desc->reference.object = operand[0]; 427 return_desc->reference.object = operand[0];
428 return_desc->reference.where = &operand[0]->package.elements [index]; 428 return_desc->reference.where = &operand[0]->package.elements [
429 index];
429 } 430 }
430 else { 431 else {
431 /* Object to be indexed is a Buffer/String */ 432 /* Object to be indexed is a Buffer/String */
432 433
433 if (index >= operand[0]->buffer.length) { 434 if (index >= operand[0]->buffer.length) {
434 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 435 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
435 "Index value (%X) beyond end of buffer (%X)\n", 436 "Index value (%X%8.8X) beyond end of buffer (%X)\n",
436 index, operand[0]->buffer.length)); 437 ACPI_FORMAT_UINT64 (index), operand[0]->buffer.length));
437 status = AE_AML_BUFFER_LIMIT; 438 status = AE_AML_BUFFER_LIMIT;
438 goto cleanup; 439 goto cleanup;
439 } 440 }
@@ -451,7 +452,7 @@ acpi_ex_opcode_2A_1T_1R (
451 /* Complete the Index reference object */ 452 /* Complete the Index reference object */
452 453
453 return_desc->reference.opcode = AML_INDEX_OP; 454 return_desc->reference.opcode = AML_INDEX_OP;
454 return_desc->reference.offset = index; 455 return_desc->reference.offset = (u32) index;
455 456
456 /* Store the reference to the Target */ 457 /* Store the reference to the Target */
457 458
@@ -536,22 +537,24 @@ acpi_ex_opcode_2A_0T_1R (
536 goto cleanup; 537 goto cleanup;
537 } 538 }
538 539
539 /* 540 /* Execute the Opcode */
540 * Execute the Opcode 541
541 */ 542 if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
542 if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) /* logical_op (Operand0, Operand1) */ { 543 /* logical_op (Operand0, Operand1) */
544
543 status = acpi_ex_do_logical_numeric_op (walk_state->opcode, 545 status = acpi_ex_do_logical_numeric_op (walk_state->opcode,
544 operand[0]->integer.value, operand[1]->integer.value, 546 operand[0]->integer.value, operand[1]->integer.value,
545 &logical_result); 547 &logical_result);
546 goto store_logical_result; 548 goto store_logical_result;
547 } 549 }
548 else if (walk_state->op_info->flags & AML_LOGICAL) /* logical_op (Operand0, Operand1) */ { 550 else if (walk_state->op_info->flags & AML_LOGICAL) {
551 /* logical_op (Operand0, Operand1) */
552
549 status = acpi_ex_do_logical_op (walk_state->opcode, operand[0], 553 status = acpi_ex_do_logical_op (walk_state->opcode, operand[0],
550 operand[1], &logical_result); 554 operand[1], &logical_result);
551 goto store_logical_result; 555 goto store_logical_result;
552 } 556 }
553 557
554
555 switch (walk_state->opcode) { 558 switch (walk_state->opcode) {
556 case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */ 559 case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */
557 560
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c
index 29d0b167745d..23b068adbf58 100644
--- a/drivers/acpi/executer/exoparg3.c
+++ b/drivers/acpi/executer/exoparg3.c
@@ -97,11 +97,12 @@ acpi_ex_opcode_3A_0T_0R (
97 acpi_status status = AE_OK; 97 acpi_status status = AE_OK;
98 98
99 99
100 ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); 100 ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R",
101 acpi_ps_get_opcode_name (walk_state->opcode));
101 102
102 103
103 switch (walk_state->opcode) { 104 switch (walk_state->opcode) {
104 case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ 105 case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */
105 106
106 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 107 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
107 "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", 108 "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
@@ -116,9 +117,8 @@ acpi_ex_opcode_3A_0T_0R (
116 fatal->argument = (u32) operand[2]->integer.value; 117 fatal->argument = (u32) operand[2]->integer.value;
117 } 118 }
118 119
119 /* 120 /* Always signal the OS! */
120 * Always signal the OS! 121
121 */
122 status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal); 122 status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal);
123 123
124 /* Might return while OS is shutting down, just continue */ 124 /* Might return while OS is shutting down, just continue */
@@ -162,21 +162,23 @@ acpi_ex_opcode_3A_1T_1R (
162 union acpi_operand_object *return_desc = NULL; 162 union acpi_operand_object *return_desc = NULL;
163 char *buffer; 163 char *buffer;
164 acpi_status status = AE_OK; 164 acpi_status status = AE_OK;
165 acpi_native_uint index; 165 acpi_integer index;
166 acpi_size length; 166 acpi_size length;
167 167
168 168
169 ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); 169 ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R",
170 acpi_ps_get_opcode_name (walk_state->opcode));
170 171
171 172
172 switch (walk_state->opcode) { 173 switch (walk_state->opcode) {
173 case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ 174 case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
174 175
175 /* 176 /*
176 * Create the return object. The Source operand is guaranteed to be 177 * Create the return object. The Source operand is guaranteed to be
177 * either a String or a Buffer, so just use its type. 178 * either a String or a Buffer, so just use its type.
178 */ 179 */
179 return_desc = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (operand[0])); 180 return_desc = acpi_ut_create_internal_object (
181 ACPI_GET_OBJECT_TYPE (operand[0]));
180 if (!return_desc) { 182 if (!return_desc) {
181 status = AE_NO_MEMORY; 183 status = AE_NO_MEMORY;
182 goto cleanup; 184 goto cleanup;
@@ -184,7 +186,7 @@ acpi_ex_opcode_3A_1T_1R (
184 186
185 /* Get the Integer values from the objects */ 187 /* Get the Integer values from the objects */
186 188
187 index = (acpi_native_uint) operand[1]->integer.value; 189 index = operand[1]->integer.value;
188 length = (acpi_size) operand[2]->integer.value; 190 length = (acpi_size) operand[2]->integer.value;
189 191
190 /* 192 /*
@@ -197,7 +199,8 @@ acpi_ex_opcode_3A_1T_1R (
197 199
198 if ((index + length) > 200 if ((index + length) >
199 operand[0]->string.length) { 201 operand[0]->string.length) {
200 length = (acpi_size) operand[0]->string.length - index; 202 length = (acpi_size) operand[0]->string.length -
203 (acpi_size) index;
201 } 204 }
202 205
203 /* Allocate a new buffer for the String/Buffer */ 206 /* Allocate a new buffer for the String/Buffer */
diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c
index d32624331626..17f81d42ee41 100644
--- a/drivers/acpi/executer/exoparg6.c
+++ b/drivers/acpi/executer/exoparg6.c
@@ -75,6 +75,14 @@
75 * fully resolved operands. 75 * fully resolved operands.
76!*/ 76!*/
77 77
78/* Local prototypes */
79
80static u8
81acpi_ex_do_match (
82 u32 match_op,
83 union acpi_operand_object *package_obj,
84 union acpi_operand_object *match_obj);
85
78 86
79/******************************************************************************* 87/*******************************************************************************
80 * 88 *
@@ -92,7 +100,7 @@
92 * 100 *
93 ******************************************************************************/ 101 ******************************************************************************/
94 102
95u8 103static u8
96acpi_ex_do_match ( 104acpi_ex_do_match (
97 u32 match_op, 105 u32 match_op,
98 union acpi_operand_object *package_obj, 106 union acpi_operand_object *package_obj,
@@ -216,11 +224,12 @@ acpi_ex_opcode_6A_0T_1R (
216 union acpi_operand_object **operand = &walk_state->operands[0]; 224 union acpi_operand_object **operand = &walk_state->operands[0];
217 union acpi_operand_object *return_desc = NULL; 225 union acpi_operand_object *return_desc = NULL;
218 acpi_status status = AE_OK; 226 acpi_status status = AE_OK;
219 u32 index; 227 acpi_integer index;
220 union acpi_operand_object *this_element; 228 union acpi_operand_object *this_element;
221 229
222 230
223 ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); 231 ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R",
232 acpi_ps_get_opcode_name (walk_state->opcode));
224 233
225 234
226 switch (walk_state->opcode) { 235 switch (walk_state->opcode) {
@@ -241,9 +250,11 @@ acpi_ex_opcode_6A_0T_1R (
241 250
242 /* Get the package start_index, validate against the package length */ 251 /* Get the package start_index, validate against the package length */
243 252
244 index = (u32) operand[5]->integer.value; 253 index = operand[5]->integer.value;
245 if (index >= (u32) operand[0]->package.count) { 254 if (index >= operand[0]->package.count) {
246 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index beyond package end\n")); 255 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
256 "Index (%X%8.8X) beyond package end (%X)\n",
257 ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
247 status = AE_AML_PACKAGE_LIMIT; 258 status = AE_AML_PACKAGE_LIMIT;
248 goto cleanup; 259 goto cleanup;
249 } 260 }
@@ -314,13 +325,12 @@ acpi_ex_opcode_6A_0T_1R (
314 325
315 default: 326 default:
316 327
317 ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", 328 ACPI_REPORT_ERROR (("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n",
318 walk_state->opcode)); 329 walk_state->opcode));
319 status = AE_AML_BAD_OPCODE; 330 status = AE_AML_BAD_OPCODE;
320 goto cleanup; 331 goto cleanup;
321 } 332 }
322 333
323
324 walk_state->result_obj = return_desc; 334 walk_state->result_obj = return_desc;
325 335
326 336
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c
index 264ef3bba31b..c9e3c68b5549 100644
--- a/drivers/acpi/executer/exprep.c
+++ b/drivers/acpi/executer/exprep.c
@@ -52,8 +52,23 @@
52#define _COMPONENT ACPI_EXECUTER 52#define _COMPONENT ACPI_EXECUTER
53 ACPI_MODULE_NAME ("exprep") 53 ACPI_MODULE_NAME ("exprep")
54 54
55/* Local prototypes */
56
57static u32
58acpi_ex_decode_field_access (
59 union acpi_operand_object *obj_desc,
60 u8 field_flags,
61 u32 *return_byte_alignment);
62
55 63
56#ifdef ACPI_UNDER_DEVELOPMENT 64#ifdef ACPI_UNDER_DEVELOPMENT
65
66static u32
67acpi_ex_generate_access (
68 u32 field_bit_offset,
69 u32 field_bit_length,
70 u32 region_length);
71
57/******************************************************************************* 72/*******************************************************************************
58 * 73 *
59 * FUNCTION: acpi_ex_generate_access 74 * FUNCTION: acpi_ex_generate_access
@@ -99,12 +114,14 @@ acpi_ex_generate_access (
99 /* Round Field start offset and length to "minimal" byte boundaries */ 114 /* Round Field start offset and length to "minimal" byte boundaries */
100 115
101 field_byte_offset = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8)); 116 field_byte_offset = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8));
102 field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length + field_bit_offset, 8)); 117 field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length +
118 field_bit_offset, 8));
103 field_byte_length = field_byte_end_offset - field_byte_offset; 119 field_byte_length = field_byte_end_offset - field_byte_offset;
104 120
105 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 121 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
106 "Bit length %d, Bit offset %d\n", 122 "Bit length %d, Bit offset %d\n",
107 field_bit_length, field_bit_offset)); 123 field_bit_length, field_bit_offset));
124
108 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 125 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
109 "Byte Length %d, Byte Offset %d, End Offset %d\n", 126 "Byte Length %d, Byte Offset %d, End Offset %d\n",
110 field_byte_length, field_byte_offset, field_byte_end_offset)); 127 field_byte_length, field_byte_offset, field_byte_end_offset));
@@ -117,20 +134,26 @@ acpi_ex_generate_access (
117 */ 134 */
118 for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) { 135 for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) {
119 /* 136 /*
120 * 1) Round end offset up to next access boundary and make sure that this 137 * 1) Round end offset up to next access boundary and make sure that
121 * does not go beyond the end of the parent region. 138 * this does not go beyond the end of the parent region.
122 * 2) When the Access width is greater than the field_byte_length, we are done. 139 * 2) When the Access width is greater than the field_byte_length, we
123 * (This does not optimize for the perfectly aligned case yet). 140 * are done. (This does not optimize for the perfectly aligned
141 * case yet).
124 */ 142 */
125 if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) { 143 if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) {
126 field_start_offset = ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) / 144 field_start_offset =
127 access_byte_width; 145 ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) /
128 field_end_offset = ACPI_ROUND_UP ((field_byte_length + field_byte_offset), 146 access_byte_width;
129 access_byte_width) / access_byte_width; 147
130 accesses = field_end_offset - field_start_offset; 148 field_end_offset =
149 ACPI_ROUND_UP ((field_byte_length + field_byte_offset),
150 access_byte_width) / access_byte_width;
151
152 accesses = field_end_offset - field_start_offset;
131 153
132 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 154 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
133 "access_width %d end is within region\n", access_byte_width)); 155 "access_width %d end is within region\n", access_byte_width));
156
134 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 157 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
135 "Field Start %d, Field End %d -- requires %d accesses\n", 158 "Field Start %d, Field End %d -- requires %d accesses\n",
136 field_start_offset, field_end_offset, accesses)); 159 field_start_offset, field_end_offset, accesses));
@@ -139,8 +162,8 @@ acpi_ex_generate_access (
139 162
140 if (accesses <= 1) { 163 if (accesses <= 1) {
141 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 164 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
142 "Entire field can be accessed with one operation of size %d\n", 165 "Entire field can be accessed with one operation of size %d\n",
143 access_byte_width)); 166 access_byte_width));
144 return_VALUE (access_byte_width); 167 return_VALUE (access_byte_width);
145 } 168 }
146 169
@@ -155,15 +178,20 @@ acpi_ex_generate_access (
155 } 178 }
156 else { 179 else {
157 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 180 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
158 "access_width %d end is NOT within region\n", access_byte_width)); 181 "access_width %d end is NOT within region\n", access_byte_width));
159 if (access_byte_width == 1) { 182 if (access_byte_width == 1) {
160 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 183 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
161 "Field goes beyond end-of-region!\n")); 184 "Field goes beyond end-of-region!\n"));
162 return_VALUE (0); /* Field does not fit in the region at all */
163 }
164 185
165 /* This width goes beyond the end-of-region, back off to previous access */ 186 /* Field does not fit in the region at all */
166 187
188 return_VALUE (0);
189 }
190
191 /*
192 * This width goes beyond the end-of-region, back off to
193 * previous access
194 */
167 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 195 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
168 "Backing off to previous optimal access width of %d\n", 196 "Backing off to previous optimal access width of %d\n",
169 minimum_access_width)); 197 minimum_access_width));
@@ -171,8 +199,10 @@ acpi_ex_generate_access (
171 } 199 }
172 } 200 }
173 201
174 /* Could not read/write field with one operation, just use max access width */ 202 /*
175 203 * Could not read/write field with one operation,
204 * just use max access width
205 */
176 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 206 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
177 "Cannot access field in one operation, using width 8\n")); 207 "Cannot access field in one operation, using width 8\n"));
178 return_VALUE (8); 208 return_VALUE (8);
@@ -184,8 +214,9 @@ acpi_ex_generate_access (
184 * 214 *
185 * FUNCTION: acpi_ex_decode_field_access 215 * FUNCTION: acpi_ex_decode_field_access
186 * 216 *
187 * PARAMETERS: Access - Encoded field access bits 217 * PARAMETERS: obj_desc - Field object
188 * Length - Field length. 218 * field_flags - Encoded fieldflags (contains access bits)
219 * return_byte_alignment - Where the byte alignment is returned
189 * 220 *
190 * RETURN: Field granularity (8, 16, 32 or 64) and 221 * RETURN: Field granularity (8, 16, 32 or 64) and
191 * byte_alignment (1, 2, 3, or 4) 222 * byte_alignment (1, 2, 3, or 4)
@@ -214,9 +245,10 @@ acpi_ex_decode_field_access (
214 case AML_FIELD_ACCESS_ANY: 245 case AML_FIELD_ACCESS_ANY:
215 246
216#ifdef ACPI_UNDER_DEVELOPMENT 247#ifdef ACPI_UNDER_DEVELOPMENT
217 byte_alignment = acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset, 248 byte_alignment =
218 obj_desc->common_field.bit_length, 249 acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset,
219 0xFFFFFFFF /* Temp until we pass region_length as param */); 250 obj_desc->common_field.bit_length,
251 0xFFFFFFFF /* Temp until we pass region_length as parameter */);
220 bit_length = byte_alignment * 8; 252 bit_length = byte_alignment * 8;
221#endif 253#endif
222 254
@@ -276,6 +308,7 @@ acpi_ex_decode_field_access (
276 * field_flags - Access, lock_rule, and update_rule. 308 * field_flags - Access, lock_rule, and update_rule.
277 * The format of a field_flag is described 309 * The format of a field_flag is described
278 * in the ACPI specification 310 * in the ACPI specification
311 * field_attribute - Special attributes (not used)
279 * field_bit_position - Field start position 312 * field_bit_position - Field start position
280 * field_bit_length - Field length in number of bits 313 * field_bit_length - Field length in number of bits
281 * 314 *
@@ -337,7 +370,7 @@ acpi_ex_prep_common_field_object (
337 /* Setup width (access granularity) fields */ 370 /* Setup width (access granularity) fields */
338 371
339 obj_desc->common_field.access_byte_width = (u8) 372 obj_desc->common_field.access_byte_width = (u8)
340 ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */ 373 ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */
341 374
342 obj_desc->common_field.access_bit_width = (u8) access_bit_width; 375 obj_desc->common_field.access_bit_width = (u8) access_bit_width;
343 376
@@ -380,11 +413,7 @@ acpi_ex_prep_common_field_object (
380 * 413 *
381 * FUNCTION: acpi_ex_prep_field_value 414 * FUNCTION: acpi_ex_prep_field_value
382 * 415 *
383 * PARAMETERS: Node - Owning Node 416 * PARAMETERS: Info - Contains all field creation info
384 * region_node - Region in which field is being defined
385 * field_flags - Access, lock_rule, and update_rule.
386 * field_bit_position - Field start position
387 * field_bit_length - Field length in number of bits
388 * 417 *
389 * RETURN: Status 418 * RETURN: Status
390 * 419 *
@@ -445,7 +474,7 @@ acpi_ex_prep_field_value (
445 switch (info->field_type) { 474 switch (info->field_type) {
446 case ACPI_TYPE_LOCAL_REGION_FIELD: 475 case ACPI_TYPE_LOCAL_REGION_FIELD:
447 476
448 obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node); 477 obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node);
449 478
450 /* An additional reference for the container */ 479 /* An additional reference for the container */
451 480
@@ -461,8 +490,10 @@ acpi_ex_prep_field_value (
461 case ACPI_TYPE_LOCAL_BANK_FIELD: 490 case ACPI_TYPE_LOCAL_BANK_FIELD:
462 491
463 obj_desc->bank_field.value = info->bank_value; 492 obj_desc->bank_field.value = info->bank_value;
464 obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (info->region_node); 493 obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (
465 obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object (info->register_node); 494 info->region_node);
495 obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object (
496 info->register_node);
466 497
467 /* An additional reference for the attached objects */ 498 /* An additional reference for the attached objects */
468 499
@@ -481,10 +512,13 @@ acpi_ex_prep_field_value (
481 512
482 case ACPI_TYPE_LOCAL_INDEX_FIELD: 513 case ACPI_TYPE_LOCAL_INDEX_FIELD:
483 514
484 obj_desc->index_field.index_obj = acpi_ns_get_attached_object (info->register_node); 515 obj_desc->index_field.index_obj = acpi_ns_get_attached_object (
485 obj_desc->index_field.data_obj = acpi_ns_get_attached_object (info->data_register_node); 516 info->register_node);
517 obj_desc->index_field.data_obj = acpi_ns_get_attached_object (
518 info->data_register_node);
486 obj_desc->index_field.value = (u32) 519 obj_desc->index_field.value = (u32)
487 (info->field_bit_position / ACPI_MUL_8 (obj_desc->field.access_byte_width)); 520 (info->field_bit_position / ACPI_MUL_8 (
521 obj_desc->field.access_byte_width));
488 522
489 if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) { 523 if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) {
490 ACPI_REPORT_ERROR (("Null Index Object during field prep\n")); 524 ACPI_REPORT_ERROR (("Null Index Object during field prep\n"));
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c
index 7cfd0684c70b..723aaef4bb4a 100644
--- a/drivers/acpi/executer/exregion.c
+++ b/drivers/acpi/executer/exregion.c
@@ -115,7 +115,6 @@ acpi_ex_system_memory_space_handler (
115 return_ACPI_STATUS (AE_AML_OPERAND_VALUE); 115 return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
116 } 116 }
117 117
118
119#ifndef ACPI_MISALIGNED_TRANSFERS 118#ifndef ACPI_MISALIGNED_TRANSFERS
120 /* 119 /*
121 * Hardware does not support non-aligned data transfers, we must verify 120 * Hardware does not support non-aligned data transfers, we must verify
@@ -134,7 +133,8 @@ acpi_ex_system_memory_space_handler (
134 */ 133 */
135 if ((address < mem_info->mapped_physical_address) || 134 if ((address < mem_info->mapped_physical_address) ||
136 (((acpi_integer) address + length) > 135 (((acpi_integer) address + length) >
137 ((acpi_integer) mem_info->mapped_physical_address + mem_info->mapped_length))) { 136 ((acpi_integer)
137 mem_info->mapped_physical_address + mem_info->mapped_length))) {
138 /* 138 /*
139 * The request cannot be resolved by the current memory mapping; 139 * The request cannot be resolved by the current memory mapping;
140 * Delete the existing mapping and create a new one. 140 * Delete the existing mapping and create a new one.
@@ -150,7 +150,9 @@ acpi_ex_system_memory_space_handler (
150 * Don't attempt to map memory beyond the end of the region, and 150 * Don't attempt to map memory beyond the end of the region, and
151 * constrain the maximum mapping size to something reasonable. 151 * constrain the maximum mapping size to something reasonable.
152 */ 152 */
153 window_size = (acpi_size) ((mem_info->address + mem_info->length) - address); 153 window_size = (acpi_size)
154 ((mem_info->address + mem_info->length) - address);
155
154 if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) { 156 if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) {
155 window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE; 157 window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE;
156 } 158 }
@@ -160,8 +162,9 @@ acpi_ex_system_memory_space_handler (
160 status = acpi_os_map_memory (address, window_size, 162 status = acpi_os_map_memory (address, window_size,
161 (void **) &mem_info->mapped_logical_address); 163 (void **) &mem_info->mapped_logical_address);
162 if (ACPI_FAILURE (status)) { 164 if (ACPI_FAILURE (status)) {
163 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X%8.8X, size %X\n", 165 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
164 ACPI_FORMAT_UINT64 (address), (u32) window_size)); 166 "Could not map memory at %8.8X%8.8X, size %X\n",
167 ACPI_FORMAT_UINT64 (address), (u32) window_size));
165 mem_info->mapped_length = 0; 168 mem_info->mapped_length = 0;
166 return_ACPI_STATUS (status); 169 return_ACPI_STATUS (status);
167 } 170 }
@@ -177,10 +180,12 @@ acpi_ex_system_memory_space_handler (
177 * access 180 * access
178 */ 181 */
179 logical_addr_ptr = mem_info->mapped_logical_address + 182 logical_addr_ptr = mem_info->mapped_logical_address +
180 ((acpi_integer) address - (acpi_integer) mem_info->mapped_physical_address); 183 ((acpi_integer) address -
184 (acpi_integer) mem_info->mapped_physical_address);
181 185
182 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 186 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
183 "system_memory %d (%d width) Address=%8.8X%8.8X\n", function, bit_width, 187 "system_memory %d (%d width) Address=%8.8X%8.8X\n",
188 function, bit_width,
184 ACPI_FORMAT_UINT64 (address))); 189 ACPI_FORMAT_UINT64 (address)));
185 190
186 /* 191 /*
@@ -298,13 +303,15 @@ acpi_ex_system_io_space_handler (
298 switch (function) { 303 switch (function) {
299 case ACPI_READ: 304 case ACPI_READ:
300 305
301 status = acpi_os_read_port ((acpi_io_address) address, &value32, bit_width); 306 status = acpi_os_read_port ((acpi_io_address) address,
307 &value32, bit_width);
302 *value = value32; 308 *value = value32;
303 break; 309 break;
304 310
305 case ACPI_WRITE: 311 case ACPI_WRITE:
306 312
307 status = acpi_os_write_port ((acpi_io_address) address, (u32) *value, bit_width); 313 status = acpi_os_write_port ((acpi_io_address) address,
314 (u32) *value, bit_width);
308 break; 315 break;
309 316
310 default: 317 default:
@@ -375,12 +382,14 @@ acpi_ex_pci_config_space_handler (
375 case ACPI_READ: 382 case ACPI_READ:
376 383
377 *value = 0; 384 *value = 0;
378 status = acpi_os_read_pci_configuration (pci_id, pci_register, value, bit_width); 385 status = acpi_os_read_pci_configuration (pci_id, pci_register,
386 value, bit_width);
379 break; 387 break;
380 388
381 case ACPI_WRITE: 389 case ACPI_WRITE:
382 390
383 status = acpi_os_write_pci_configuration (pci_id, pci_register, *value, bit_width); 391 status = acpi_os_write_pci_configuration (pci_id, pci_register,
392 *value, bit_width);
384 break; 393 break;
385 394
386 default: 395 default:
@@ -505,8 +514,7 @@ acpi_ex_data_table_space_handler (
505 514
506 logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address); 515 logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address);
507 516
508 517 /* Perform the memory read or write */
509 /* Perform the memory read or write */
510 518
511 switch (function) { 519 switch (function) {
512 case ACPI_READ: 520 case ACPI_READ:
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c
index 7936329a0e35..21d5c74fa309 100644
--- a/drivers/acpi/executer/exresnte.c
+++ b/drivers/acpi/executer/exresnte.c
@@ -210,15 +210,15 @@ acpi_ex_resolve_node_to_value (
210 case ACPI_TYPE_LOCAL_BANK_FIELD: 210 case ACPI_TYPE_LOCAL_BANK_FIELD:
211 case ACPI_TYPE_LOCAL_INDEX_FIELD: 211 case ACPI_TYPE_LOCAL_INDEX_FIELD:
212 212
213 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "field_read Node=%p source_desc=%p Type=%X\n", 213 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
214 "field_read Node=%p source_desc=%p Type=%X\n",
214 node, source_desc, entry_type)); 215 node, source_desc, entry_type));
215 216
216 status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc); 217 status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc);
217 break; 218 break;
218 219
219 /* 220 /* For these objects, just return the object attached to the Node */
220 * For these objects, just return the object attached to the Node 221
221 */
222 case ACPI_TYPE_MUTEX: 222 case ACPI_TYPE_MUTEX:
223 case ACPI_TYPE_METHOD: 223 case ACPI_TYPE_METHOD:
224 case ACPI_TYPE_POWER: 224 case ACPI_TYPE_POWER:
@@ -233,12 +233,12 @@ acpi_ex_resolve_node_to_value (
233 acpi_ut_add_reference (obj_desc); 233 acpi_ut_add_reference (obj_desc);
234 break; 234 break;
235 235
236
237 /* TYPE_ANY is untyped, and thus there is no object associated with it */ 236 /* TYPE_ANY is untyped, and thus there is no object associated with it */
238 237
239 case ACPI_TYPE_ANY: 238 case ACPI_TYPE_ANY:
240 239
241 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Untyped entry %p, no attached object!\n", 240 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
241 "Untyped entry %p, no attached object!\n",
242 node)); 242 node));
243 243
244 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ 244 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
@@ -259,7 +259,8 @@ acpi_ex_resolve_node_to_value (
259 default: 259 default:
260 /* No named references are allowed here */ 260 /* No named references are allowed here */
261 261
262 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X (%s)\n", 262 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
263 "Unsupported Reference opcode %X (%s)\n",
263 source_desc->reference.opcode, 264 source_desc->reference.opcode,
264 acpi_ps_get_opcode_name (source_desc->reference.opcode))); 265 acpi_ps_get_opcode_name (source_desc->reference.opcode)));
265 266
@@ -268,11 +269,12 @@ acpi_ex_resolve_node_to_value (
268 break; 269 break;
269 270
270 271
271 /* Default case is for unknown types */
272
273 default: 272 default:
274 273
275 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Node %p - Unknown object type %X\n", 274 /* Default case is for unknown types */
275
276 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
277 "Node %p - Unknown object type %X\n",
276 node, entry_type)); 278 node, entry_type));
277 279
278 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 280 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -280,7 +282,7 @@ acpi_ex_resolve_node_to_value (
280 } /* switch (entry_type) */ 282 } /* switch (entry_type) */
281 283
282 284
283 /* Put the object descriptor on the stack */ 285 /* Return the object descriptor */
284 286
285 *object_ptr = (void *) obj_desc; 287 *object_ptr = (void *) obj_desc;
286 return_ACPI_STATUS (status); 288 return_ACPI_STATUS (status);
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c
index 7be604911156..3de45672379a 100644
--- a/drivers/acpi/executer/exresolv.c
+++ b/drivers/acpi/executer/exresolv.c
@@ -54,6 +54,13 @@
54#define _COMPONENT ACPI_EXECUTER 54#define _COMPONENT ACPI_EXECUTER
55 ACPI_MODULE_NAME ("exresolv") 55 ACPI_MODULE_NAME ("exresolv")
56 56
57/* Local prototypes */
58
59static acpi_status
60acpi_ex_resolve_object_to_value (
61 union acpi_operand_object **stack_ptr,
62 struct acpi_walk_state *walk_state);
63
57 64
58/******************************************************************************* 65/*******************************************************************************
59 * 66 *
@@ -96,6 +103,11 @@ acpi_ex_resolve_to_value (
96 if (ACPI_FAILURE (status)) { 103 if (ACPI_FAILURE (status)) {
97 return_ACPI_STATUS (status); 104 return_ACPI_STATUS (status);
98 } 105 }
106
107 if (!*stack_ptr) {
108 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
109 return_ACPI_STATUS (AE_AML_NO_OPERAND);
110 }
99 } 111 }
100 112
101 /* 113 /*
@@ -120,18 +132,17 @@ acpi_ex_resolve_to_value (
120 * 132 *
121 * FUNCTION: acpi_ex_resolve_object_to_value 133 * FUNCTION: acpi_ex_resolve_object_to_value
122 * 134 *
123 * PARAMETERS: stack_ptr - Pointer to a stack location that contains a 135 * PARAMETERS: stack_ptr - Pointer to an internal object
124 * ptr to an internal object.
125 * walk_state - Current method state 136 * walk_state - Current method state
126 * 137 *
127 * RETURN: Status 138 * RETURN: Status
128 * 139 *
129 * DESCRIPTION: Retrieve the value from an internal object. The Reference type 140 * DESCRIPTION: Retrieve the value from an internal object. The Reference type
130 * uses the associated AML opcode to determine the value. 141 * uses the associated AML opcode to determine the value.
131 * 142 *
132 ******************************************************************************/ 143 ******************************************************************************/
133 144
134acpi_status 145static acpi_status
135acpi_ex_resolve_object_to_value ( 146acpi_ex_resolve_object_to_value (
136 union acpi_operand_object **stack_ptr, 147 union acpi_operand_object **stack_ptr,
137 struct acpi_walk_state *walk_state) 148 struct acpi_walk_state *walk_state)
@@ -159,7 +170,7 @@ acpi_ex_resolve_object_to_value (
159 case AML_NAME_OP: 170 case AML_NAME_OP:
160 171
161 /* 172 /*
162 * Convert indirect name ptr to a direct name ptr. 173 * Convert name reference to a namespace node
163 * Then, acpi_ex_resolve_node_to_value can be used to get the value 174 * Then, acpi_ex_resolve_node_to_value can be used to get the value
164 */ 175 */
165 temp_node = stack_desc->reference.object; 176 temp_node = stack_desc->reference.object;
@@ -168,7 +179,7 @@ acpi_ex_resolve_object_to_value (
168 179
169 acpi_ut_remove_reference (stack_desc); 180 acpi_ut_remove_reference (stack_desc);
170 181
171 /* Put direct name pointer onto stack and exit */ 182 /* Return the namespace node */
172 183
173 (*stack_ptr) = temp_node; 184 (*stack_ptr) = temp_node;
174 break; 185 break;
@@ -255,10 +266,19 @@ acpi_ex_resolve_object_to_value (
255 266
256 break; 267 break;
257 268
269 case AML_INT_NAMEPATH_OP: /* Reference to a named object */
270
271 /* Get the object pointed to by the namespace node */
272
273 *stack_ptr = (stack_desc->reference.node)->object;
274 acpi_ut_add_reference (*stack_ptr);
275 acpi_ut_remove_reference (stack_desc);
276 break;
258 277
259 default: 278 default:
260 279
261 ACPI_REPORT_ERROR (("During resolve, Unknown Reference opcode %X (%s) in %p\n", 280 ACPI_REPORT_ERROR ((
281 "During resolve, Unknown Reference opcode %X (%s) in %p\n",
262 opcode, acpi_ps_get_opcode_name (opcode), stack_desc)); 282 opcode, acpi_ps_get_opcode_name (opcode), stack_desc));
263 status = AE_AML_INTERNAL; 283 status = AE_AML_INTERNAL;
264 break; 284 break;
@@ -278,9 +298,8 @@ acpi_ex_resolve_object_to_value (
278 break; 298 break;
279 299
280 300
281 /* 301 /* These cases may never happen here, but just in case.. */
282 * These cases may never happen here, but just in case.. 302
283 */
284 case ACPI_TYPE_BUFFER_FIELD: 303 case ACPI_TYPE_BUFFER_FIELD:
285 case ACPI_TYPE_LOCAL_REGION_FIELD: 304 case ACPI_TYPE_LOCAL_REGION_FIELD:
286 case ACPI_TYPE_LOCAL_BANK_FIELD: 305 case ACPI_TYPE_LOCAL_BANK_FIELD:
@@ -333,9 +352,8 @@ acpi_ex_resolve_multiple (
333 ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple"); 352 ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple");
334 353
335 354
336 /* 355 /* Operand can be either a namespace node or an operand descriptor */
337 * Operand can be either a namespace node or an operand descriptor 356
338 */
339 switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { 357 switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
340 case ACPI_DESC_TYPE_OPERAND: 358 case ACPI_DESC_TYPE_OPERAND:
341 type = obj_desc->common.type; 359 type = obj_desc->common.type;
@@ -357,10 +375,8 @@ acpi_ex_resolve_multiple (
357 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 375 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
358 } 376 }
359 377
378 /* If type is anything other than a reference, we are done */
360 379
361 /*
362 * If type is anything other than a reference, we are done
363 */
364 if (type != ACPI_TYPE_LOCAL_REFERENCE) { 380 if (type != ACPI_TYPE_LOCAL_REFERENCE) {
365 goto exit; 381 goto exit;
366 } 382 }
@@ -382,8 +398,9 @@ acpi_ex_resolve_multiple (
382 /* All "References" point to a NS node */ 398 /* All "References" point to a NS node */
383 399
384 if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { 400 if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
385 ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", 401 ACPI_REPORT_ERROR ((
386 node, acpi_ut_get_descriptor_name (node))); 402 "acpi_ex_resolve_multiple: Not a NS node %p [%s]\n",
403 node, acpi_ut_get_descriptor_name (node)));
387 return_ACPI_STATUS (AE_AML_INTERNAL); 404 return_ACPI_STATUS (AE_AML_INTERNAL);
388 } 405 }
389 406
@@ -440,8 +457,9 @@ acpi_ex_resolve_multiple (
440 /* All "References" point to a NS node */ 457 /* All "References" point to a NS node */
441 458
442 if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { 459 if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
443 ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", 460 ACPI_REPORT_ERROR ((
444 node, acpi_ut_get_descriptor_name (node))); 461 "acpi_ex_resolve_multiple: Not a NS node %p [%s]\n",
462 node, acpi_ut_get_descriptor_name (node)));
445 return_ACPI_STATUS (AE_AML_INTERNAL); 463 return_ACPI_STATUS (AE_AML_INTERNAL);
446 } 464 }
447 465
@@ -468,7 +486,7 @@ acpi_ex_resolve_multiple (
468 486
469 if (return_desc) { 487 if (return_desc) {
470 status = acpi_ds_method_data_get_value (obj_desc->reference.opcode, 488 status = acpi_ds_method_data_get_value (obj_desc->reference.opcode,
471 obj_desc->reference.offset, walk_state, &obj_desc); 489 obj_desc->reference.offset, walk_state, &obj_desc);
472 if (ACPI_FAILURE (status)) { 490 if (ACPI_FAILURE (status)) {
473 return_ACPI_STATUS (status); 491 return_ACPI_STATUS (status);
474 } 492 }
@@ -500,7 +518,8 @@ acpi_ex_resolve_multiple (
500 518
501 default: 519 default:
502 520
503 ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", 521 ACPI_REPORT_ERROR ((
522 "acpi_ex_resolve_multiple: Unknown Reference subtype %X\n",
504 obj_desc->reference.opcode)); 523 obj_desc->reference.opcode));
505 return_ACPI_STATUS (AE_AML_INTERNAL); 524 return_ACPI_STATUS (AE_AML_INTERNAL);
506 } 525 }
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c
index c92890220c32..d8b470eefe7a 100644
--- a/drivers/acpi/executer/exresop.c
+++ b/drivers/acpi/executer/exresop.c
@@ -52,6 +52,14 @@
52#define _COMPONENT ACPI_EXECUTER 52#define _COMPONENT ACPI_EXECUTER
53 ACPI_MODULE_NAME ("exresop") 53 ACPI_MODULE_NAME ("exresop")
54 54
55/* Local prototypes */
56
57static acpi_status
58acpi_ex_check_object_type (
59 acpi_object_type type_needed,
60 acpi_object_type this_type,
61 void *object);
62
55 63
56/******************************************************************************* 64/*******************************************************************************
57 * 65 *
@@ -67,7 +75,7 @@
67 * 75 *
68 ******************************************************************************/ 76 ******************************************************************************/
69 77
70acpi_status 78static acpi_status
71acpi_ex_check_object_type ( 79acpi_ex_check_object_type (
72 acpi_object_type type_needed, 80 acpi_object_type type_needed,
73 acpi_object_type this_type, 81 acpi_object_type this_type,
@@ -142,6 +150,7 @@ acpi_ex_resolve_operands (
142 const struct acpi_opcode_info *op_info; 150 const struct acpi_opcode_info *op_info;
143 u32 this_arg_type; 151 u32 this_arg_type;
144 acpi_object_type type_needed; 152 acpi_object_type type_needed;
153 u16 target_op = 0;
145 154
146 155
147 ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode); 156 ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode);
@@ -160,7 +169,8 @@ acpi_ex_resolve_operands (
160 return_ACPI_STATUS (AE_AML_INTERNAL); 169 return_ACPI_STATUS (AE_AML_INTERNAL);
161 } 170 }
162 171
163 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] required_operand_types=%8.8X \n", 172 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
173 "Opcode %X [%s] required_operand_types=%8.8X \n",
164 opcode, op_info->name, arg_types)); 174 opcode, op_info->name, arg_types));
165 175
166 /* 176 /*
@@ -187,7 +197,7 @@ acpi_ex_resolve_operands (
187 switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { 197 switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
188 case ACPI_DESC_TYPE_NAMED: 198 case ACPI_DESC_TYPE_NAMED:
189 199
190 /* Node */ 200 /* Namespace Node */
191 201
192 object_type = ((struct acpi_namespace_node *) obj_desc)->type; 202 object_type = ((struct acpi_namespace_node *) obj_desc)->type;
193 break; 203 break;
@@ -202,16 +212,16 @@ acpi_ex_resolve_operands (
202 /* Check for bad acpi_object_type */ 212 /* Check for bad acpi_object_type */
203 213
204 if (!acpi_ut_valid_object_type (object_type)) { 214 if (!acpi_ut_valid_object_type (object_type)) {
205 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad operand object type [%X]\n", 215 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
216 "Bad operand object type [%X]\n",
206 object_type)); 217 object_type));
207 218
208 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 219 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
209 } 220 }
210 221
211 if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { 222 if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
212 /* 223 /* Decode the Reference */
213 * Decode the Reference 224
214 */
215 op_info = acpi_ps_get_opcode_info (opcode); 225 op_info = acpi_ps_get_opcode_info (opcode);
216 if (op_info->class == AML_CLASS_UNKNOWN) { 226 if (op_info->class == AML_CLASS_UNKNOWN) {
217 return_ACPI_STATUS (AE_AML_BAD_OPCODE); 227 return_ACPI_STATUS (AE_AML_BAD_OPCODE);
@@ -219,12 +229,17 @@ acpi_ex_resolve_operands (
219 229
220 switch (obj_desc->reference.opcode) { 230 switch (obj_desc->reference.opcode) {
221 case AML_DEBUG_OP: 231 case AML_DEBUG_OP:
232 target_op = AML_DEBUG_OP;
233
234 /*lint -fallthrough */
235
222 case AML_NAME_OP: 236 case AML_NAME_OP:
223 case AML_INDEX_OP: 237 case AML_INDEX_OP:
224 case AML_REF_OF_OP: 238 case AML_REF_OF_OP:
225 case AML_ARG_OP: 239 case AML_ARG_OP:
226 case AML_LOCAL_OP: 240 case AML_LOCAL_OP:
227 case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ 241 case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
242 case AML_INT_NAMEPATH_OP: /* Reference to a named object */
228 243
229 ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 244 ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
230 "Operand is a Reference, ref_opcode [%s]\n", 245 "Operand is a Reference, ref_opcode [%s]\n",
@@ -254,10 +269,8 @@ acpi_ex_resolve_operands (
254 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 269 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
255 } 270 }
256 271
272 /* Get one argument type, point to the next */
257 273
258 /*
259 * Get one argument type, point to the next
260 */
261 this_arg_type = GET_CURRENT_ARG_TYPE (arg_types); 274 this_arg_type = GET_CURRENT_ARG_TYPE (arg_types);
262 INCREMENT_ARG_LIST (arg_types); 275 INCREMENT_ARG_LIST (arg_types);
263 276
@@ -271,26 +284,31 @@ acpi_ex_resolve_operands (
271 if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) && 284 if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
272 (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) { 285 (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) {
273 /* 286 /*
274 * String found - the string references a named object and must be 287 * String found - the string references a named object and
275 * resolved to a node 288 * must be resolved to a node
276 */ 289 */
277 goto next_operand; 290 goto next_operand;
278 } 291 }
279 292
280 /* Else not a string - fall through to the normal Reference case below */ 293 /*
294 * Else not a string - fall through to the normal Reference
295 * case below
296 */
281 /*lint -fallthrough */ 297 /*lint -fallthrough */
282 298
283 case ARGI_REFERENCE: /* References: */ 299 case ARGI_REFERENCE: /* References: */
284 case ARGI_INTEGER_REF: 300 case ARGI_INTEGER_REF:
285 case ARGI_OBJECT_REF: 301 case ARGI_OBJECT_REF:
286 case ARGI_DEVICE_REF: 302 case ARGI_DEVICE_REF:
287 case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ 303 case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
288 case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ 304 case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
289 case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ 305 case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
290
291 /* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE */
292 306
293 if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) /* Node (name) ptr OK as-is */ { 307 /*
308 * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
309 * A Namespace Node is OK as-is
310 */
311 if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
294 goto next_operand; 312 goto next_operand;
295 } 313 }
296 314
@@ -300,11 +318,9 @@ acpi_ex_resolve_operands (
300 return_ACPI_STATUS (status); 318 return_ACPI_STATUS (status);
301 } 319 }
302 320
303 if (AML_NAME_OP == obj_desc->reference.opcode) { 321 if (obj_desc->reference.opcode == AML_NAME_OP) {
304 /* 322 /* Convert a named reference to the actual named object */
305 * Convert an indirect name ptr to direct name ptr and put 323
306 * it on the stack
307 */
308 temp_node = obj_desc->reference.object; 324 temp_node = obj_desc->reference.object;
309 acpi_ut_remove_reference (obj_desc); 325 acpi_ut_remove_reference (obj_desc);
310 (*stack_ptr) = temp_node; 326 (*stack_ptr) = temp_node;
@@ -332,7 +348,6 @@ acpi_ex_resolve_operands (
332 break; 348 break;
333 } 349 }
334 350
335
336 /* 351 /*
337 * Resolve this object to a value 352 * Resolve this object to a value
338 */ 353 */
@@ -392,7 +407,7 @@ acpi_ex_resolve_operands (
392 /* 407 /*
393 * The more complex cases allow multiple resolved object types 408 * The more complex cases allow multiple resolved object types
394 */ 409 */
395 case ARGI_INTEGER: /* Number */ 410 case ARGI_INTEGER:
396 411
397 /* 412 /*
398 * Need an operand of type ACPI_TYPE_INTEGER, 413 * Need an operand of type ACPI_TYPE_INTEGER,
@@ -563,7 +578,7 @@ acpi_ex_resolve_operands (
563 578
564 case ARGI_REGION_OR_FIELD: 579 case ARGI_REGION_OR_FIELD:
565 580
566 /* Need an operand of type ACPI_TYPE_REGION or a FIELD in a region */ 581 /* Need an operand of type REGION or a FIELD in a region */
567 582
568 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { 583 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
569 case ACPI_TYPE_REGION: 584 case ACPI_TYPE_REGION:
@@ -614,6 +629,12 @@ acpi_ex_resolve_operands (
614 break; 629 break;
615 } 630 }
616 631
632 if (target_op == AML_DEBUG_OP) {
633 /* Allow store of any object to the Debug object */
634
635 break;
636 }
637
617 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 638 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
618 "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", 639 "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
619 acpi_ut_get_object_type_name (obj_desc), obj_desc)); 640 acpi_ut_get_object_type_name (obj_desc), obj_desc));
@@ -652,8 +673,7 @@ next_operand:
652 if (GET_CURRENT_ARG_TYPE (arg_types)) { 673 if (GET_CURRENT_ARG_TYPE (arg_types)) {
653 stack_ptr--; 674 stack_ptr--;
654 } 675 }
655 676 }
656 } /* while (*Types) */
657 677
658 return_ACPI_STATUS (status); 678 return_ACPI_STATUS (status);
659} 679}
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c
index e0fc6aba1253..2725db0901b8 100644
--- a/drivers/acpi/executer/exstore.c
+++ b/drivers/acpi/executer/exstore.c
@@ -48,11 +48,171 @@
48#include <acpi/acinterp.h> 48#include <acpi/acinterp.h>
49#include <acpi/amlcode.h> 49#include <acpi/amlcode.h>
50#include <acpi/acnamesp.h> 50#include <acpi/acnamesp.h>
51#include <acpi/acparser.h>
51 52
52 53
53#define _COMPONENT ACPI_EXECUTER 54#define _COMPONENT ACPI_EXECUTER
54 ACPI_MODULE_NAME ("exstore") 55 ACPI_MODULE_NAME ("exstore")
55 56
57/* Local prototypes */
58
59static void
60acpi_ex_do_debug_object (
61 union acpi_operand_object *source_desc,
62 u32 level,
63 u32 index);
64
65static acpi_status
66acpi_ex_store_object_to_index (
67 union acpi_operand_object *val_desc,
68 union acpi_operand_object *dest_desc,
69 struct acpi_walk_state *walk_state);
70
71
72/*******************************************************************************
73 *
74 * FUNCTION: acpi_ex_do_debug_object
75 *
76 * PARAMETERS: source_desc - Value to be stored
77 * Level - Indentation level (used for packages)
78 * Index - Current package element, zero if not pkg
79 *
80 * RETURN: None
81 *
82 * DESCRIPTION: Handles stores to the Debug Object.
83 *
84 ******************************************************************************/
85
86static void
87acpi_ex_do_debug_object (
88 union acpi_operand_object *source_desc,
89 u32 level,
90 u32 index)
91{
92 u32 i;
93
94
95 ACPI_FUNCTION_TRACE_PTR ("ex_do_debug_object", source_desc);
96
97
98 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
99 level, " "));
100
101 /* Display index for package output only */
102
103 if (index > 0) {
104 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
105 "(%.2u) ", index -1));
106 }
107
108 if (!source_desc) {
109 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n"));
110 return_VOID;
111 }
112
113 if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_OPERAND) {
114 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ",
115 acpi_ut_get_object_type_name (source_desc)));
116
117 if (!acpi_ut_valid_internal_object (source_desc)) {
118 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
119 "%p, Invalid Internal Object!\n", source_desc));
120 return_VOID;
121 }
122 }
123 else if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_NAMED) {
124 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
125 acpi_ut_get_type_name (((struct acpi_namespace_node *) source_desc)->type),
126 source_desc));
127 return_VOID;
128 }
129 else {
130 return_VOID;
131 }
132
133 switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
134 case ACPI_TYPE_INTEGER:
135
136 /* Output correct integer width */
137
138 if (acpi_gbl_integer_byte_width == 4) {
139 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
140 (u32) source_desc->integer.value));
141 }
142 else {
143 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
144 ACPI_FORMAT_UINT64 (source_desc->integer.value)));
145 }
146 break;
147
148 case ACPI_TYPE_BUFFER:
149
150 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
151 (u32) source_desc->buffer.length));
152 ACPI_DUMP_BUFFER (source_desc->buffer.pointer,
153 (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32);
154 break;
155
156 case ACPI_TYPE_STRING:
157
158 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
159 source_desc->string.length, source_desc->string.pointer));
160 break;
161
162 case ACPI_TYPE_PACKAGE:
163
164 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n",
165 source_desc->package.count));
166
167 /* Output the entire contents of the package */
168
169 for (i = 0; i < source_desc->package.count; i++) {
170 acpi_ex_do_debug_object (source_desc->package.elements[i],
171 level+4, i+1);
172 }
173 break;
174
175 case ACPI_TYPE_LOCAL_REFERENCE:
176
177 if (source_desc->reference.opcode == AML_INDEX_OP) {
178 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n",
179 acpi_ps_get_opcode_name (source_desc->reference.opcode),
180 source_desc->reference.offset));
181 }
182 else {
183 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
184 acpi_ps_get_opcode_name (source_desc->reference.opcode)));
185 }
186
187
188 if (source_desc->reference.object) {
189 if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) ==
190 ACPI_DESC_TYPE_NAMED) {
191 acpi_ex_do_debug_object (((struct acpi_namespace_node *)
192 source_desc->reference.object)->object,
193 level+4, 0);
194 }
195 else {
196 acpi_ex_do_debug_object (source_desc->reference.object, level+4, 0);
197 }
198 }
199 else if (source_desc->reference.node) {
200 acpi_ex_do_debug_object ((source_desc->reference.node)->object,
201 level+4, 0);
202 }
203 break;
204
205 default:
206
207 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n",
208 source_desc, acpi_ut_get_object_type_name (source_desc)));
209 break;
210 }
211
212 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
213 return_VOID;
214}
215
56 216
57/******************************************************************************* 217/*******************************************************************************
58 * 218 *
@@ -154,8 +314,9 @@ acpi_ex_store (
154 314
155 /* Storing an object into a Name "container" */ 315 /* Storing an object into a Name "container" */
156 316
157 status = acpi_ex_store_object_to_node (source_desc, ref_desc->reference.object, 317 status = acpi_ex_store_object_to_node (source_desc,
158 walk_state, ACPI_IMPLICIT_CONVERSION); 318 ref_desc->reference.object,
319 walk_state, ACPI_IMPLICIT_CONVERSION);
159 break; 320 break;
160 321
161 322
@@ -173,7 +334,7 @@ acpi_ex_store (
173 /* Store to a method local/arg */ 334 /* Store to a method local/arg */
174 335
175 status = acpi_ds_store_object_to_local (ref_desc->reference.opcode, 336 status = acpi_ds_store_object_to_local (ref_desc->reference.opcode,
176 ref_desc->reference.offset, source_desc, walk_state); 337 ref_desc->reference.offset, source_desc, walk_state);
177 break; 338 break;
178 339
179 340
@@ -187,60 +348,7 @@ acpi_ex_store (
187 "**** Write to Debug Object: Object %p %s ****:\n\n", 348 "**** Write to Debug Object: Object %p %s ****:\n\n",
188 source_desc, acpi_ut_get_object_type_name (source_desc))); 349 source_desc, acpi_ut_get_object_type_name (source_desc)));
189 350
190 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ", 351 acpi_ex_do_debug_object (source_desc, 0, 0);
191 acpi_ut_get_object_type_name (source_desc)));
192
193 if (!acpi_ut_valid_internal_object (source_desc)) {
194 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
195 "%p, Invalid Internal Object!\n", source_desc));
196 break;
197 }
198
199 switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
200 case ACPI_TYPE_INTEGER:
201
202 if (acpi_gbl_integer_byte_width == 4) {
203 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
204 (u32) source_desc->integer.value));
205 }
206 else {
207 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
208 ACPI_FORMAT_UINT64 (source_desc->integer.value)));
209 }
210 break;
211
212
213 case ACPI_TYPE_BUFFER:
214
215 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
216 (u32) source_desc->buffer.length));
217 ACPI_DUMP_BUFFER (source_desc->buffer.pointer,
218 (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32);
219 break;
220
221
222 case ACPI_TYPE_STRING:
223
224 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
225 source_desc->string.length, source_desc->string.pointer));
226 break;
227
228
229 case ACPI_TYPE_PACKAGE:
230
231 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] Elements Ptr - %p\n",
232 source_desc->package.count, source_desc->package.elements));
233 break;
234
235
236 default:
237
238 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n",
239 source_desc));
240 break;
241 }
242
243 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
244 break; 352 break;
245 353
246 354
@@ -272,7 +380,7 @@ acpi_ex_store (
272 * 380 *
273 ******************************************************************************/ 381 ******************************************************************************/
274 382
275acpi_status 383static acpi_status
276acpi_ex_store_object_to_index ( 384acpi_ex_store_object_to_index (
277 union acpi_operand_object *source_desc, 385 union acpi_operand_object *source_desc,
278 union acpi_operand_object *index_desc, 386 union acpi_operand_object *index_desc,
@@ -313,16 +421,22 @@ acpi_ex_store_object_to_index (
313 if (obj_desc) { 421 if (obj_desc) {
314 /* Decrement reference count by the ref count of the parent package */ 422 /* Decrement reference count by the ref count of the parent package */
315 423
316 for (i = 0; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) { 424 for (i = 0;
425 i < ((union acpi_operand_object *)
426 index_desc->reference.object)->common.reference_count;
427 i++) {
317 acpi_ut_remove_reference (obj_desc); 428 acpi_ut_remove_reference (obj_desc);
318 } 429 }
319 } 430 }
320 431
321 *(index_desc->reference.where) = new_desc; 432 *(index_desc->reference.where) = new_desc;
322 433
323 /* Increment reference count by the ref count of the parent package -1 */ 434 /* Increment ref count by the ref count of the parent package-1 */
324 435
325 for (i = 1; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) { 436 for (i = 1;
437 i < ((union acpi_operand_object *)
438 index_desc->reference.object)->common.reference_count;
439 i++) {
326 acpi_ut_add_reference (new_desc); 440 acpi_ut_add_reference (new_desc);
327 } 441 }
328 442
@@ -440,9 +554,8 @@ acpi_ex_store_object_to_node (
440 ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc); 554 ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc);
441 555
442 556
443 /* 557 /* Get current type of the node, and object attached to Node */
444 * Get current type of the node, and object attached to Node 558
445 */
446 target_type = acpi_ns_get_type (node); 559 target_type = acpi_ns_get_type (node);
447 target_desc = acpi_ns_get_attached_object (node); 560 target_desc = acpi_ns_get_attached_object (node);
448 561
@@ -467,19 +580,18 @@ acpi_ex_store_object_to_node (
467 target_type = ACPI_TYPE_ANY; 580 target_type = ACPI_TYPE_ANY;
468 } 581 }
469 582
470 /* 583 /* Do the actual store operation */
471 * Do the actual store operation 584
472 */
473 switch (target_type) { 585 switch (target_type) {
474 case ACPI_TYPE_BUFFER_FIELD: 586 case ACPI_TYPE_BUFFER_FIELD:
475 case ACPI_TYPE_LOCAL_REGION_FIELD: 587 case ACPI_TYPE_LOCAL_REGION_FIELD:
476 case ACPI_TYPE_LOCAL_BANK_FIELD: 588 case ACPI_TYPE_LOCAL_BANK_FIELD:
477 case ACPI_TYPE_LOCAL_INDEX_FIELD: 589 case ACPI_TYPE_LOCAL_INDEX_FIELD:
478 590
479 /* 591 /* For fields, copy the source data to the target field. */
480 * For fields, copy the source data to the target field. 592
481 */ 593 status = acpi_ex_write_data_to_field (source_desc, target_desc,
482 status = acpi_ex_write_data_to_field (source_desc, target_desc, &walk_state->result_obj); 594 &walk_state->result_obj);
483 break; 595 break;
484 596
485 597
@@ -493,7 +605,8 @@ acpi_ex_store_object_to_node (
493 * 605 *
494 * Copy and/or convert the source object to a new target object 606 * Copy and/or convert the source object to a new target object
495 */ 607 */
496 status = acpi_ex_store_object_to_object (source_desc, target_desc, &new_desc, walk_state); 608 status = acpi_ex_store_object_to_object (source_desc, target_desc,
609 &new_desc, walk_state);
497 if (ACPI_FAILURE (status)) { 610 if (ACPI_FAILURE (status)) {
498 return_ACPI_STATUS (status); 611 return_ACPI_STATUS (status);
499 } 612 }
@@ -526,7 +639,8 @@ acpi_ex_store_object_to_node (
526 639
527 /* No conversions for all other types. Just attach the source object */ 640 /* No conversions for all other types. Just attach the source object */
528 641
529 status = acpi_ns_attach_object (node, source_desc, ACPI_GET_OBJECT_TYPE (source_desc)); 642 status = acpi_ns_attach_object (node, source_desc,
643 ACPI_GET_OBJECT_TYPE (source_desc));
530 break; 644 break;
531 } 645 }
532 646
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c
index d3677feb07fd..120f30ed0bd4 100644
--- a/drivers/acpi/executer/exstoren.c
+++ b/drivers/acpi/executer/exstoren.c
@@ -81,9 +81,8 @@ acpi_ex_resolve_object (
81 ACPI_FUNCTION_TRACE ("ex_resolve_object"); 81 ACPI_FUNCTION_TRACE ("ex_resolve_object");
82 82
83 83
84 /* 84 /* Ensure we have a Target that can be stored to */
85 * Ensure we have a Target that can be stored to 85
86 */
87 switch (target_type) { 86 switch (target_type) {
88 case ACPI_TYPE_BUFFER_FIELD: 87 case ACPI_TYPE_BUFFER_FIELD:
89 case ACPI_TYPE_LOCAL_REGION_FIELD: 88 case ACPI_TYPE_LOCAL_REGION_FIELD:
@@ -118,16 +117,14 @@ acpi_ex_resolve_object (
118 break; 117 break;
119 } 118 }
120 119
121 /* 120 /* Must have a Integer, Buffer, or String */
122 * Must have a Integer, Buffer, or String 121
123 */
124 if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) && 122 if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) &&
125 (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) && 123 (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) &&
126 (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) && 124 (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) &&
127 !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) { 125 !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) {
128 /* 126 /* Conversion successful but still not a valid type */
129 * Conversion successful but still not a valid type 127
130 */
131 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 128 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
132 "Cannot assign type %s to %s (must be type Int/Str/Buf)\n", 129 "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
133 acpi_ut_get_object_type_name (source_desc), 130 acpi_ut_get_object_type_name (source_desc),
@@ -140,9 +137,8 @@ acpi_ex_resolve_object (
140 case ACPI_TYPE_LOCAL_ALIAS: 137 case ACPI_TYPE_LOCAL_ALIAS:
141 case ACPI_TYPE_LOCAL_METHOD_ALIAS: 138 case ACPI_TYPE_LOCAL_METHOD_ALIAS:
142 139
143 /* 140 /* Aliases are resolved by acpi_ex_prep_operands */
144 * Aliases are resolved by acpi_ex_prep_operands 141
145 */
146 ACPI_REPORT_ERROR (("Store into Alias - should never happen\n")); 142 ACPI_REPORT_ERROR (("Store into Alias - should never happen\n"));
147 status = AE_AML_INTERNAL; 143 status = AE_AML_INTERNAL;
148 break; 144 break;
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c
index 05e1ecae8d92..12d1527669c8 100644
--- a/drivers/acpi/executer/exstorob.c
+++ b/drivers/acpi/executer/exstorob.c
@@ -128,7 +128,8 @@ acpi_ex_store_buffer_to_buffer (
128 else { 128 else {
129 /* Truncate the source, copy only what will fit */ 129 /* Truncate the source, copy only what will fit */
130 130
131 ACPI_MEMCPY (target_desc->buffer.pointer, buffer, target_desc->buffer.length); 131 ACPI_MEMCPY (target_desc->buffer.pointer, buffer,
132 target_desc->buffer.length);
132 133
133 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 134 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
134 "Truncating source buffer from %X to %X\n", 135 "Truncating source buffer from %X to %X\n",
@@ -183,7 +184,8 @@ acpi_ex_store_string_to_string (
183 * String will fit in existing non-static buffer. 184 * String will fit in existing non-static buffer.
184 * Clear old string and copy in the new one 185 * Clear old string and copy in the new one
185 */ 186 */
186 ACPI_MEMSET (target_desc->string.pointer, 0, (acpi_size) target_desc->string.length + 1); 187 ACPI_MEMSET (target_desc->string.pointer, 0,
188 (acpi_size) target_desc->string.length + 1);
187 ACPI_MEMCPY (target_desc->string.pointer, buffer, length); 189 ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
188 } 190 }
189 else { 191 else {
@@ -198,7 +200,8 @@ acpi_ex_store_string_to_string (
198 ACPI_MEM_FREE (target_desc->string.pointer); 200 ACPI_MEM_FREE (target_desc->string.pointer);
199 } 201 }
200 202
201 target_desc->string.pointer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1); 203 target_desc->string.pointer = ACPI_MEM_CALLOCATE (
204 (acpi_size) length + 1);
202 if (!target_desc->string.pointer) { 205 if (!target_desc->string.pointer) {
203 return_ACPI_STATUS (AE_NO_MEMORY); 206 return_ACPI_STATUS (AE_NO_MEMORY);
204 } 207 }
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c
index f92efc512890..cafa702108dc 100644
--- a/drivers/acpi/executer/exsystem.c
+++ b/drivers/acpi/executer/exsystem.c
@@ -55,8 +55,8 @@
55 * 55 *
56 * FUNCTION: acpi_ex_system_wait_semaphore 56 * FUNCTION: acpi_ex_system_wait_semaphore
57 * 57 *
58 * PARAMETERS: Semaphore - OSD semaphore to wait on 58 * PARAMETERS: Semaphore - Semaphore to wait on
59 * Timeout - Max time to wait 59 * Timeout - Max time to wait
60 * 60 *
61 * RETURN: Status 61 * RETURN: Status
62 * 62 *
@@ -90,7 +90,8 @@ acpi_ex_system_wait_semaphore (
90 90
91 status = acpi_os_wait_semaphore (semaphore, 1, timeout); 91 status = acpi_os_wait_semaphore (semaphore, 1, timeout);
92 92
93 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*** Thread awake after blocking, %s\n", 93 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
94 "*** Thread awake after blocking, %s\n",
94 acpi_format_exception (status))); 95 acpi_format_exception (status)));
95 96
96 /* Reacquire the interpreter */ 97 /* Reacquire the interpreter */
@@ -111,8 +112,8 @@ acpi_ex_system_wait_semaphore (
111 * 112 *
112 * FUNCTION: acpi_ex_system_do_stall 113 * FUNCTION: acpi_ex_system_do_stall
113 * 114 *
114 * PARAMETERS: how_long - The amount of time to stall, 115 * PARAMETERS: how_long - The amount of time to stall,
115 * in microseconds 116 * in microseconds
116 * 117 *
117 * RETURN: Status 118 * RETURN: Status
118 * 119 *
@@ -141,7 +142,8 @@ acpi_ex_system_do_stall (
141 * (ACPI specifies 100 usec as max, but this gives some slack in 142 * (ACPI specifies 100 usec as max, but this gives some slack in
142 * order to support existing BIOSs) 143 * order to support existing BIOSs)
143 */ 144 */
144 ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n", how_long)); 145 ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n",
146 how_long));
145 status = AE_AML_OPERAND_VALUE; 147 status = AE_AML_OPERAND_VALUE;
146 } 148 }
147 else { 149 else {
@@ -156,8 +158,8 @@ acpi_ex_system_do_stall (
156 * 158 *
157 * FUNCTION: acpi_ex_system_do_suspend 159 * FUNCTION: acpi_ex_system_do_suspend
158 * 160 *
159 * PARAMETERS: how_long - The amount of time to suspend, 161 * PARAMETERS: how_long - The amount of time to suspend,
160 * in milliseconds 162 * in milliseconds
161 * 163 *
162 * RETURN: None 164 * RETURN: None
163 * 165 *
@@ -192,8 +194,8 @@ acpi_ex_system_do_suspend (
192 * 194 *
193 * FUNCTION: acpi_ex_system_acquire_mutex 195 * FUNCTION: acpi_ex_system_acquire_mutex
194 * 196 *
195 * PARAMETERS: *time_desc - The 'time to delay' object descriptor 197 * PARAMETERS: time_desc - The 'time to delay' object descriptor
196 * *obj_desc - The object descriptor for this op 198 * obj_desc - The object descriptor for this op
197 * 199 *
198 * RETURN: Status 200 * RETURN: Status
199 * 201 *
@@ -218,16 +220,15 @@ acpi_ex_system_acquire_mutex (
218 return_ACPI_STATUS (AE_BAD_PARAMETER); 220 return_ACPI_STATUS (AE_BAD_PARAMETER);
219 } 221 }
220 222
221 /* 223 /* Support for the _GL_ Mutex object -- go get the global lock */
222 * Support for the _GL_ Mutex object -- go get the global lock 224
223 */
224 if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { 225 if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
225 status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value); 226 status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value);
226 return_ACPI_STATUS (status); 227 return_ACPI_STATUS (status);
227 } 228 }
228 229
229 status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore, 230 status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore,
230 (u16) time_desc->integer.value); 231 (u16) time_desc->integer.value);
231 return_ACPI_STATUS (status); 232 return_ACPI_STATUS (status);
232} 233}
233 234
@@ -236,7 +237,7 @@ acpi_ex_system_acquire_mutex (
236 * 237 *
237 * FUNCTION: acpi_ex_system_release_mutex 238 * FUNCTION: acpi_ex_system_release_mutex
238 * 239 *
239 * PARAMETERS: *obj_desc - The object descriptor for this op 240 * PARAMETERS: obj_desc - The object descriptor for this op
240 * 241 *
241 * RETURN: Status 242 * RETURN: Status
242 * 243 *
@@ -261,9 +262,8 @@ acpi_ex_system_release_mutex (
261 return_ACPI_STATUS (AE_BAD_PARAMETER); 262 return_ACPI_STATUS (AE_BAD_PARAMETER);
262 } 263 }
263 264
264 /* 265 /* Support for the _GL_ Mutex object -- release the global lock */
265 * Support for the _GL_ Mutex object -- release the global lock 266
266 */
267 if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { 267 if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
268 status = acpi_ev_release_global_lock (); 268 status = acpi_ev_release_global_lock ();
269 return_ACPI_STATUS (status); 269 return_ACPI_STATUS (status);
@@ -278,9 +278,9 @@ acpi_ex_system_release_mutex (
278 * 278 *
279 * FUNCTION: acpi_ex_system_signal_event 279 * FUNCTION: acpi_ex_system_signal_event
280 * 280 *
281 * PARAMETERS: *obj_desc - The object descriptor for this op 281 * PARAMETERS: obj_desc - The object descriptor for this op
282 * 282 *
283 * RETURN: AE_OK 283 * RETURN: Status
284 * 284 *
285 * DESCRIPTION: Provides an access point to perform synchronization operations 285 * DESCRIPTION: Provides an access point to perform synchronization operations
286 * within the AML. 286 * within the AML.
@@ -309,8 +309,8 @@ acpi_ex_system_signal_event (
309 * 309 *
310 * FUNCTION: acpi_ex_system_wait_event 310 * FUNCTION: acpi_ex_system_wait_event
311 * 311 *
312 * PARAMETERS: *time_desc - The 'time to delay' object descriptor 312 * PARAMETERS: time_desc - The 'time to delay' object descriptor
313 * *obj_desc - The object descriptor for this op 313 * obj_desc - The object descriptor for this op
314 * 314 *
315 * RETURN: Status 315 * RETURN: Status
316 * 316 *
@@ -333,7 +333,7 @@ acpi_ex_system_wait_event (
333 333
334 if (obj_desc) { 334 if (obj_desc) {
335 status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore, 335 status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore,
336 (u16) time_desc->integer.value); 336 (u16) time_desc->integer.value);
337 } 337 }
338 338
339 return_ACPI_STATUS (status); 339 return_ACPI_STATUS (status);
@@ -344,7 +344,7 @@ acpi_ex_system_wait_event (
344 * 344 *
345 * FUNCTION: acpi_ex_system_reset_event 345 * FUNCTION: acpi_ex_system_reset_event
346 * 346 *
347 * PARAMETERS: *obj_desc - The object descriptor for this op 347 * PARAMETERS: obj_desc - The object descriptor for this op
348 * 348 *
349 * RETURN: Status 349 * RETURN: Status
350 * 350 *
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c
index 40c6abb8b49a..5c7ec0c04177 100644
--- a/drivers/acpi/executer/exutils.c
+++ b/drivers/acpi/executer/exutils.c
@@ -67,22 +67,31 @@
67#define _COMPONENT ACPI_EXECUTER 67#define _COMPONENT ACPI_EXECUTER
68 ACPI_MODULE_NAME ("exutils") 68 ACPI_MODULE_NAME ("exutils")
69 69
70/* Local prototypes */
70 71
71#ifndef ACPI_NO_METHOD_EXECUTION 72static u32
73acpi_ex_digits_needed (
74 acpi_integer value,
75 u32 base);
72 76
77
78#ifndef ACPI_NO_METHOD_EXECUTION
73/******************************************************************************* 79/*******************************************************************************
74 * 80 *
75 * FUNCTION: acpi_ex_enter_interpreter 81 * FUNCTION: acpi_ex_enter_interpreter
76 * 82 *
77 * PARAMETERS: None 83 * PARAMETERS: None
78 * 84 *
85 * RETURN: Status
86 *
79 * DESCRIPTION: Enter the interpreter execution region. Failure to enter 87 * DESCRIPTION: Enter the interpreter execution region. Failure to enter
80 * the interpreter region is a fatal system error 88 * the interpreter region is a fatal system error
81 * 89 *
82 ******************************************************************************/ 90 ******************************************************************************/
83 91
84acpi_status 92acpi_status
85acpi_ex_enter_interpreter (void) 93acpi_ex_enter_interpreter (
94 void)
86{ 95{
87 acpi_status status; 96 acpi_status status;
88 97
@@ -104,6 +113,8 @@ acpi_ex_enter_interpreter (void)
104 * 113 *
105 * PARAMETERS: None 114 * PARAMETERS: None
106 * 115 *
116 * RETURN: None
117 *
107 * DESCRIPTION: Exit the interpreter execution region 118 * DESCRIPTION: Exit the interpreter execution region
108 * 119 *
109 * Cases where the interpreter is unlocked: 120 * Cases where the interpreter is unlocked:
@@ -119,7 +130,8 @@ acpi_ex_enter_interpreter (void)
119 ******************************************************************************/ 130 ******************************************************************************/
120 131
121void 132void
122acpi_ex_exit_interpreter (void) 133acpi_ex_exit_interpreter (
134 void)
123{ 135{
124 acpi_status status; 136 acpi_status status;
125 137
@@ -212,7 +224,8 @@ acpi_ex_acquire_global_lock (
212 locked = TRUE; 224 locked = TRUE;
213 } 225 }
214 else { 226 else {
215 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not acquire Global Lock, %s\n", 227 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
228 "Could not acquire Global Lock, %s\n",
216 acpi_format_exception (status))); 229 acpi_format_exception (status)));
217 } 230 }
218 } 231 }
@@ -228,7 +241,7 @@ acpi_ex_acquire_global_lock (
228 * PARAMETERS: locked_by_me - Return value from corresponding call to 241 * PARAMETERS: locked_by_me - Return value from corresponding call to
229 * acquire_global_lock. 242 * acquire_global_lock.
230 * 243 *
231 * RETURN: Status 244 * RETURN: None
232 * 245 *
233 * DESCRIPTION: Release the global lock if it is locked. 246 * DESCRIPTION: Release the global lock if it is locked.
234 * 247 *
@@ -269,11 +282,14 @@ acpi_ex_release_global_lock (
269 * PARAMETERS: Value - Value to be represented 282 * PARAMETERS: Value - Value to be represented
270 * Base - Base of representation 283 * Base - Base of representation
271 * 284 *
272 * RETURN: the number of digits needed to represent Value in Base 285 * RETURN: The number of digits.
286 *
287 * DESCRIPTION: Calculate the number of digits needed to represent the Value
288 * in the given Base (Radix)
273 * 289 *
274 ******************************************************************************/ 290 ******************************************************************************/
275 291
276u32 292static u32
277acpi_ex_digits_needed ( 293acpi_ex_digits_needed (
278 acpi_integer value, 294 acpi_integer value,
279 u32 base) 295 u32 base)
@@ -312,6 +328,8 @@ acpi_ex_digits_needed (
312 * PARAMETERS: numeric_id - EISA ID to be converted 328 * PARAMETERS: numeric_id - EISA ID to be converted
313 * out_string - Where to put the converted string (8 bytes) 329 * out_string - Where to put the converted string (8 bytes)
314 * 330 *
331 * RETURN: None
332 *
315 * DESCRIPTION: Convert a numeric EISA ID to string representation 333 * DESCRIPTION: Convert a numeric EISA ID to string representation
316 * 334 *
317 ******************************************************************************/ 335 ******************************************************************************/
@@ -349,7 +367,10 @@ acpi_ex_eisa_id_to_string (
349 * PARAMETERS: Value - Value to be converted 367 * PARAMETERS: Value - Value to be converted
350 * out_string - Where to put the converted string (8 bytes) 368 * out_string - Where to put the converted string (8 bytes)
351 * 369 *
352 * RETURN: Convert a number to string representation 370 * RETURN: None, string
371 *
372 * DESCRIPTOIN: Convert a number to string representation. Assumes string
373 * buffer is large enough to hold the string.
353 * 374 *
354 ******************************************************************************/ 375 ******************************************************************************/
355 376
diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c
index 529e922bdc85..b51001e74eea 100644
--- a/drivers/acpi/hardware/hwacpi.c
+++ b/drivers/acpi/hardware/hwacpi.c
@@ -58,7 +58,8 @@
58 * 58 *
59 * RETURN: Status 59 * RETURN: Status
60 * 60 *
61 * DESCRIPTION: Initialize and validate various ACPI registers 61 * DESCRIPTION: Initialize and validate the various ACPI registers defined in
62 * the FADT.
62 * 63 *
63 ******************************************************************************/ 64 ******************************************************************************/
64 65
@@ -75,7 +76,7 @@ acpi_hw_initialize (
75 /* We must have the ACPI tables by the time we get here */ 76 /* We must have the ACPI tables by the time we get here */
76 77
77 if (!acpi_gbl_FADT) { 78 if (!acpi_gbl_FADT) {
78 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "A FADT is not loaded\n")); 79 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT is present\n"));
79 80
80 return_ACPI_STATUS (AE_NO_ACPI_TABLES); 81 return_ACPI_STATUS (AE_NO_ACPI_TABLES);
81 } 82 }
@@ -131,7 +132,8 @@ acpi_hw_set_mode (
131 * transitions are not supported. 132 * transitions are not supported.
132 */ 133 */
133 if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) { 134 if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) {
134 ACPI_REPORT_ERROR (("No ACPI mode transition supported in this system (enable/disable both zero)\n")); 135 ACPI_REPORT_ERROR ((
136 "No ACPI mode transition supported in this system (enable/disable both zero)\n"));
135 return_ACPI_STATUS (AE_OK); 137 return_ACPI_STATUS (AE_OK);
136 } 138 }
137 139
@@ -162,7 +164,8 @@ acpi_hw_set_mode (
162 } 164 }
163 165
164 if (ACPI_FAILURE (status)) { 166 if (ACPI_FAILURE (status)) {
165 ACPI_REPORT_ERROR (("Could not write mode change, %s\n", acpi_format_exception (status))); 167 ACPI_REPORT_ERROR (("Could not write mode change, %s\n",
168 acpi_format_exception (status)));
166 return_ACPI_STATUS (status); 169 return_ACPI_STATUS (status);
167 } 170 }
168 171
@@ -173,7 +176,8 @@ acpi_hw_set_mode (
173 retry = 3000; 176 retry = 3000;
174 while (retry) { 177 while (retry) {
175 if (acpi_hw_get_mode() == mode) { 178 if (acpi_hw_get_mode() == mode) {
176 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", mode)); 179 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n",
180 mode));
177 return_ACPI_STATUS (AE_OK); 181 return_ACPI_STATUS (AE_OK);
178 } 182 }
179 acpi_os_stall(1000); 183 acpi_os_stall(1000);
@@ -185,7 +189,7 @@ acpi_hw_set_mode (
185} 189}
186 190
187 191
188/****************************************************************************** 192/*******************************************************************************
189 * 193 *
190 * FUNCTION: acpi_hw_get_mode 194 * FUNCTION: acpi_hw_get_mode
191 * 195 *
@@ -199,7 +203,8 @@ acpi_hw_set_mode (
199 ******************************************************************************/ 203 ******************************************************************************/
200 204
201u32 205u32
202acpi_hw_get_mode (void) 206acpi_hw_get_mode (
207 void)
203{ 208{
204 acpi_status status; 209 acpi_status status;
205 u32 value; 210 u32 value;
diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c
index 9ac1d639bf51..8daeabb2fc7a 100644
--- a/drivers/acpi/hardware/hwgpe.c
+++ b/drivers/acpi/hardware/hwgpe.c
@@ -48,6 +48,13 @@
48#define _COMPONENT ACPI_HARDWARE 48#define _COMPONENT ACPI_HARDWARE
49 ACPI_MODULE_NAME ("hwgpe") 49 ACPI_MODULE_NAME ("hwgpe")
50 50
51/* Local prototypes */
52
53static acpi_status
54acpi_hw_enable_wakeup_gpe_block (
55 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
56 struct acpi_gpe_block_info *gpe_block);
57
51 58
52/****************************************************************************** 59/******************************************************************************
53 * 60 *
@@ -135,6 +142,7 @@ acpi_hw_clear_gpe (
135 * DESCRIPTION: Return the status of a single GPE. 142 * DESCRIPTION: Return the status of a single GPE.
136 * 143 *
137 ******************************************************************************/ 144 ******************************************************************************/
145
138#ifdef ACPI_FUTURE_USAGE 146#ifdef ACPI_FUTURE_USAGE
139acpi_status 147acpi_status
140acpi_hw_get_gpe_status ( 148acpi_hw_get_gpe_status (
@@ -206,7 +214,7 @@ unlock_and_exit:
206 * 214 *
207 * RETURN: Status 215 * RETURN: Status
208 * 216 *
209 * DESCRIPTION: Disable all GPEs within a GPE block 217 * DESCRIPTION: Disable all GPEs within a single GPE block
210 * 218 *
211 ******************************************************************************/ 219 ******************************************************************************/
212 220
@@ -244,7 +252,7 @@ acpi_hw_disable_gpe_block (
244 * 252 *
245 * RETURN: Status 253 * RETURN: Status
246 * 254 *
247 * DESCRIPTION: Clear status bits for all GPEs within a GPE block 255 * DESCRIPTION: Clear status bits for all GPEs within a single GPE block
248 * 256 *
249 ******************************************************************************/ 257 ******************************************************************************/
250 258
@@ -282,8 +290,8 @@ acpi_hw_clear_gpe_block (
282 * 290 *
283 * RETURN: Status 291 * RETURN: Status
284 * 292 *
285 * DESCRIPTION: Enable all "runtime" GPEs within a GPE block. (Includes 293 * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes
286 * combination wake/run GPEs.) 294 * combination wake/run GPEs.
287 * 295 *
288 ******************************************************************************/ 296 ******************************************************************************/
289 297
@@ -327,12 +335,12 @@ acpi_hw_enable_runtime_gpe_block (
327 * 335 *
328 * RETURN: Status 336 * RETURN: Status
329 * 337 *
330 * DESCRIPTION: Enable all "wake" GPEs within a GPE block. (Includes 338 * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes
331 * combination wake/run GPEs.) 339 * combination wake/run GPEs.
332 * 340 *
333 ******************************************************************************/ 341 ******************************************************************************/
334 342
335acpi_status 343static acpi_status
336acpi_hw_enable_wakeup_gpe_block ( 344acpi_hw_enable_wakeup_gpe_block (
337 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 345 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
338 struct acpi_gpe_block_info *gpe_block) 346 struct acpi_gpe_block_info *gpe_block)
@@ -350,7 +358,8 @@ acpi_hw_enable_wakeup_gpe_block (
350 358
351 /* Enable all "wake" GPEs in this register */ 359 /* Enable all "wake" GPEs in this register */
352 360
353 status = acpi_hw_low_level_write (8, gpe_block->register_info[i].enable_for_wake, 361 status = acpi_hw_low_level_write (8,
362 gpe_block->register_info[i].enable_for_wake,
354 &gpe_block->register_info[i].enable_address); 363 &gpe_block->register_info[i].enable_address);
355 if (ACPI_FAILURE (status)) { 364 if (ACPI_FAILURE (status)) {
356 return (status); 365 return (status);
@@ -369,7 +378,7 @@ acpi_hw_enable_wakeup_gpe_block (
369 * 378 *
370 * RETURN: Status 379 * RETURN: Status
371 * 380 *
372 * DESCRIPTION: Disable and clear all GPEs 381 * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
373 * 382 *
374 ******************************************************************************/ 383 ******************************************************************************/
375 384
@@ -397,7 +406,7 @@ acpi_hw_disable_all_gpes (
397 * 406 *
398 * RETURN: Status 407 * RETURN: Status
399 * 408 *
400 * DESCRIPTION: Enable all GPEs of the given type 409 * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
401 * 410 *
402 ******************************************************************************/ 411 ******************************************************************************/
403 412
@@ -424,7 +433,7 @@ acpi_hw_enable_all_runtime_gpes (
424 * 433 *
425 * RETURN: Status 434 * RETURN: Status
426 * 435 *
427 * DESCRIPTION: Enable all GPEs of the given type 436 * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks
428 * 437 *
429 ******************************************************************************/ 438 ******************************************************************************/
430 439
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c
index 91af0c2ddcf7..6d9e4eb84836 100644
--- a/drivers/acpi/hardware/hwregs.c
+++ b/drivers/acpi/hardware/hwregs.c
@@ -87,8 +87,9 @@ acpi_hw_clear_acpi_status (
87 } 87 }
88 } 88 }
89 89
90 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, 90 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
91 ACPI_BITMASK_ALL_FIXED_STATUS); 91 ACPI_REGISTER_PM1_STATUS,
92 ACPI_BITMASK_ALL_FIXED_STATUS);
92 if (ACPI_FAILURE (status)) { 93 if (ACPI_FAILURE (status)) {
93 goto unlock_and_exit; 94 goto unlock_and_exit;
94 } 95 }
@@ -138,28 +139,30 @@ acpi_get_sleep_type_data (
138{ 139{
139 acpi_status status = AE_OK; 140 acpi_status status = AE_OK;
140 struct acpi_parameter_info info; 141 struct acpi_parameter_info info;
142 char *sleep_state_name;
141 143
142 144
143 ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data"); 145 ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data");
144 146
145 147
146 /* 148 /* Validate parameters */
147 * Validate parameters 149
148 */
149 if ((sleep_state > ACPI_S_STATES_MAX) || 150 if ((sleep_state > ACPI_S_STATES_MAX) ||
150 !sleep_type_a || !sleep_type_b) { 151 !sleep_type_a || !sleep_type_b) {
151 return_ACPI_STATUS (AE_BAD_PARAMETER); 152 return_ACPI_STATUS (AE_BAD_PARAMETER);
152 } 153 }
153 154
154 /* 155 /* Evaluate the namespace object containing the values for this state */
155 * Evaluate the namespace object containing the values for this state 156
156 */
157 info.parameters = NULL; 157 info.parameters = NULL;
158 status = acpi_ns_evaluate_by_name ((char *) acpi_gbl_sleep_state_names[sleep_state], 158 info.return_object = NULL;
159 &info); 159 sleep_state_name = (char *) acpi_gbl_sleep_state_names[sleep_state];
160
161 status = acpi_ns_evaluate_by_name (sleep_state_name, &info);
160 if (ACPI_FAILURE (status)) { 162 if (ACPI_FAILURE (status)) {
161 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s while evaluating sleep_state [%s]\n", 163 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
162 acpi_format_exception (status), acpi_gbl_sleep_state_names[sleep_state])); 164 "%s while evaluating sleep_state [%s]\n",
165 acpi_format_exception (status), sleep_state_name));
163 166
164 return_ACPI_STATUS (status); 167 return_ACPI_STATUS (status);
165 } 168 }
@@ -167,45 +170,57 @@ acpi_get_sleep_type_data (
167 /* Must have a return object */ 170 /* Must have a return object */
168 171
169 if (!info.return_object) { 172 if (!info.return_object) {
170 ACPI_REPORT_ERROR (("Missing Sleep State object\n")); 173 ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n",
174 sleep_state_name));
171 status = AE_NOT_EXIST; 175 status = AE_NOT_EXIST;
172 } 176 }
173 177
174 /* It must be of type Package */ 178 /* It must be of type Package */
175 179
176 else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) { 180 else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) {
177 ACPI_REPORT_ERROR (("Sleep State object not a Package\n")); 181 ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n"));
178 status = AE_AML_OPERAND_TYPE; 182 status = AE_AML_OPERAND_TYPE;
179 } 183 }
180 184
181 /* The package must have at least two elements */ 185 /*
182 186 * The package must have at least two elements. NOTE (March 2005): This
187 * goes against the current ACPI spec which defines this object as a
188 * package with one encoded DWORD element. However, existing practice
189 * by BIOS vendors seems to be to have 2 or more elements, at least
190 * one per sleep type (A/B).
191 */
183 else if (info.return_object->package.count < 2) { 192 else if (info.return_object->package.count < 2) {
184 ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n")); 193 ACPI_REPORT_ERROR ((
194 "Sleep State return package does not have at least two elements\n"));
185 status = AE_AML_NO_OPERAND; 195 status = AE_AML_NO_OPERAND;
186 } 196 }
187 197
188 /* The first two elements must both be of type Integer */ 198 /* The first two elements must both be of type Integer */
189 199
190 else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0]) != ACPI_TYPE_INTEGER) || 200 else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0])
191 (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1]) != ACPI_TYPE_INTEGER)) { 201 != ACPI_TYPE_INTEGER) ||
192 ACPI_REPORT_ERROR (("Sleep State package elements are not both Integers (%s, %s)\n", 202 (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1])
203 != ACPI_TYPE_INTEGER)) {
204 ACPI_REPORT_ERROR ((
205 "Sleep State return package elements are not both Integers (%s, %s)\n",
193 acpi_ut_get_object_type_name (info.return_object->package.elements[0]), 206 acpi_ut_get_object_type_name (info.return_object->package.elements[0]),
194 acpi_ut_get_object_type_name (info.return_object->package.elements[1]))); 207 acpi_ut_get_object_type_name (info.return_object->package.elements[1])));
195 status = AE_AML_OPERAND_TYPE; 208 status = AE_AML_OPERAND_TYPE;
196 } 209 }
197 else { 210 else {
198 /* 211 /* Valid _Sx_ package size, type, and value */
199 * Valid _Sx_ package size, type, and value 212
200 */ 213 *sleep_type_a = (u8)
201 *sleep_type_a = (u8) (info.return_object->package.elements[0])->integer.value; 214 (info.return_object->package.elements[0])->integer.value;
202 *sleep_type_b = (u8) (info.return_object->package.elements[1])->integer.value; 215 *sleep_type_b = (u8)
216 (info.return_object->package.elements[1])->integer.value;
203 } 217 }
204 218
205 if (ACPI_FAILURE (status)) { 219 if (ACPI_FAILURE (status)) {
206 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 220 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
207 "While evaluating sleep_state [%s], bad Sleep object %p type %s\n", 221 "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n",
208 acpi_gbl_sleep_state_names[sleep_state], info.return_object, 222 acpi_format_exception (status),
223 sleep_state_name, info.return_object,
209 acpi_ut_get_object_type_name (info.return_object))); 224 acpi_ut_get_object_type_name (info.return_object)));
210 } 225 }
211 226
@@ -221,9 +236,9 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data);
221 * 236 *
222 * PARAMETERS: register_id - Index of ACPI Register to access 237 * PARAMETERS: register_id - Index of ACPI Register to access
223 * 238 *
224 * RETURN: The bit mask to be used when accessing the register 239 * RETURN: The bitmask to be used when accessing the register
225 * 240 *
226 * DESCRIPTION: Map register_id into a register bit mask. 241 * DESCRIPTION: Map register_id into a register bitmask.
227 * 242 *
228 ******************************************************************************/ 243 ******************************************************************************/
229 244
@@ -359,7 +374,7 @@ acpi_set_register (
359 /* Always do a register read first so we can insert the new bits */ 374 /* Always do a register read first so we can insert the new bits */
360 375
361 status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, 376 status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
362 bit_reg_info->parent_register, &register_value); 377 bit_reg_info->parent_register, &register_value);
363 if (ACPI_FAILURE (status)) { 378 if (ACPI_FAILURE (status)) {
364 goto unlock_and_exit; 379 goto unlock_and_exit;
365 } 380 }
@@ -396,7 +411,7 @@ acpi_set_register (
396 bit_reg_info->access_bit_mask, value); 411 bit_reg_info->access_bit_mask, value);
397 412
398 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, 413 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
399 ACPI_REGISTER_PM1_ENABLE, (u16) register_value); 414 ACPI_REGISTER_PM1_ENABLE, (u16) register_value);
400 break; 415 break;
401 416
402 417
@@ -413,7 +428,7 @@ acpi_set_register (
413 bit_reg_info->access_bit_mask, value); 428 bit_reg_info->access_bit_mask, value);
414 429
415 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, 430 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
416 ACPI_REGISTER_PM1_CONTROL, (u16) register_value); 431 ACPI_REGISTER_PM1_CONTROL, (u16) register_value);
417 break; 432 break;
418 433
419 434
@@ -427,17 +442,19 @@ acpi_set_register (
427 442
428 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", 443 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
429 register_value, 444 register_value,
430 ACPI_FORMAT_UINT64 (acpi_gbl_FADT->xpm2_cnt_blk.address))); 445 ACPI_FORMAT_UINT64 (
446 acpi_gbl_FADT->xpm2_cnt_blk.address)));
431 447
432 ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, 448 ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
433 bit_reg_info->access_bit_mask, value); 449 bit_reg_info->access_bit_mask, value);
434 450
435 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", 451 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n",
436 register_value, 452 register_value,
437 ACPI_FORMAT_UINT64 (acpi_gbl_FADT->xpm2_cnt_blk.address))); 453 ACPI_FORMAT_UINT64 (
454 acpi_gbl_FADT->xpm2_cnt_blk.address)));
438 455
439 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, 456 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
440 ACPI_REGISTER_PM2_CONTROL, (u8) (register_value)); 457 ACPI_REGISTER_PM2_CONTROL, (u8) (register_value));
441 break; 458 break;
442 459
443 460
@@ -454,7 +471,9 @@ unlock_and_exit:
454 471
455 /* Normalize the value that was read */ 472 /* Normalize the value that was read */
456 473
457 ACPI_DEBUG_EXEC (register_value = ((register_value & bit_reg_info->access_bit_mask) >> bit_reg_info->bit_position)); 474 ACPI_DEBUG_EXEC (register_value =
475 ((register_value & bit_reg_info->access_bit_mask) >>
476 bit_reg_info->bit_position));
458 477
459 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n", 478 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
460 value, register_value, bit_reg_info->parent_register)); 479 value, register_value, bit_reg_info->parent_register));
@@ -469,7 +488,7 @@ EXPORT_SYMBOL(acpi_set_register);
469 * 488 *
470 * PARAMETERS: use_lock - Mutex hw access 489 * PARAMETERS: use_lock - Mutex hw access
471 * register_id - register_iD + Offset 490 * register_id - register_iD + Offset
472 * return_value - Value that was read from the register 491 * return_value - Where the register value is returned
473 * 492 *
474 * RETURN: Status and the value read. 493 * RETURN: Status and the value read.
475 * 494 *
@@ -557,7 +576,8 @@ acpi_hw_register_read (
557 break; 576 break;
558 577
559 default: 578 default:
560 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", register_id)); 579 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n",
580 register_id));
561 status = AE_BAD_PARAMETER; 581 status = AE_BAD_PARAMETER;
562 break; 582 break;
563 } 583 }
@@ -763,10 +783,11 @@ acpi_hw_low_level_read (
763 return (AE_BAD_PARAMETER); 783 return (AE_BAD_PARAMETER);
764 } 784 }
765 785
766 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", 786 ACPI_DEBUG_PRINT ((ACPI_DB_IO,
767 *value, width, 787 "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
768 ACPI_FORMAT_UINT64 (address), 788 *value, width,
769 acpi_ut_get_region_name (reg->address_space_id))); 789 ACPI_FORMAT_UINT64 (address),
790 acpi_ut_get_region_name (reg->address_space_id)));
770 791
771 return (status); 792 return (status);
772} 793}
@@ -841,10 +862,11 @@ acpi_hw_low_level_write (
841 return (AE_BAD_PARAMETER); 862 return (AE_BAD_PARAMETER);
842 } 863 }
843 864
844 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", 865 ACPI_DEBUG_PRINT ((ACPI_DB_IO,
845 value, width, 866 "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
846 ACPI_FORMAT_UINT64 (address), 867 value, width,
847 acpi_ut_get_region_name (reg->address_space_id))); 868 ACPI_FORMAT_UINT64 (address),
869 acpi_ut_get_region_name (reg->address_space_id)));
848 870
849 return (status); 871 return (status);
850} 872}
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index 77b3e9a8550b..415d342aeab5 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -43,27 +43,13 @@
43 */ 43 */
44 44
45#include <linux/module.h> 45#include <linux/module.h>
46
47#include <acpi/acpi.h> 46#include <acpi/acpi.h>
48 47
49#define _COMPONENT ACPI_HARDWARE 48#define _COMPONENT ACPI_HARDWARE
50 ACPI_MODULE_NAME ("hwsleep") 49 ACPI_MODULE_NAME ("hwsleep")
51 50
52 51
53#define METHOD_NAME__BFS "\\_BFS" 52/*******************************************************************************
54#define METHOD_NAME__GTS "\\_GTS"
55#define METHOD_NAME__PTS "\\_PTS"
56#define METHOD_NAME__SST "\\_SI._SST"
57#define METHOD_NAME__WAK "\\_WAK"
58
59#define ACPI_SST_INDICATOR_OFF 0
60#define ACPI_SST_WORKING 1
61#define ACPI_SST_WAKING 2
62#define ACPI_SST_SLEEPING 3
63#define ACPI_SST_SLEEP_CONTEXT 4
64
65
66/******************************************************************************
67 * 53 *
68 * FUNCTION: acpi_set_firmware_waking_vector 54 * FUNCTION: acpi_set_firmware_waking_vector
69 * 55 *
@@ -72,7 +58,7 @@
72 * 58 *
73 * RETURN: Status 59 * RETURN: Status
74 * 60 *
75 * DESCRIPTION: access function for d_firmware_waking_vector field in FACS 61 * DESCRIPTION: Access function for the firmware_waking_vector field in FACS
76 * 62 *
77 ******************************************************************************/ 63 ******************************************************************************/
78 64
@@ -99,19 +85,20 @@ acpi_set_firmware_waking_vector (
99} 85}
100 86
101 87
102/****************************************************************************** 88/*******************************************************************************
103 * 89 *
104 * FUNCTION: acpi_get_firmware_waking_vector 90 * FUNCTION: acpi_get_firmware_waking_vector
105 * 91 *
106 * PARAMETERS: *physical_address - Output buffer where contents of 92 * PARAMETERS: *physical_address - Where the contents of
107 * the firmware_waking_vector field of 93 * the firmware_waking_vector field of
108 * the FACS will be stored. 94 * the FACS will be returned.
109 * 95 *
110 * RETURN: Status 96 * RETURN: Status, vector
111 * 97 *
112 * DESCRIPTION: Access function for firmware_waking_vector field in FACS 98 * DESCRIPTION: Access function for the firmware_waking_vector field in FACS
113 * 99 *
114 ******************************************************************************/ 100 ******************************************************************************/
101
115#ifdef ACPI_FUTURE_USAGE 102#ifdef ACPI_FUTURE_USAGE
116acpi_status 103acpi_status
117acpi_get_firmware_waking_vector ( 104acpi_get_firmware_waking_vector (
@@ -141,7 +128,7 @@ acpi_get_firmware_waking_vector (
141#endif 128#endif
142 129
143 130
144/****************************************************************************** 131/*******************************************************************************
145 * 132 *
146 * FUNCTION: acpi_enter_sleep_state_prep 133 * FUNCTION: acpi_enter_sleep_state_prep
147 * 134 *
@@ -215,7 +202,7 @@ acpi_enter_sleep_state_prep (
215 break; 202 break;
216 203
217 default: 204 default:
218 arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is indicator off */ 205 arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is off */
219 break; 206 break;
220 } 207 }
221 208
@@ -223,14 +210,15 @@ acpi_enter_sleep_state_prep (
223 210
224 status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); 211 status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
225 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { 212 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
226 ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); 213 ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
214 acpi_format_exception (status)));
227 } 215 }
228 216
229 return_ACPI_STATUS (AE_OK); 217 return_ACPI_STATUS (AE_OK);
230} 218}
231 219
232 220
233/****************************************************************************** 221/*******************************************************************************
234 * 222 *
235 * FUNCTION: acpi_enter_sleep_state 223 * FUNCTION: acpi_enter_sleep_state
236 * 224 *
@@ -299,15 +287,18 @@ acpi_enter_sleep_state (
299 287
300 /* Get current value of PM1A control */ 288 /* Get current value of PM1A control */
301 289
302 status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol); 290 status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
291 ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
303 if (ACPI_FAILURE (status)) { 292 if (ACPI_FAILURE (status)) {
304 return_ACPI_STATUS (status); 293 return_ACPI_STATUS (status);
305 } 294 }
306 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Entering sleep state [S%d]\n", sleep_state)); 295 ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
296 "Entering sleep state [S%d]\n", sleep_state));
307 297
308 /* Clear SLP_EN and SLP_TYP fields */ 298 /* Clear SLP_EN and SLP_TYP fields */
309 299
310 PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | sleep_enable_reg_info->access_bit_mask); 300 PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
301 sleep_enable_reg_info->access_bit_mask);
311 PM1Bcontrol = PM1Acontrol; 302 PM1Bcontrol = PM1Acontrol;
312 303
313 /* Insert SLP_TYP bits */ 304 /* Insert SLP_TYP bits */
@@ -322,12 +313,14 @@ acpi_enter_sleep_state (
322 313
323 /* Write #1: fill in SLP_TYP data */ 314 /* Write #1: fill in SLP_TYP data */
324 315
325 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); 316 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
317 ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
326 if (ACPI_FAILURE (status)) { 318 if (ACPI_FAILURE (status)) {
327 return_ACPI_STATUS (status); 319 return_ACPI_STATUS (status);
328 } 320 }
329 321
330 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); 322 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
323 ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
331 if (ACPI_FAILURE (status)) { 324 if (ACPI_FAILURE (status)) {
332 return_ACPI_STATUS (status); 325 return_ACPI_STATUS (status);
333 } 326 }
@@ -341,22 +334,25 @@ acpi_enter_sleep_state (
341 334
342 ACPI_FLUSH_CPU_CACHE (); 335 ACPI_FLUSH_CPU_CACHE ();
343 336
344 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); 337 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
338 ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
345 if (ACPI_FAILURE (status)) { 339 if (ACPI_FAILURE (status)) {
346 return_ACPI_STATUS (status); 340 return_ACPI_STATUS (status);
347 } 341 }
348 342
349 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); 343 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
344 ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
350 if (ACPI_FAILURE (status)) { 345 if (ACPI_FAILURE (status)) {
351 return_ACPI_STATUS (status); 346 return_ACPI_STATUS (status);
352 } 347 }
353 348
354 if (sleep_state > ACPI_STATE_S3) { 349 if (sleep_state > ACPI_STATE_S3) {
355 /* 350 /*
356 * We wanted to sleep > S3, but it didn't happen (by virtue of the fact that 351 * We wanted to sleep > S3, but it didn't happen (by virtue of the
357 * we are still executing!) 352 * fact that we are still executing!)
358 * 353 *
359 * Wait ten seconds, then try again. This is to get S4/S5 to work on all machines. 354 * Wait ten seconds, then try again. This is to get S4/S5 to work on
355 * all machines.
360 * 356 *
361 * We wait so long to allow chipsets that poll this reg very slowly to 357 * We wait so long to allow chipsets that poll this reg very slowly to
362 * still read the right value. Ideally, this block would go 358 * still read the right value. Ideally, this block would go
@@ -364,7 +360,8 @@ acpi_enter_sleep_state (
364 */ 360 */
365 acpi_os_stall (10000000); 361 acpi_os_stall (10000000);
366 362
367 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, 363 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
364 ACPI_REGISTER_PM1_CONTROL,
368 sleep_enable_reg_info->access_bit_mask); 365 sleep_enable_reg_info->access_bit_mask);
369 if (ACPI_FAILURE (status)) { 366 if (ACPI_FAILURE (status)) {
370 return_ACPI_STATUS (status); 367 return_ACPI_STATUS (status);
@@ -374,7 +371,8 @@ acpi_enter_sleep_state (
374 /* Wait until we enter sleep state */ 371 /* Wait until we enter sleep state */
375 372
376 do { 373 do {
377 status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_DO_NOT_LOCK); 374 status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value,
375 ACPI_MTX_DO_NOT_LOCK);
378 if (ACPI_FAILURE (status)) { 376 if (ACPI_FAILURE (status)) {
379 return_ACPI_STATUS (status); 377 return_ACPI_STATUS (status);
380 } 378 }
@@ -388,7 +386,7 @@ acpi_enter_sleep_state (
388EXPORT_SYMBOL(acpi_enter_sleep_state); 386EXPORT_SYMBOL(acpi_enter_sleep_state);
389 387
390 388
391/****************************************************************************** 389/*******************************************************************************
392 * 390 *
393 * FUNCTION: acpi_enter_sleep_state_s4bios 391 * FUNCTION: acpi_enter_sleep_state_s4bios
394 * 392 *
@@ -439,11 +437,13 @@ acpi_enter_sleep_state_s4bios (
439 437
440 ACPI_FLUSH_CPU_CACHE (); 438 ACPI_FLUSH_CPU_CACHE ();
441 439
442 status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, (u32) acpi_gbl_FADT->S4bios_req, 8); 440 status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd,
441 (u32) acpi_gbl_FADT->S4bios_req, 8);
443 442
444 do { 443 do {
445 acpi_os_stall(1000); 444 acpi_os_stall(1000);
446 status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_DO_NOT_LOCK); 445 status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value,
446 ACPI_MTX_DO_NOT_LOCK);
447 if (ACPI_FAILURE (status)) { 447 if (ACPI_FAILURE (status)) {
448 return_ACPI_STATUS (status); 448 return_ACPI_STATUS (status);
449 } 449 }
@@ -454,7 +454,7 @@ acpi_enter_sleep_state_s4bios (
454EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); 454EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
455 455
456 456
457/****************************************************************************** 457/*******************************************************************************
458 * 458 *
459 * FUNCTION: acpi_leave_sleep_state 459 * FUNCTION: acpi_leave_sleep_state
460 * 460 *
@@ -534,18 +534,21 @@ acpi_leave_sleep_state (
534 arg.integer.value = ACPI_SST_WAKING; 534 arg.integer.value = ACPI_SST_WAKING;
535 status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); 535 status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
536 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { 536 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
537 ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); 537 ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
538 acpi_format_exception (status)));
538 } 539 }
539 540
540 arg.integer.value = sleep_state; 541 arg.integer.value = sleep_state;
541 status = acpi_evaluate_object (NULL, METHOD_NAME__BFS, &arg_list, NULL); 542 status = acpi_evaluate_object (NULL, METHOD_NAME__BFS, &arg_list, NULL);
542 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { 543 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
543 ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", acpi_format_exception (status))); 544 ACPI_REPORT_ERROR (("Method _BFS failed, %s\n",
545 acpi_format_exception (status)));
544 } 546 }
545 547
546 status = acpi_evaluate_object (NULL, METHOD_NAME__WAK, &arg_list, NULL); 548 status = acpi_evaluate_object (NULL, METHOD_NAME__WAK, &arg_list, NULL);
547 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { 549 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
548 ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", acpi_format_exception (status))); 550 ACPI_REPORT_ERROR (("Method _WAK failed, %s\n",
551 acpi_format_exception (status)));
549 } 552 }
550 /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ 553 /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
551 554
@@ -567,15 +570,19 @@ acpi_leave_sleep_state (
567 570
568 /* Enable power button */ 571 /* Enable power button */
569 572
570 (void) acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id, 573 (void) acpi_set_register(
574 acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id,
571 1, ACPI_MTX_DO_NOT_LOCK); 575 1, ACPI_MTX_DO_NOT_LOCK);
572 (void) acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id, 576
577 (void) acpi_set_register(
578 acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id,
573 1, ACPI_MTX_DO_NOT_LOCK); 579 1, ACPI_MTX_DO_NOT_LOCK);
574 580
575 arg.integer.value = ACPI_SST_WORKING; 581 arg.integer.value = ACPI_SST_WORKING;
576 status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); 582 status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
577 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { 583 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
578 ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); 584 ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
585 acpi_format_exception (status)));
579 } 586 }
580 587
581 return_ACPI_STATUS (status); 588 return_ACPI_STATUS (status);
diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c
index 1906167d7294..49d7b395322e 100644
--- a/drivers/acpi/hardware/hwtimer.c
+++ b/drivers/acpi/hardware/hwtimer.c
@@ -43,7 +43,6 @@
43 */ 43 */
44 44
45#include <linux/module.h> 45#include <linux/module.h>
46
47#include <acpi/acpi.h> 46#include <acpi/acpi.h>
48 47
49#define _COMPONENT ACPI_HARDWARE 48#define _COMPONENT ACPI_HARDWARE
@@ -90,7 +89,7 @@ acpi_get_timer_resolution (
90 * 89 *
91 * PARAMETERS: Ticks - Where the timer value is returned 90 * PARAMETERS: Ticks - Where the timer value is returned
92 * 91 *
93 * RETURN: Status and current ticks 92 * RETURN: Status and current timer value (ticks)
94 * 93 *
95 * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). 94 * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks).
96 * 95 *
@@ -199,5 +198,6 @@ acpi_get_timer_duration (
199 *time_elapsed = (u32) quotient; 198 *time_elapsed = (u32) quotient;
200 return_ACPI_STATUS (status); 199 return_ACPI_STATUS (status);
201} 200}
201
202EXPORT_SYMBOL(acpi_get_timer_duration); 202EXPORT_SYMBOL(acpi_get_timer_duration);
203 203
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c
index 1c0c12336c57..ece7a9dedd5c 100644
--- a/drivers/acpi/namespace/nsaccess.c
+++ b/drivers/acpi/namespace/nsaccess.c
@@ -67,7 +67,8 @@
67 ******************************************************************************/ 67 ******************************************************************************/
68 68
69acpi_status 69acpi_status
70acpi_ns_root_initialize (void) 70acpi_ns_root_initialize (
71 void)
71{ 72{
72 acpi_status status; 73 acpi_status status;
73 const struct acpi_predefined_names *init_val = NULL; 74 const struct acpi_predefined_names *init_val = NULL;
@@ -265,7 +266,7 @@ unlock_and_exit:
265 * 266 *
266 * FUNCTION: acpi_ns_lookup 267 * FUNCTION: acpi_ns_lookup
267 * 268 *
268 * PARAMETERS: prefix_node - Search scope if name is not fully qualified 269 * PARAMETERS: scope_info - Current scope info block
269 * Pathname - Search pathname, in internal format 270 * Pathname - Search pathname, in internal format
270 * (as represented in the AML stream) 271 * (as represented in the AML stream)
271 * Type - Type associated with name 272 * Type - Type associated with name
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c
index bfd922c5c7d1..5653a19d7172 100644
--- a/drivers/acpi/namespace/nsalloc.c
+++ b/drivers/acpi/namespace/nsalloc.c
@@ -49,14 +49,20 @@
49#define _COMPONENT ACPI_NAMESPACE 49#define _COMPONENT ACPI_NAMESPACE
50 ACPI_MODULE_NAME ("nsalloc") 50 ACPI_MODULE_NAME ("nsalloc")
51 51
52/* Local prototypes */
53
54static void
55acpi_ns_remove_reference (
56 struct acpi_namespace_node *node);
57
52 58
53/******************************************************************************* 59/*******************************************************************************
54 * 60 *
55 * FUNCTION: acpi_ns_create_node 61 * FUNCTION: acpi_ns_create_node
56 * 62 *
57 * PARAMETERS: acpi_name - Name of the new node 63 * PARAMETERS: Name - Name of the new node (4 char ACPI name)
58 * 64 *
59 * RETURN: None 65 * RETURN: New namespace node (Null on failure)
60 * 66 *
61 * DESCRIPTION: Create a namespace node 67 * DESCRIPTION: Create a namespace node
62 * 68 *
@@ -145,7 +151,6 @@ acpi_ns_delete_node (
145 } 151 }
146 } 152 }
147 153
148
149 ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++); 154 ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
150 155
151 /* 156 /*
@@ -157,57 +162,6 @@ acpi_ns_delete_node (
157} 162}
158 163
159 164
160#ifdef ACPI_ALPHABETIC_NAMESPACE
161/*******************************************************************************
162 *
163 * FUNCTION: acpi_ns_compare_names
164 *
165 * PARAMETERS: Name1 - First name to compare
166 * Name2 - Second name to compare
167 *
168 * RETURN: value from strncmp
169 *
170 * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an
171 * underscore are forced to be alphabetically first.
172 *
173 ******************************************************************************/
174
175int
176acpi_ns_compare_names (
177 char *name1,
178 char *name2)
179{
180 char reversed_name1[ACPI_NAME_SIZE];
181 char reversed_name2[ACPI_NAME_SIZE];
182 u32 i;
183 u32 j;
184
185
186 /*
187 * Replace all instances of "underscore" with a value that is smaller so
188 * that all names that are prefixed with underscore(s) are alphabetically
189 * first.
190 *
191 * Reverse the name bytewise so we can just do a 32-bit compare instead
192 * of a strncmp.
193 */
194 for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) {
195 reversed_name1[j] = name1[i];
196 if (name1[i] == '_') {
197 reversed_name1[j] = '*';
198 }
199
200 reversed_name2[j] = name2[i];
201 if (name2[i] == '_') {
202 reversed_name2[j] = '*';
203 }
204 }
205
206 return (*(int *) reversed_name1 - *(int *) reversed_name2);
207}
208#endif
209
210
211/******************************************************************************* 165/*******************************************************************************
212 * 166 *
213 * FUNCTION: acpi_ns_install_node 167 * FUNCTION: acpi_ns_install_node
@@ -271,7 +225,8 @@ acpi_ns_install_node (
271 * alphabetic placement. 225 * alphabetic placement.
272 */ 226 */
273 previous_child_node = NULL; 227 previous_child_node = NULL;
274 while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node), acpi_ut_get_node_name (node)) < 0) { 228 while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node),
229 acpi_ut_get_node_name (node)) < 0) {
275 if (child_node->flags & ANOBJ_END_OF_PEER_LIST) { 230 if (child_node->flags & ANOBJ_END_OF_PEER_LIST) {
276 /* Last peer; Clear end-of-list flag */ 231 /* Last peer; Clear end-of-list flag */
277 232
@@ -429,7 +384,8 @@ acpi_ns_delete_children (
429 /* There should be only one reference remaining on this node */ 384 /* There should be only one reference remaining on this node */
430 385
431 if (child_node->reference_count != 1) { 386 if (child_node->reference_count != 1) {
432 ACPI_REPORT_WARNING (("Existing references (%d) on node being deleted (%p)\n", 387 ACPI_REPORT_WARNING ((
388 "Existing references (%d) on node being deleted (%p)\n",
433 child_node->reference_count, child_node)); 389 child_node->reference_count, child_node));
434 } 390 }
435 391
@@ -548,7 +504,7 @@ acpi_ns_delete_namespace_subtree (
548 * 504 *
549 ******************************************************************************/ 505 ******************************************************************************/
550 506
551void 507static void
552acpi_ns_remove_reference ( 508acpi_ns_remove_reference (
553 struct acpi_namespace_node *node) 509 struct acpi_namespace_node *node)
554{ 510{
@@ -683,3 +639,54 @@ acpi_ns_delete_namespace_by_owner (
683} 639}
684 640
685 641
642#ifdef ACPI_ALPHABETIC_NAMESPACE
643/*******************************************************************************
644 *
645 * FUNCTION: acpi_ns_compare_names
646 *
647 * PARAMETERS: Name1 - First name to compare
648 * Name2 - Second name to compare
649 *
650 * RETURN: value from strncmp
651 *
652 * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an
653 * underscore are forced to be alphabetically first.
654 *
655 ******************************************************************************/
656
657int
658acpi_ns_compare_names (
659 char *name1,
660 char *name2)
661{
662 char reversed_name1[ACPI_NAME_SIZE];
663 char reversed_name2[ACPI_NAME_SIZE];
664 u32 i;
665 u32 j;
666
667
668 /*
669 * Replace all instances of "underscore" with a value that is smaller so
670 * that all names that are prefixed with underscore(s) are alphabetically
671 * first.
672 *
673 * Reverse the name bytewise so we can just do a 32-bit compare instead
674 * of a strncmp.
675 */
676 for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) {
677 reversed_name1[j] = name1[i];
678 if (name1[i] == '_') {
679 reversed_name1[j] = '*';
680 }
681
682 reversed_name2[j] = name2[i];
683 if (name2[i] == '_') {
684 reversed_name2[j] = '*';
685 }
686 }
687
688 return (*(int *) reversed_name1 - *(int *) reversed_name2);
689}
690#endif
691
692
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c
index 1f6af3eb6c91..4550e6f9809b 100644
--- a/drivers/acpi/namespace/nsdump.c
+++ b/drivers/acpi/namespace/nsdump.c
@@ -50,16 +50,32 @@
50#define _COMPONENT ACPI_NAMESPACE 50#define _COMPONENT ACPI_NAMESPACE
51 ACPI_MODULE_NAME ("nsdump") 51 ACPI_MODULE_NAME ("nsdump")
52 52
53/* Local prototypes */
53 54
54#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 55#ifdef ACPI_OBSOLETE_FUNCTIONS
56void
57acpi_ns_dump_root_devices (
58 void);
55 59
60static acpi_status
61acpi_ns_dump_one_device (
62 acpi_handle obj_handle,
63 u32 level,
64 void *context,
65 void **return_value);
66#endif
67
68
69#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
56/******************************************************************************* 70/*******************************************************************************
57 * 71 *
58 * FUNCTION: acpi_ns_print_pathname 72 * FUNCTION: acpi_ns_print_pathname
59 * 73 *
60 * PARAMETERS: num_segment - Number of ACPI name segments 74 * PARAMETERS: num_segments - Number of ACPI name segments
61 * Pathname - The compressed (internal) path 75 * Pathname - The compressed (internal) path
62 * 76 *
77 * RETURN: None
78 *
63 * DESCRIPTION: Print an object's full namespace pathname 79 * DESCRIPTION: Print an object's full namespace pathname
64 * 80 *
65 ******************************************************************************/ 81 ******************************************************************************/
@@ -103,6 +119,8 @@ acpi_ns_print_pathname (
103 * Level - Desired debug level 119 * Level - Desired debug level
104 * Component - Caller's component ID 120 * Component - Caller's component ID
105 * 121 *
122 * RETURN: None
123 *
106 * DESCRIPTION: Print an object's full namespace pathname 124 * DESCRIPTION: Print an object's full namespace pathname
107 * Manages allocation/freeing of a pathname buffer 125 * Manages allocation/freeing of a pathname buffer
108 * 126 *
@@ -137,9 +155,12 @@ acpi_ns_dump_pathname (
137 * 155 *
138 * FUNCTION: acpi_ns_dump_one_object 156 * FUNCTION: acpi_ns_dump_one_object
139 * 157 *
140 * PARAMETERS: Handle - Node to be dumped 158 * PARAMETERS: obj_handle - Node to be dumped
141 * Level - Nesting level of the handle 159 * Level - Nesting level of the handle
142 * Context - Passed into walk_namespace 160 * Context - Passed into walk_namespace
161 * return_value - Not used
162 *
163 * RETURN: Status
143 * 164 *
144 * DESCRIPTION: Dump a single Node 165 * DESCRIPTION: Dump a single Node
145 * This procedure is a user_function called by acpi_ns_walk_namespace. 166 * This procedure is a user_function called by acpi_ns_walk_namespace.
@@ -394,8 +415,7 @@ acpi_ns_dump_one_object (
394 return (AE_OK); 415 return (AE_OK);
395 } 416 }
396 417
397 acpi_os_printf ("(R%d)", 418 acpi_os_printf ("(R%d)", obj_desc->common.reference_count);
398 obj_desc->common.reference_count);
399 419
400 switch (type) { 420 switch (type) {
401 case ACPI_TYPE_METHOD: 421 case ACPI_TYPE_METHOD:
@@ -551,18 +571,20 @@ cleanup:
551 571
552 572
553#ifdef ACPI_FUTURE_USAGE 573#ifdef ACPI_FUTURE_USAGE
554
555/******************************************************************************* 574/*******************************************************************************
556 * 575 *
557 * FUNCTION: acpi_ns_dump_objects 576 * FUNCTION: acpi_ns_dump_objects
558 * 577 *
559 * PARAMETERS: Type - Object type to be dumped 578 * PARAMETERS: Type - Object type to be dumped
579 * display_type - 0 or ACPI_DISPLAY_SUMMARY
560 * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX 580 * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX
561 * for an effectively unlimited depth. 581 * for an effectively unlimited depth.
562 * owner_id - Dump only objects owned by this ID. Use 582 * owner_id - Dump only objects owned by this ID. Use
563 * ACPI_UINT32_MAX to match all owners. 583 * ACPI_UINT32_MAX to match all owners.
564 * start_handle - Where in namespace to start/end search 584 * start_handle - Where in namespace to start/end search
565 * 585 *
586 * RETURN: None
587 *
566 * DESCRIPTION: Dump typed objects within the loaded namespace. 588 * DESCRIPTION: Dump typed objects within the loaded namespace.
567 * Uses acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object. 589 * Uses acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object.
568 * 590 *
@@ -594,6 +616,39 @@ acpi_ns_dump_objects (
594 616
595/******************************************************************************* 617/*******************************************************************************
596 * 618 *
619 * FUNCTION: acpi_ns_dump_entry
620 *
621 * PARAMETERS: Handle - Node to be dumped
622 * debug_level - Output level
623 *
624 * RETURN: None
625 *
626 * DESCRIPTION: Dump a single Node
627 *
628 ******************************************************************************/
629
630void
631acpi_ns_dump_entry (
632 acpi_handle handle,
633 u32 debug_level)
634{
635 struct acpi_walk_info info;
636
637
638 ACPI_FUNCTION_ENTRY ();
639
640
641 info.debug_level = debug_level;
642 info.owner_id = ACPI_UINT32_MAX;
643 info.display_type = ACPI_DISPLAY_SUMMARY;
644
645 (void) acpi_ns_dump_one_object (handle, 1, &info, NULL);
646}
647
648
649#ifdef _ACPI_ASL_COMPILER
650/*******************************************************************************
651 *
597 * FUNCTION: acpi_ns_dump_tables 652 * FUNCTION: acpi_ns_dump_tables
598 * 653 *
599 * PARAMETERS: search_base - Root of subtree to be dumped, or 654 * PARAMETERS: search_base - Root of subtree to be dumped, or
@@ -601,6 +656,8 @@ acpi_ns_dump_objects (
601 * max_depth - Maximum depth of dump. Use INT_MAX 656 * max_depth - Maximum depth of dump. Use INT_MAX
602 * for an effectively unlimited depth. 657 * for an effectively unlimited depth.
603 * 658 *
659 * RETURN: None
660 *
604 * DESCRIPTION: Dump the name space, or a portion of it. 661 * DESCRIPTION: Dump the name space, or a portion of it.
605 * 662 *
606 ******************************************************************************/ 663 ******************************************************************************/
@@ -626,7 +683,7 @@ acpi_ns_dump_tables (
626 } 683 }
627 684
628 if (ACPI_NS_ALL == search_base) { 685 if (ACPI_NS_ALL == search_base) {
629 /* entire namespace */ 686 /* Entire namespace */
630 687
631 search_handle = acpi_gbl_root_node; 688 search_handle = acpi_gbl_root_node;
632 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); 689 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
@@ -636,38 +693,6 @@ acpi_ns_dump_tables (
636 ACPI_UINT32_MAX, search_handle); 693 ACPI_UINT32_MAX, search_handle);
637 return_VOID; 694 return_VOID;
638} 695}
639 696#endif /* _ACPI_ASL_COMPILER */
640#endif /* ACPI_FUTURE_USAGE */ 697#endif /* ACPI_FUTURE_USAGE */
641 698#endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */
642
643/*******************************************************************************
644 *
645 * FUNCTION: acpi_ns_dump_entry
646 *
647 * PARAMETERS: Handle - Node to be dumped
648 * debug_level - Output level
649 *
650 * DESCRIPTION: Dump a single Node
651 *
652 ******************************************************************************/
653
654void
655acpi_ns_dump_entry (
656 acpi_handle handle,
657 u32 debug_level)
658{
659 struct acpi_walk_info info;
660
661
662 ACPI_FUNCTION_ENTRY ();
663
664
665 info.debug_level = debug_level;
666 info.owner_id = ACPI_UINT32_MAX;
667 info.display_type = ACPI_DISPLAY_SUMMARY;
668
669 (void) acpi_ns_dump_one_object (handle, 1, &info, NULL);
670}
671
672#endif
673
diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c
index d30a59e6b07d..27c4f7cd2a43 100644
--- a/drivers/acpi/namespace/nsdumpdv.c
+++ b/drivers/acpi/namespace/nsdumpdv.c
@@ -43,15 +43,18 @@
43 43
44 44
45#include <acpi/acpi.h> 45#include <acpi/acpi.h>
46#include <acpi/acnamesp.h>
47 46
48 47
48/* TBD: This entire module is apparently obsolete and should be removed */
49
49#define _COMPONENT ACPI_NAMESPACE 50#define _COMPONENT ACPI_NAMESPACE
50 ACPI_MODULE_NAME ("nsdumpdv") 51 ACPI_MODULE_NAME ("nsdumpdv")
51 52
52 53#ifdef ACPI_OBSOLETE_FUNCTIONS
53#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 54#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
54 55
56#include <acpi/acnamesp.h>
57
55/******************************************************************************* 58/*******************************************************************************
56 * 59 *
57 * FUNCTION: acpi_ns_dump_one_device 60 * FUNCTION: acpi_ns_dump_one_device
@@ -59,13 +62,16 @@
59 * PARAMETERS: Handle - Node to be dumped 62 * PARAMETERS: Handle - Node to be dumped
60 * Level - Nesting level of the handle 63 * Level - Nesting level of the handle
61 * Context - Passed into walk_namespace 64 * Context - Passed into walk_namespace
65 * return_value - Not used
66 *
67 * RETURN: Status
62 * 68 *
63 * DESCRIPTION: Dump a single Node that represents a device 69 * DESCRIPTION: Dump a single Node that represents a device
64 * This procedure is a user_function called by acpi_ns_walk_namespace. 70 * This procedure is a user_function called by acpi_ns_walk_namespace.
65 * 71 *
66 ******************************************************************************/ 72 ******************************************************************************/
67 73
68acpi_status 74static acpi_status
69acpi_ns_dump_one_device ( 75acpi_ns_dump_one_device (
70 acpi_handle obj_handle, 76 acpi_handle obj_handle,
71 u32 level, 77 u32 level,
@@ -108,12 +114,15 @@ acpi_ns_dump_one_device (
108 * 114 *
109 * PARAMETERS: None 115 * PARAMETERS: None
110 * 116 *
117 * RETURN: None
118 *
111 * DESCRIPTION: Dump all objects of type "device" 119 * DESCRIPTION: Dump all objects of type "device"
112 * 120 *
113 ******************************************************************************/ 121 ******************************************************************************/
114 122
115void 123void
116acpi_ns_dump_root_devices (void) 124acpi_ns_dump_root_devices (
125 void)
117{ 126{
118 acpi_handle sys_bus_handle; 127 acpi_handle sys_bus_handle;
119 acpi_status status; 128 acpi_status status;
@@ -142,5 +151,6 @@ acpi_ns_dump_root_devices (void)
142} 151}
143 152
144#endif 153#endif
154#endif
145 155
146 156
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c
index 0d008d53657e..1ae89a1c8826 100644
--- a/drivers/acpi/namespace/nseval.c
+++ b/drivers/acpi/namespace/nseval.c
@@ -52,19 +52,33 @@
52#define _COMPONENT ACPI_NAMESPACE 52#define _COMPONENT ACPI_NAMESPACE
53 ACPI_MODULE_NAME ("nseval") 53 ACPI_MODULE_NAME ("nseval")
54 54
55/* Local prototypes */
56
57static acpi_status
58acpi_ns_execute_control_method (
59 struct acpi_parameter_info *info);
60
61static acpi_status
62acpi_ns_get_object_value (
63 struct acpi_parameter_info *info);
64
55 65
56/******************************************************************************* 66/*******************************************************************************
57 * 67 *
58 * FUNCTION: acpi_ns_evaluate_relative 68 * FUNCTION: acpi_ns_evaluate_relative
59 * 69 *
60 * PARAMETERS: Pathname - Name of method to execute, If NULL, the 70 * PARAMETERS: Pathname - Name of method to execute, If NULL, the
61 * handle is the object to execute 71 * handle is the object to execute
62 * Info - Method info block 72 * Info - Method info block, contains:
73 * return_object - Where to put method's return value (if
74 * any). If NULL, no value is returned.
75 * Params - List of parameters to pass to the method,
76 * terminated by NULL. Params itself may be
77 * NULL if no parameters are being passed.
63 * 78 *
64 * RETURN: Status 79 * RETURN: Status
65 * 80 *
66 * DESCRIPTION: Find and execute the requested method using the handle as a 81 * DESCRIPTION: Evaluate the object or find and execute the requested method
67 * scope
68 * 82 *
69 * MUTEX: Locks Namespace 83 * MUTEX: Locks Namespace
70 * 84 *
@@ -157,8 +171,8 @@ cleanup1:
157 * 171 *
158 * FUNCTION: acpi_ns_evaluate_by_name 172 * FUNCTION: acpi_ns_evaluate_by_name
159 * 173 *
160 * PARAMETERS: Pathname - Fully qualified pathname to the object 174 * PARAMETERS: Pathname - Fully qualified pathname to the object
161 * Info - Contains: 175 * Info - Method info block, contains:
162 * return_object - Where to put method's return value (if 176 * return_object - Where to put method's return value (if
163 * any). If NULL, no value is returned. 177 * any). If NULL, no value is returned.
164 * Params - List of parameters to pass to the method, 178 * Params - List of parameters to pass to the method,
@@ -167,8 +181,8 @@ cleanup1:
167 * 181 *
168 * RETURN: Status 182 * RETURN: Status
169 * 183 *
170 * DESCRIPTION: Find and execute the requested method passing the given 184 * DESCRIPTION: Evaluate the object or rind and execute the requested method
171 * parameters 185 * passing the given parameters
172 * 186 *
173 * MUTEX: Locks Namespace 187 * MUTEX: Locks Namespace
174 * 188 *
@@ -241,17 +255,21 @@ cleanup:
241 * 255 *
242 * FUNCTION: acpi_ns_evaluate_by_handle 256 * FUNCTION: acpi_ns_evaluate_by_handle
243 * 257 *
244 * PARAMETERS: Handle - Method Node to execute 258 * PARAMETERS: Info - Method info block, contains:
245 * Params - List of parameters to pass to the method, 259 * Node - Method/Object Node to execute
246 * terminated by NULL. Params itself may be 260 * Parameters - List of parameters to pass to the method,
261 * terminated by NULL. Params itself may be
247 * NULL if no parameters are being passed. 262 * NULL if no parameters are being passed.
248 * param_type - Type of Parameter list 263 * return_object - Where to put method's return value (if
249 * return_object - Where to put method's return value (if 264 * any). If NULL, no value is returned.
250 * any). If NULL, no value is returned. 265 * parameter_type - Type of Parameter list
266 * return_object - Where to put method's return value (if
267 * any). If NULL, no value is returned.
251 * 268 *
252 * RETURN: Status 269 * RETURN: Status
253 * 270 *
254 * DESCRIPTION: Execute the requested method passing the given parameters 271 * DESCRIPTION: Evaluate object or execute the requested method passing the
272 * given parameters
255 * 273 *
256 * MUTEX: Locks Namespace 274 * MUTEX: Locks Namespace
257 * 275 *
@@ -345,7 +363,16 @@ acpi_ns_evaluate_by_handle (
345 * 363 *
346 * FUNCTION: acpi_ns_execute_control_method 364 * FUNCTION: acpi_ns_execute_control_method
347 * 365 *
348 * PARAMETERS: Info - Method info block (w/params) 366 * PARAMETERS: Info - Method info block, contains:
367 * Node - Method Node to execute
368 * Parameters - List of parameters to pass to the method,
369 * terminated by NULL. Params itself may be
370 * NULL if no parameters are being passed.
371 * return_object - Where to put method's return value (if
372 * any). If NULL, no value is returned.
373 * parameter_type - Type of Parameter list
374 * return_object - Where to put method's return value (if
375 * any). If NULL, no value is returned.
349 * 376 *
350 * RETURN: Status 377 * RETURN: Status
351 * 378 *
@@ -355,7 +382,7 @@ acpi_ns_evaluate_by_handle (
355 * 382 *
356 ******************************************************************************/ 383 ******************************************************************************/
357 384
358acpi_status 385static acpi_status
359acpi_ns_execute_control_method ( 386acpi_ns_execute_control_method (
360 struct acpi_parameter_info *info) 387 struct acpi_parameter_info *info)
361{ 388{
@@ -414,7 +441,10 @@ acpi_ns_execute_control_method (
414 * 441 *
415 * FUNCTION: acpi_ns_get_object_value 442 * FUNCTION: acpi_ns_get_object_value
416 * 443 *
417 * PARAMETERS: Info - Method info block (w/params) 444 * PARAMETERS: Info - Method info block, contains:
445 * Node - Object's NS node
446 * return_object - Where to put object value (if
447 * any). If NULL, no value is returned.
418 * 448 *
419 * RETURN: Status 449 * RETURN: Status
420 * 450 *
@@ -424,7 +454,7 @@ acpi_ns_execute_control_method (
424 * 454 *
425 ******************************************************************************/ 455 ******************************************************************************/
426 456
427acpi_status 457static acpi_status
428acpi_ns_get_object_value ( 458acpi_ns_get_object_value (
429 struct acpi_parameter_info *info) 459 struct acpi_parameter_info *info)
430{ 460{
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c
index 4a46b380605b..362802ae29a2 100644
--- a/drivers/acpi/namespace/nsinit.c
+++ b/drivers/acpi/namespace/nsinit.c
@@ -50,6 +50,22 @@
50#define _COMPONENT ACPI_NAMESPACE 50#define _COMPONENT ACPI_NAMESPACE
51 ACPI_MODULE_NAME ("nsinit") 51 ACPI_MODULE_NAME ("nsinit")
52 52
53/* Local prototypes */
54
55static acpi_status
56acpi_ns_init_one_object (
57 acpi_handle obj_handle,
58 u32 level,
59 void *context,
60 void **return_value);
61
62static acpi_status
63acpi_ns_init_one_device (
64 acpi_handle obj_handle,
65 u32 nesting_level,
66 void *context,
67 void **return_value);
68
53 69
54/******************************************************************************* 70/*******************************************************************************
55 * 71 *
@@ -191,7 +207,7 @@ acpi_ns_initialize_devices (
191 * 207 *
192 ******************************************************************************/ 208 ******************************************************************************/
193 209
194acpi_status 210static acpi_status
195acpi_ns_init_one_object ( 211acpi_ns_init_one_object (
196 acpi_handle obj_handle, 212 acpi_handle obj_handle,
197 u32 level, 213 u32 level,
@@ -331,7 +347,7 @@ acpi_ns_init_one_object (
331 * 347 *
332 ******************************************************************************/ 348 ******************************************************************************/
333 349
334acpi_status 350static acpi_status
335acpi_ns_init_one_device ( 351acpi_ns_init_one_device (
336 acpi_handle obj_handle, 352 acpi_handle obj_handle,
337 u32 nesting_level, 353 u32 nesting_level,
@@ -374,7 +390,8 @@ acpi_ns_init_one_device (
374 /* 390 /*
375 * Run _STA to determine if we can run _INI on the device. 391 * Run _STA to determine if we can run _INI on the device.
376 */ 392 */
377 ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, pinfo.node, "_STA")); 393 ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD,
394 pinfo.node, METHOD_NAME__STA));
378 status = acpi_ut_execute_STA (pinfo.node, &flags); 395 status = acpi_ut_execute_STA (pinfo.node, &flags);
379 396
380 if (ACPI_FAILURE (status)) { 397 if (ACPI_FAILURE (status)) {
@@ -399,8 +416,9 @@ acpi_ns_init_one_device (
399 /* 416 /*
400 * The device is present. Run _INI. 417 * The device is present. Run _INI.
401 */ 418 */
402 ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, pinfo.node, "_INI")); 419 ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD,
403 status = acpi_ns_evaluate_relative ("_INI", &pinfo); 420 pinfo.node, METHOD_NAME__INI));
421 status = acpi_ns_evaluate_relative (METHOD_NAME__INI, &pinfo);
404 if (ACPI_FAILURE (status)) { 422 if (ACPI_FAILURE (status)) {
405 /* No _INI (AE_NOT_FOUND) means device requires no initialization */ 423 /* No _INI (AE_NOT_FOUND) means device requires no initialization */
406 424
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c
index 1d7aedf68a77..34e497016601 100644
--- a/drivers/acpi/namespace/nsload.c
+++ b/drivers/acpi/namespace/nsload.c
@@ -50,9 +50,24 @@
50#define _COMPONENT ACPI_NAMESPACE 50#define _COMPONENT ACPI_NAMESPACE
51 ACPI_MODULE_NAME ("nsload") 51 ACPI_MODULE_NAME ("nsload")
52 52
53/* Local prototypes */
53 54
54#ifndef ACPI_NO_METHOD_EXECUTION 55static acpi_status
56acpi_ns_load_table_by_type (
57 acpi_table_type table_type);
58
59#ifdef ACPI_FUTURE_IMPLEMENTATION
60acpi_status
61acpi_ns_unload_namespace (
62 acpi_handle handle);
63
64static acpi_status
65acpi_ns_delete_subtree (
66 acpi_handle start_handle);
67#endif
55 68
69
70#ifndef ACPI_NO_METHOD_EXECUTION
56/******************************************************************************* 71/*******************************************************************************
57 * 72 *
58 * FUNCTION: acpi_ns_load_table 73 * FUNCTION: acpi_ns_load_table
@@ -159,7 +174,7 @@ acpi_ns_load_table (
159 * 174 *
160 ******************************************************************************/ 175 ******************************************************************************/
161 176
162acpi_status 177static acpi_status
163acpi_ns_load_table_by_type ( 178acpi_ns_load_table_by_type (
164 acpi_table_type table_type) 179 acpi_table_type table_type)
165{ 180{
@@ -321,8 +336,7 @@ acpi_ns_load_namespace (
321} 336}
322 337
323 338
324#ifdef ACPI_FUTURE_USAGE 339#ifdef ACPI_FUTURE_IMPLEMENTATION
325
326/******************************************************************************* 340/*******************************************************************************
327 * 341 *
328 * FUNCTION: acpi_ns_delete_subtree 342 * FUNCTION: acpi_ns_delete_subtree
@@ -339,7 +353,7 @@ acpi_ns_load_namespace (
339 * 353 *
340 ******************************************************************************/ 354 ******************************************************************************/
341 355
342acpi_status 356static acpi_status
343acpi_ns_delete_subtree ( 357acpi_ns_delete_subtree (
344 acpi_handle start_handle) 358 acpi_handle start_handle)
345{ 359{
@@ -453,8 +467,6 @@ acpi_ns_unload_namespace (
453 467
454 return_ACPI_STATUS (status); 468 return_ACPI_STATUS (status);
455} 469}
456 470#endif
457#endif /* ACPI_FUTURE_USAGE */
458
459#endif 471#endif
460 472
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c
index b6f8f910eff0..d8ce7e39795f 100644
--- a/drivers/acpi/namespace/nsnames.c
+++ b/drivers/acpi/namespace/nsnames.c
@@ -50,6 +50,14 @@
50#define _COMPONENT ACPI_NAMESPACE 50#define _COMPONENT ACPI_NAMESPACE
51 ACPI_MODULE_NAME ("nsnames") 51 ACPI_MODULE_NAME ("nsnames")
52 52
53/* Local prototypes */
54
55static void
56acpi_ns_build_external_path (
57 struct acpi_namespace_node *node,
58 acpi_size size,
59 char *name_buffer);
60
53 61
54/******************************************************************************* 62/*******************************************************************************
55 * 63 *
@@ -66,7 +74,7 @@
66 * 74 *
67 ******************************************************************************/ 75 ******************************************************************************/
68 76
69void 77static void
70acpi_ns_build_external_path ( 78acpi_ns_build_external_path (
71 struct acpi_namespace_node *node, 79 struct acpi_namespace_node *node,
72 acpi_size size, 80 acpi_size size,
@@ -126,7 +134,7 @@ acpi_ns_build_external_path (
126 * 134 *
127 * FUNCTION: acpi_ns_get_external_pathname 135 * FUNCTION: acpi_ns_get_external_pathname
128 * 136 *
129 * PARAMETERS: Node - NS node whose pathname is needed 137 * PARAMETERS: Node - Namespace node whose pathname is needed
130 * 138 *
131 * RETURN: Pointer to storage containing the fully qualified name of 139 * RETURN: Pointer to storage containing the fully qualified name of
132 * the node, In external format (name segments separated by path 140 * the node, In external format (name segments separated by path
diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c
index 4e41e66db61f..27258c1ca4f1 100644
--- a/drivers/acpi/namespace/nsobject.c
+++ b/drivers/acpi/namespace/nsobject.c
@@ -60,6 +60,8 @@
60 * Type - Type of object, or ACPI_TYPE_ANY if not 60 * Type - Type of object, or ACPI_TYPE_ANY if not
61 * known 61 * known
62 * 62 *
63 * RETURN: Status
64 *
63 * DESCRIPTION: Record the given object as the value associated with the 65 * DESCRIPTION: Record the given object as the value associated with the
64 * name whose acpi_handle is passed. If Object is NULL 66 * name whose acpi_handle is passed. If Object is NULL
65 * and Type is ACPI_TYPE_ANY, set the name as having no value. 67 * and Type is ACPI_TYPE_ANY, set the name as having no value.
@@ -97,7 +99,8 @@ acpi_ns_attach_object (
97 if (!object && (ACPI_TYPE_ANY != type)) { 99 if (!object && (ACPI_TYPE_ANY != type)) {
98 /* Null object */ 100 /* Null object */
99 101
100 ACPI_REPORT_ERROR (("ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n")); 102 ACPI_REPORT_ERROR ((
103 "ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
101 return_ACPI_STATUS (AE_BAD_PARAMETER); 104 return_ACPI_STATUS (AE_BAD_PARAMETER);
102 } 105 }
103 106
@@ -112,7 +115,8 @@ acpi_ns_attach_object (
112 /* Check if this object is already attached */ 115 /* Check if this object is already attached */
113 116
114 if (node->object == object) { 117 if (node->object == object) {
115 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj %p already installed in name_obj %p\n", 118 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
119 "Obj %p already installed in name_obj %p\n",
116 object, node)); 120 object, node));
117 121
118 return_ACPI_STATUS (AE_OK); 122 return_ACPI_STATUS (AE_OK);
@@ -192,7 +196,7 @@ acpi_ns_attach_object (
192 * 196 *
193 * FUNCTION: acpi_ns_detach_object 197 * FUNCTION: acpi_ns_detach_object
194 * 198 *
195 * PARAMETERS: Node - An node whose object will be detached 199 * PARAMETERS: Node - A Namespace node whose object will be detached
196 * 200 *
197 * RETURN: None. 201 * RETURN: None.
198 * 202 *
@@ -248,7 +252,7 @@ acpi_ns_detach_object (
248 * 252 *
249 * FUNCTION: acpi_ns_get_attached_object 253 * FUNCTION: acpi_ns_get_attached_object
250 * 254 *
251 * PARAMETERS: Node - Parent Node to be examined 255 * PARAMETERS: Node - Namespace node
252 * 256 *
253 * RETURN: Current value of the object field from the Node whose 257 * RETURN: Current value of the object field from the Node whose
254 * handle is passed 258 * handle is passed
@@ -284,7 +288,7 @@ acpi_ns_get_attached_object (
284 * 288 *
285 * FUNCTION: acpi_ns_get_secondary_object 289 * FUNCTION: acpi_ns_get_secondary_object
286 * 290 *
287 * PARAMETERS: Node - Parent Node to be examined 291 * PARAMETERS: Node - Namespace node
288 * 292 *
289 * RETURN: Current value of the object field from the Node whose 293 * RETURN: Current value of the object field from the Node whose
290 * handle is passed. 294 * handle is passed.
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c
index 0e6dea23603b..af8aaa9cc4f3 100644
--- a/drivers/acpi/namespace/nssearch.c
+++ b/drivers/acpi/namespace/nssearch.c
@@ -49,15 +49,24 @@
49#define _COMPONENT ACPI_NAMESPACE 49#define _COMPONENT ACPI_NAMESPACE
50 ACPI_MODULE_NAME ("nssearch") 50 ACPI_MODULE_NAME ("nssearch")
51 51
52/* Local prototypes */
53
54static acpi_status
55acpi_ns_search_parent_tree (
56 u32 target_name,
57 struct acpi_namespace_node *node,
58 acpi_object_type type,
59 struct acpi_namespace_node **return_node);
60
52 61
53/******************************************************************************* 62/*******************************************************************************
54 * 63 *
55 * FUNCTION: acpi_ns_search_node 64 * FUNCTION: acpi_ns_search_node
56 * 65 *
57 * PARAMETERS: *target_name - Ascii ACPI name to search for 66 * PARAMETERS: target_name - Ascii ACPI name to search for
58 * *Node - Starting node where search will begin 67 * Node - Starting node where search will begin
59 * Type - Object type to match 68 * Type - Object type to match
60 * **return_node - Where the matched Named obj is returned 69 * return_node - Where the matched Named obj is returned
61 * 70 *
62 * RETURN: Status 71 * RETURN: Status
63 * 72 *
@@ -163,10 +172,10 @@ acpi_ns_search_node (
163 * 172 *
164 * FUNCTION: acpi_ns_search_parent_tree 173 * FUNCTION: acpi_ns_search_parent_tree
165 * 174 *
166 * PARAMETERS: *target_name - Ascii ACPI name to search for 175 * PARAMETERS: target_name - Ascii ACPI name to search for
167 * *Node - Starting node where search will begin 176 * Node - Starting node where search will begin
168 * Type - Object type to match 177 * Type - Object type to match
169 * **return_node - Where the matched Node is returned 178 * return_node - Where the matched Node is returned
170 * 179 *
171 * RETURN: Status 180 * RETURN: Status
172 * 181 *
@@ -257,12 +266,12 @@ acpi_ns_search_parent_tree (
257 * 266 *
258 * PARAMETERS: target_name - Ascii ACPI name to search for (4 chars) 267 * PARAMETERS: target_name - Ascii ACPI name to search for (4 chars)
259 * walk_state - Current state of the walk 268 * walk_state - Current state of the walk
260 * *Node - Starting node where search will begin 269 * Node - Starting node where search will begin
261 * interpreter_mode - Add names only in ACPI_MODE_LOAD_PASS_x. 270 * interpreter_mode - Add names only in ACPI_MODE_LOAD_PASS_x.
262 * Otherwise,search only. 271 * Otherwise,search only.
263 * Type - Object type to match 272 * Type - Object type to match
264 * Flags - Flags describing the search restrictions 273 * Flags - Flags describing the search restrictions
265 * **return_node - Where the Node is returned 274 * return_node - Where the Node is returned
266 * 275 *
267 * RETURN: Status 276 * RETURN: Status
268 * 277 *
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c
index 75da76cc0b19..c53b82e94ce3 100644
--- a/drivers/acpi/namespace/nsutils.c
+++ b/drivers/acpi/namespace/nsutils.c
@@ -51,6 +51,18 @@
51#define _COMPONENT ACPI_NAMESPACE 51#define _COMPONENT ACPI_NAMESPACE
52 ACPI_MODULE_NAME ("nsutils") 52 ACPI_MODULE_NAME ("nsutils")
53 53
54/* Local prototypes */
55
56static u8
57acpi_ns_valid_path_separator (
58 char sep);
59
60#ifdef ACPI_OBSOLETE_FUNCTIONS
61acpi_name
62acpi_ns_find_parent_name (
63 struct acpi_namespace_node *node_to_search);
64#endif
65
54 66
55/******************************************************************************* 67/*******************************************************************************
56 * 68 *
@@ -59,7 +71,8 @@
59 * PARAMETERS: module_name - Caller's module name (for error output) 71 * PARAMETERS: module_name - Caller's module name (for error output)
60 * line_number - Caller's line number (for error output) 72 * line_number - Caller's line number (for error output)
61 * component_id - Caller's component ID (for error output) 73 * component_id - Caller's component ID (for error output)
62 * Message - Error message to use on failure 74 * internal_name - Name or path of the namespace node
75 * lookup_status - Exception code from NS lookup
63 * 76 *
64 * RETURN: None 77 * RETURN: None
65 * 78 *
@@ -121,6 +134,9 @@ acpi_ns_report_error (
121 * line_number - Caller's line number (for error output) 134 * line_number - Caller's line number (for error output)
122 * component_id - Caller's component ID (for error output) 135 * component_id - Caller's component ID (for error output)
123 * Message - Error message to use on failure 136 * Message - Error message to use on failure
137 * prefix_node - Prefix relative to the path
138 * Path - Path to the node
139 * method_status - Execution status
124 * 140 *
125 * RETURN: None 141 * RETURN: None
126 * 142 *
@@ -161,8 +177,8 @@ acpi_ns_report_method_error (
161 * 177 *
162 * FUNCTION: acpi_ns_print_node_pathname 178 * FUNCTION: acpi_ns_print_node_pathname
163 * 179 *
164 * PARAMETERS: Node - Object 180 * PARAMETERS: Node - Object
165 * Msg - Prefix message 181 * Message - Prefix message
166 * 182 *
167 * DESCRIPTION: Print an object's full namespace pathname 183 * DESCRIPTION: Print an object's full namespace pathname
168 * Manages allocation/freeing of a pathname buffer 184 * Manages allocation/freeing of a pathname buffer
@@ -172,7 +188,7 @@ acpi_ns_report_method_error (
172void 188void
173acpi_ns_print_node_pathname ( 189acpi_ns_print_node_pathname (
174 struct acpi_namespace_node *node, 190 struct acpi_namespace_node *node,
175 char *msg) 191 char *message)
176{ 192{
177 struct acpi_buffer buffer; 193 struct acpi_buffer buffer;
178 acpi_status status; 194 acpi_status status;
@@ -189,8 +205,8 @@ acpi_ns_print_node_pathname (
189 205
190 status = acpi_ns_handle_to_pathname (node, &buffer); 206 status = acpi_ns_handle_to_pathname (node, &buffer);
191 if (ACPI_SUCCESS (status)) { 207 if (ACPI_SUCCESS (status)) {
192 if (msg) { 208 if (message) {
193 acpi_os_printf ("%s ", msg); 209 acpi_os_printf ("%s ", message);
194 } 210 }
195 211
196 acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node); 212 acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node);
@@ -224,7 +240,7 @@ acpi_ns_valid_root_prefix (
224 * 240 *
225 * FUNCTION: acpi_ns_valid_path_separator 241 * FUNCTION: acpi_ns_valid_path_separator
226 * 242 *
227 * PARAMETERS: Sep - Character to be checked 243 * PARAMETERS: Sep - Character to be checked
228 * 244 *
229 * RETURN: TRUE if a valid path separator 245 * RETURN: TRUE if a valid path separator
230 * 246 *
@@ -232,7 +248,7 @@ acpi_ns_valid_root_prefix (
232 * 248 *
233 ******************************************************************************/ 249 ******************************************************************************/
234 250
235u8 251static u8
236acpi_ns_valid_path_separator ( 252acpi_ns_valid_path_separator (
237 char sep) 253 char sep)
238{ 254{
@@ -245,10 +261,12 @@ acpi_ns_valid_path_separator (
245 * 261 *
246 * FUNCTION: acpi_ns_get_type 262 * FUNCTION: acpi_ns_get_type
247 * 263 *
248 * PARAMETERS: Handle - Parent Node to be examined 264 * PARAMETERS: Node - Parent Node to be examined
249 * 265 *
250 * RETURN: Type field from Node whose handle is passed 266 * RETURN: Type field from Node whose handle is passed
251 * 267 *
268 * DESCRIPTION: Return the type of a Namespace node
269 *
252 ******************************************************************************/ 270 ******************************************************************************/
253 271
254acpi_object_type 272acpi_object_type
@@ -271,11 +289,13 @@ acpi_ns_get_type (
271 * 289 *
272 * FUNCTION: acpi_ns_local 290 * FUNCTION: acpi_ns_local
273 * 291 *
274 * PARAMETERS: Type - A namespace object type 292 * PARAMETERS: Type - A namespace object type
275 * 293 *
276 * RETURN: LOCAL if names must be found locally in objects of the 294 * RETURN: LOCAL if names must be found locally in objects of the
277 * passed type, 0 if enclosing scopes should be searched 295 * passed type, 0 if enclosing scopes should be searched
278 * 296 *
297 * DESCRIPTION: Returns scope rule for the given object type.
298 *
279 ******************************************************************************/ 299 ******************************************************************************/
280 300
281u32 301u32
@@ -303,7 +323,7 @@ acpi_ns_local (
303 * PARAMETERS: Info - Info struct initialized with the 323 * PARAMETERS: Info - Info struct initialized with the
304 * external name pointer. 324 * external name pointer.
305 * 325 *
306 * RETURN: Status 326 * RETURN: None
307 * 327 *
308 * DESCRIPTION: Calculate the length of the internal (AML) namestring 328 * DESCRIPTION: Calculate the length of the internal (AML) namestring
309 * corresponding to the external (ASL) namestring. 329 * corresponding to the external (ASL) namestring.
@@ -551,14 +571,16 @@ acpi_ns_internalize_name (
551 * 571 *
552 * FUNCTION: acpi_ns_externalize_name 572 * FUNCTION: acpi_ns_externalize_name
553 * 573 *
554 * PARAMETERS: *internal_name - Internal representation of name 574 * PARAMETERS: internal_name_length - Lenth of the internal name below
555 * **converted_name - Where to return the resulting 575 * internal_name - Internal representation of name
556 * external representation of name 576 * converted_name_length - Where the length is returned
577 * converted_name - Where the resulting external name
578 * is returned
557 * 579 *
558 * RETURN: Status 580 * RETURN: Status
559 * 581 *
560 * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30) 582 * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
561 * to its external form (e.g. "\_PR_.CPU0") 583 * to its external (printable) form (e.g. "\_PR_.CPU0")
562 * 584 *
563 ******************************************************************************/ 585 ******************************************************************************/
564 586
@@ -717,8 +739,9 @@ acpi_ns_externalize_name (
717 * 739 *
718 * DESCRIPTION: Convert a namespace handle to a real Node 740 * DESCRIPTION: Convert a namespace handle to a real Node
719 * 741 *
720 * Note: Real integer handles allow for more verification 742 * Note: Real integer handles would allow for more verification
721 * and keep all pointers within this subsystem. 743 * and keep all pointers within this subsystem - however this introduces
744 * more (and perhaps unnecessary) overhead.
722 * 745 *
723 ******************************************************************************/ 746 ******************************************************************************/
724 747
@@ -775,7 +798,7 @@ acpi_ns_convert_entry_to_handle (
775 return ((acpi_handle) node); 798 return ((acpi_handle) node);
776 799
777 800
778/* --------------------------------------------------- 801/* Example future implementation ---------------------
779 802
780 if (!Node) 803 if (!Node)
781 { 804 {
@@ -801,12 +824,13 @@ acpi_ns_convert_entry_to_handle (
801 * 824 *
802 * RETURN: none 825 * RETURN: none
803 * 826 *
804 * DESCRIPTION: free memory allocated for table storage. 827 * DESCRIPTION: free memory allocated for namespace and ACPI table storage.
805 * 828 *
806 ******************************************************************************/ 829 ******************************************************************************/
807 830
808void 831void
809acpi_ns_terminate (void) 832acpi_ns_terminate (
833 void)
810{ 834{
811 union acpi_operand_object *obj_desc; 835 union acpi_operand_object *obj_desc;
812 836
@@ -940,7 +964,6 @@ acpi_ns_get_node_by_path (
940 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); 964 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
941 965
942cleanup: 966cleanup:
943 /* Cleanup */
944 if (internal_path) { 967 if (internal_path) {
945 ACPI_MEM_FREE (internal_path); 968 ACPI_MEM_FREE (internal_path);
946 } 969 }
@@ -950,55 +973,6 @@ cleanup:
950 973
951/******************************************************************************* 974/*******************************************************************************
952 * 975 *
953 * FUNCTION: acpi_ns_find_parent_name
954 *
955 * PARAMETERS: *child_node - Named Obj whose name is to be found
956 *
957 * RETURN: The ACPI name
958 *
959 * DESCRIPTION: Search for the given obj in its parent scope and return the
960 * name segment, or "????" if the parent name can't be found
961 * (which "should not happen").
962 *
963 ******************************************************************************/
964#ifdef ACPI_FUTURE_USAGE
965acpi_name
966acpi_ns_find_parent_name (
967 struct acpi_namespace_node *child_node)
968{
969 struct acpi_namespace_node *parent_node;
970
971
972 ACPI_FUNCTION_TRACE ("ns_find_parent_name");
973
974
975 if (child_node) {
976 /* Valid entry. Get the parent Node */
977
978 parent_node = acpi_ns_get_parent_node (child_node);
979 if (parent_node) {
980 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
981 "Parent of %p [%4.4s] is %p [%4.4s]\n",
982 child_node, acpi_ut_get_node_name (child_node),
983 parent_node, acpi_ut_get_node_name (parent_node)));
984
985 if (parent_node->name.integer) {
986 return_VALUE ((acpi_name) parent_node->name.integer);
987 }
988 }
989
990 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
991 "Unable to find parent of %p (%4.4s)\n",
992 child_node, acpi_ut_get_node_name (child_node)));
993 }
994
995 return_VALUE (ACPI_UNKNOWN_NAME);
996}
997#endif
998
999
1000/*******************************************************************************
1001 *
1002 * FUNCTION: acpi_ns_get_parent_node 976 * FUNCTION: acpi_ns_get_parent_node
1003 * 977 *
1004 * PARAMETERS: Node - Current table entry 978 * PARAMETERS: Node - Current table entry
@@ -1009,7 +983,6 @@ acpi_ns_find_parent_name (
1009 * 983 *
1010 ******************************************************************************/ 984 ******************************************************************************/
1011 985
1012
1013struct acpi_namespace_node * 986struct acpi_namespace_node *
1014acpi_ns_get_parent_node ( 987acpi_ns_get_parent_node (
1015 struct acpi_namespace_node *node) 988 struct acpi_namespace_node *node)
@@ -1030,7 +1003,6 @@ acpi_ns_get_parent_node (
1030 node = node->peer; 1003 node = node->peer;
1031 } 1004 }
1032 1005
1033
1034 return (node->peer); 1006 return (node->peer);
1035} 1007}
1036 1008
@@ -1049,7 +1021,6 @@ acpi_ns_get_parent_node (
1049 * 1021 *
1050 ******************************************************************************/ 1022 ******************************************************************************/
1051 1023
1052
1053struct acpi_namespace_node * 1024struct acpi_namespace_node *
1054acpi_ns_get_next_valid_node ( 1025acpi_ns_get_next_valid_node (
1055 struct acpi_namespace_node *node) 1026 struct acpi_namespace_node *node)
@@ -1067,3 +1038,53 @@ acpi_ns_get_next_valid_node (
1067} 1038}
1068 1039
1069 1040
1041#ifdef ACPI_OBSOLETE_FUNCTIONS
1042/*******************************************************************************
1043 *
1044 * FUNCTION: acpi_ns_find_parent_name
1045 *
1046 * PARAMETERS: *child_node - Named Obj whose name is to be found
1047 *
1048 * RETURN: The ACPI name
1049 *
1050 * DESCRIPTION: Search for the given obj in its parent scope and return the
1051 * name segment, or "????" if the parent name can't be found
1052 * (which "should not happen").
1053 *
1054 ******************************************************************************/
1055
1056acpi_name
1057acpi_ns_find_parent_name (
1058 struct acpi_namespace_node *child_node)
1059{
1060 struct acpi_namespace_node *parent_node;
1061
1062
1063 ACPI_FUNCTION_TRACE ("ns_find_parent_name");
1064
1065
1066 if (child_node) {
1067 /* Valid entry. Get the parent Node */
1068
1069 parent_node = acpi_ns_get_parent_node (child_node);
1070 if (parent_node) {
1071 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
1072 "Parent of %p [%4.4s] is %p [%4.4s]\n",
1073 child_node, acpi_ut_get_node_name (child_node),
1074 parent_node, acpi_ut_get_node_name (parent_node)));
1075
1076 if (parent_node->name.integer) {
1077 return_VALUE ((acpi_name) parent_node->name.integer);
1078 }
1079 }
1080
1081 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
1082 "Unable to find parent of %p (%4.4s)\n",
1083 child_node, acpi_ut_get_node_name (child_node)));
1084 }
1085
1086 return_VALUE (ACPI_UNKNOWN_NAME);
1087}
1088#endif
1089
1090
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c
index 4de2444df300..f9a7277dca6e 100644
--- a/drivers/acpi/namespace/nswalk.c
+++ b/drivers/acpi/namespace/nswalk.c
@@ -56,7 +56,7 @@
56 * 56 *
57 * PARAMETERS: Type - Type of node to be searched for 57 * PARAMETERS: Type - Type of node to be searched for
58 * parent_node - Parent node whose children we are 58 * parent_node - Parent node whose children we are
59 * getting 59 * getting
60 * child_node - Previous child that was found. 60 * child_node - Previous child that was found.
61 * The NEXT child will be returned 61 * The NEXT child will be returned
62 * 62 *
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c
index 1dc995586cbe..12ea202257fa 100644
--- a/drivers/acpi/namespace/nsxfeval.c
+++ b/drivers/acpi/namespace/nsxfeval.c
@@ -58,11 +58,11 @@
58 * FUNCTION: acpi_evaluate_object_typed 58 * FUNCTION: acpi_evaluate_object_typed
59 * 59 *
60 * PARAMETERS: Handle - Object handle (optional) 60 * PARAMETERS: Handle - Object handle (optional)
61 * *Pathname - Object pathname (optional) 61 * Pathname - Object pathname (optional)
62 * **external_params - List of parameters to pass to method, 62 * external_params - List of parameters to pass to method,
63 * terminated by NULL. May be NULL 63 * terminated by NULL. May be NULL
64 * if no parameters are being passed. 64 * if no parameters are being passed.
65 * *return_buffer - Where to put method's return value (if 65 * return_buffer - Where to put method's return value (if
66 * any). If NULL, no value is returned. 66 * any). If NULL, no value is returned.
67 * return_type - Expected type of return object 67 * return_type - Expected type of return object
68 * 68 *
@@ -73,6 +73,7 @@
73 * be valid (non-null) 73 * be valid (non-null)
74 * 74 *
75 ******************************************************************************/ 75 ******************************************************************************/
76
76#ifdef ACPI_FUTURE_USAGE 77#ifdef ACPI_FUTURE_USAGE
77acpi_status 78acpi_status
78acpi_evaluate_object_typed ( 79acpi_evaluate_object_typed (
@@ -307,7 +308,8 @@ acpi_evaluate_object (
307 if (ACPI_SUCCESS (status)) { 308 if (ACPI_SUCCESS (status)) {
308 /* Validate/Allocate/Clear caller buffer */ 309 /* Validate/Allocate/Clear caller buffer */
309 310
310 status = acpi_ut_initialize_buffer (return_buffer, buffer_space_needed); 311 status = acpi_ut_initialize_buffer (return_buffer,
312 buffer_space_needed);
311 if (ACPI_FAILURE (status)) { 313 if (ACPI_FAILURE (status)) {
312 /* 314 /*
313 * Caller's buffer is too small or a new one can't be allocated 315 * Caller's buffer is too small or a new one can't be allocated
@@ -423,7 +425,8 @@ acpi_walk_namespace (
423 return_ACPI_STATUS (status); 425 return_ACPI_STATUS (status);
424 } 426 }
425 427
426 status = acpi_ns_walk_namespace (type, start_object, max_depth, ACPI_NS_WALK_UNLOCK, 428 status = acpi_ns_walk_namespace (type, start_object, max_depth,
429 ACPI_NS_WALK_UNLOCK,
427 user_function, context, return_value); 430 user_function, context, return_value);
428 431
429 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); 432 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
@@ -525,7 +528,8 @@ acpi_ns_get_device_callback (
525 } 528 }
526 } 529 }
527 530
528 status = info->user_function (obj_handle, nesting_level, info->context, return_value); 531 status = info->user_function (obj_handle, nesting_level, info->context,
532 return_value);
529 return (status); 533 return (status);
530} 534}
531 535
diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c
index f2405efd1b9a..8d097914c49a 100644
--- a/drivers/acpi/namespace/nsxfname.c
+++ b/drivers/acpi/namespace/nsxfname.c
@@ -57,9 +57,9 @@
57 * FUNCTION: acpi_get_handle 57 * FUNCTION: acpi_get_handle
58 * 58 *
59 * PARAMETERS: Parent - Object to search under (search scope). 59 * PARAMETERS: Parent - Object to search under (search scope).
60 * path_name - Pointer to an asciiz string containing the 60 * Pathname - Pointer to an asciiz string containing the
61 * name 61 * name
62 * ret_handle - Where the return handle is placed 62 * ret_handle - Where the return handle is returned
63 * 63 *
64 * RETURN: Status 64 * RETURN: Status
65 * 65 *
@@ -220,7 +220,7 @@ EXPORT_SYMBOL(acpi_get_name);
220 * FUNCTION: acpi_get_object_info 220 * FUNCTION: acpi_get_object_info
221 * 221 *
222 * PARAMETERS: Handle - Object Handle 222 * PARAMETERS: Handle - Object Handle
223 * Info - Where the info is returned 223 * Buffer - Where the info is returned
224 * 224 *
225 * RETURN: Status 225 * RETURN: Status
226 * 226 *
diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c
index 19acf32674b9..363e1f6cfb18 100644
--- a/drivers/acpi/namespace/nsxfobj.c
+++ b/drivers/acpi/namespace/nsxfobj.c
@@ -56,7 +56,7 @@
56 * FUNCTION: acpi_get_type 56 * FUNCTION: acpi_get_type
57 * 57 *
58 * PARAMETERS: Handle - Handle of object whose type is desired 58 * PARAMETERS: Handle - Handle of object whose type is desired
59 * *ret_type - Where the type will be placed 59 * ret_type - Where the type will be placed
60 * 60 *
61 * RETURN: Status 61 * RETURN: Status
62 * 62 *
@@ -258,5 +258,5 @@ unlock_and_exit:
258 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); 258 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
259 return (status); 259 return (status);
260} 260}
261EXPORT_SYMBOL(acpi_get_next_object);
262 261
262EXPORT_SYMBOL(acpi_get_next_object);
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c
index b5d98895f6a8..b7ac68cc9e1c 100644
--- a/drivers/acpi/parser/psargs.c
+++ b/drivers/acpi/parser/psargs.c
@@ -50,6 +50,16 @@
50#define _COMPONENT ACPI_PARSER 50#define _COMPONENT ACPI_PARSER
51 ACPI_MODULE_NAME ("psargs") 51 ACPI_MODULE_NAME ("psargs")
52 52
53/* Local prototypes */
54
55static u32
56acpi_ps_get_next_package_length (
57 struct acpi_parse_state *parser_state);
58
59static union acpi_parse_object *
60acpi_ps_get_next_field (
61 struct acpi_parse_state *parser_state);
62
53 63
54/******************************************************************************* 64/*******************************************************************************
55 * 65 *
@@ -64,7 +74,7 @@
64 * 74 *
65 ******************************************************************************/ 75 ******************************************************************************/
66 76
67u32 77static u32
68acpi_ps_get_next_package_length ( 78acpi_ps_get_next_package_length (
69 struct acpi_parse_state *parser_state) 79 struct acpi_parse_state *parser_state)
70{ 80{
@@ -78,7 +88,6 @@ acpi_ps_get_next_package_length (
78 encoded_length = (u32) ACPI_GET8 (parser_state->aml); 88 encoded_length = (u32) ACPI_GET8 (parser_state->aml);
79 parser_state->aml++; 89 parser_state->aml++;
80 90
81
82 switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ { 91 switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ {
83 case 0: /* 1-byte encoding (bits 0-5) */ 92 case 0: /* 1-byte encoding (bits 0-5) */
84 93
@@ -287,13 +296,14 @@ acpi_ps_get_next_namepath (
287 * parent tree, but don't open a new scope -- we just want to lookup the 296 * parent tree, but don't open a new scope -- we just want to lookup the
288 * object (MUST BE mode EXECUTE to perform upsearch) 297 * object (MUST BE mode EXECUTE to perform upsearch)
289 */ 298 */
290 status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 299 status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY,
291 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &node); 300 ACPI_IMODE_EXECUTE,
301 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
302 NULL, &node);
292 if (ACPI_SUCCESS (status) && method_call) { 303 if (ACPI_SUCCESS (status) && method_call) {
293 if (node->type == ACPI_TYPE_METHOD) { 304 if (node->type == ACPI_TYPE_METHOD) {
294 /* 305 /* This name is actually a control method invocation */
295 * This name is actually a control method invocation 306
296 */
297 method_desc = acpi_ns_get_attached_object (node); 307 method_desc = acpi_ns_get_attached_object (node);
298 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, 308 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
299 "Control Method - %p Desc %p Path=%p\n", 309 "Control Method - %p Desc %p Path=%p\n",
@@ -360,7 +370,7 @@ acpi_ps_get_next_namepath (
360 /* 370 /*
361 * We got a NOT_FOUND during table load or we encountered 371 * We got a NOT_FOUND during table load or we encountered
362 * a cond_ref_of(x) where the target does not exist. 372 * a cond_ref_of(x) where the target does not exist.
363 * -- either case is ok 373 * Either case is ok
364 */ 374 */
365 status = AE_OK; 375 status = AE_OK;
366 } 376 }
@@ -486,12 +496,13 @@ acpi_ps_get_next_simple_arg (
486 * 496 *
487 ******************************************************************************/ 497 ******************************************************************************/
488 498
489union acpi_parse_object * 499static union acpi_parse_object *
490acpi_ps_get_next_field ( 500acpi_ps_get_next_field (
491 struct acpi_parse_state *parser_state) 501 struct acpi_parse_state *parser_state)
492{ 502{
493 u32 aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, 503 u32 aml_offset = (u32)
494 parser_state->aml_start); 504 ACPI_PTR_DIFF (parser_state->aml,
505 parser_state->aml_start);
495 union acpi_parse_object *field; 506 union acpi_parse_object *field;
496 u16 opcode; 507 u16 opcode;
497 u32 name; 508 u32 name;
@@ -500,7 +511,7 @@ acpi_ps_get_next_field (
500 ACPI_FUNCTION_TRACE ("ps_get_next_field"); 511 ACPI_FUNCTION_TRACE ("ps_get_next_field");
501 512
502 513
503 /* determine field type */ 514 /* Determine field type */
504 515
505 switch (ACPI_GET8 (parser_state->aml)) { 516 switch (ACPI_GET8 (parser_state->aml)) {
506 default: 517 default:
@@ -521,7 +532,6 @@ acpi_ps_get_next_field (
521 break; 532 break;
522 } 533 }
523 534
524
525 /* Allocate a new field op */ 535 /* Allocate a new field op */
526 536
527 field = acpi_ps_alloc_op (opcode); 537 field = acpi_ps_alloc_op (opcode);
@@ -582,10 +592,10 @@ acpi_ps_get_next_field (
582 * 592 *
583 * FUNCTION: acpi_ps_get_next_arg 593 * FUNCTION: acpi_ps_get_next_arg
584 * 594 *
585 * PARAMETERS: parser_state - Current parser state object 595 * PARAMETERS: walk_state - Current state
596 * parser_state - Current parser state object
586 * arg_type - The argument type (AML_*_ARG) 597 * arg_type - The argument type (AML_*_ARG)
587 * arg_count - If the argument points to a control method 598 * return_arg - Where the next arg is returned
588 * the method's argument is returned here.
589 * 599 *
590 * RETURN: Status, and an op object containing the next argument. 600 * RETURN: Status, and an op object containing the next argument.
591 * 601 *
@@ -619,7 +629,7 @@ acpi_ps_get_next_arg (
619 case ARGP_NAME: 629 case ARGP_NAME:
620 case ARGP_NAMESTRING: 630 case ARGP_NAMESTRING:
621 631
622 /* constants, strings, and namestrings are all the same size */ 632 /* Constants, strings, and namestrings are all the same size */
623 633
624 arg = acpi_ps_alloc_op (AML_BYTE_OP); 634 arg = acpi_ps_alloc_op (AML_BYTE_OP);
625 if (!arg) { 635 if (!arg) {
@@ -654,7 +664,6 @@ acpi_ps_get_next_arg (
654 else { 664 else {
655 arg = field; 665 arg = field;
656 } 666 }
657
658 prev = field; 667 prev = field;
659 } 668 }
660 669
@@ -677,8 +686,8 @@ acpi_ps_get_next_arg (
677 686
678 /* Fill in bytelist data */ 687 /* Fill in bytelist data */
679 688
680 arg->common.value.size = (u32) ACPI_PTR_DIFF (parser_state->pkg_end, 689 arg->common.value.size = (u32)
681 parser_state->aml); 690 ACPI_PTR_DIFF (parser_state->pkg_end, parser_state->aml);
682 arg->named.data = parser_state->aml; 691 arg->named.data = parser_state->aml;
683 692
684 /* Skip to End of byte data */ 693 /* Skip to End of byte data */
@@ -706,7 +715,7 @@ acpi_ps_get_next_arg (
706 status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0); 715 status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0);
707 } 716 }
708 else { 717 else {
709 /* single complex argument, nothing returned */ 718 /* Single complex argument, nothing returned */
710 719
711 walk_state->arg_count = 1; 720 walk_state->arg_count = 1;
712 } 721 }
@@ -716,7 +725,7 @@ acpi_ps_get_next_arg (
716 case ARGP_DATAOBJ: 725 case ARGP_DATAOBJ:
717 case ARGP_TERMARG: 726 case ARGP_TERMARG:
718 727
719 /* single complex argument, nothing returned */ 728 /* Single complex argument, nothing returned */
720 729
721 walk_state->arg_count = 1; 730 walk_state->arg_count = 1;
722 break; 731 break;
@@ -727,7 +736,7 @@ acpi_ps_get_next_arg (
727 case ARGP_OBJLIST: 736 case ARGP_OBJLIST:
728 737
729 if (parser_state->aml < parser_state->pkg_end) { 738 if (parser_state->aml < parser_state->pkg_end) {
730 /* non-empty list of variable arguments, nothing returned */ 739 /* Non-empty list of variable arguments, nothing returned */
731 740
732 walk_state->arg_count = ACPI_VAR_ARGS; 741 walk_state->arg_count = ACPI_VAR_ARGS;
733 } 742 }
diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c
index 03e33fedc11a..5744673568c0 100644
--- a/drivers/acpi/parser/psopcode.c
+++ b/drivers/acpi/parser/psopcode.c
@@ -44,6 +44,7 @@
44 44
45#include <acpi/acpi.h> 45#include <acpi/acpi.h>
46#include <acpi/acparser.h> 46#include <acpi/acparser.h>
47#include <acpi/acopcode.h>
47#include <acpi/amlcode.h> 48#include <acpi/amlcode.h>
48 49
49 50
@@ -51,23 +52,6 @@
51 ACPI_MODULE_NAME ("psopcode") 52 ACPI_MODULE_NAME ("psopcode")
52 53
53 54
54#define _UNK 0x6B
55/*
56 * Reserved ASCII characters. Do not use any of these for
57 * internal opcodes, since they are used to differentiate
58 * name strings from AML opcodes
59 */
60#define _ASC 0x6C
61#define _NAM 0x6C
62#define _PFX 0x6D
63#define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */
64
65#define MAX_EXTENDED_OPCODE 0x88
66#define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1)
67#define MAX_INTERNAL_OPCODE
68#define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1)
69
70
71/******************************************************************************* 55/*******************************************************************************
72 * 56 *
73 * NAME: acpi_gbl_aml_op_info 57 * NAME: acpi_gbl_aml_op_info
@@ -79,274 +63,9 @@
79 * 63 *
80 ******************************************************************************/ 64 ******************************************************************************/
81 65
82
83/*
84 * All AML opcodes and the parse-time arguments for each. Used by the AML parser Each list is compressed
85 * into a 32-bit number and stored in the master opcode table at the end of this file.
86 */
87
88
89#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
90#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA)
91#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
92#define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME)
93#define ARGP_ARG0 ARG_NONE
94#define ARGP_ARG1 ARG_NONE
95#define ARGP_ARG2 ARG_NONE
96#define ARGP_ARG3 ARG_NONE
97#define ARGP_ARG4 ARG_NONE
98#define ARGP_ARG5 ARG_NONE
99#define ARGP_ARG6 ARG_NONE
100#define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST)
101#define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
102#define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
103#define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
104#define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
105#define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
106#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
107#define ARGP_BREAK_OP ARG_NONE
108#define ARGP_BREAK_POINT_OP ARG_NONE
109#define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST)
110#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA)
111#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING)
112#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
113#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
114#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
115#define ARGP_CONTINUE_OP ARG_NONE
116#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME)
117#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
118#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
119#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
120#define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
121#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
122#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
123#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
124#define ARGP_DEBUG_OP ARG_NONE
125#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
126#define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG)
127#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
128#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET)
129#define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA)
130#define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST)
131#define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME)
132#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG)
133#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST)
134#define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
135#define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
136#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
137#define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
138#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
139#define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST)
140#define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
141#define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
142#define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
143#define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
144#define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
145#define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
146#define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
147#define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG)
148#define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
149#define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME)
150#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
151#define ARGP_LOCAL0 ARG_NONE
152#define ARGP_LOCAL1 ARG_NONE
153#define ARGP_LOCAL2 ARG_NONE
154#define ARGP_LOCAL3 ARG_NONE
155#define ARGP_LOCAL4 ARG_NONE
156#define ARGP_LOCAL5 ARG_NONE
157#define ARGP_LOCAL6 ARG_NONE
158#define ARGP_LOCAL7 ARG_NONE
159#define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
160#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
161#define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST)
162#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING)
163#define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
164#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
165#define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
166#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA)
167#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ)
168#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
169#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING)
170#define ARGP_NOOP_OP ARG_NONE
171#define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
172#define ARGP_ONE_OP ARG_NONE
173#define ARGP_ONES_OP ARG_NONE
174#define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST)
175#define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST)
176#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST)
177#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA)
178#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
179#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
180#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME)
181#define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
182#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME)
183#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
184#define ARGP_REVISION_OP ARG_NONE
185#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST)
186#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
187#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
188#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
189#define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
190#define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG)
191#define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG)
192#define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING)
193#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME)
194#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST)
195#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
196#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
197#define ARGP_TIMER_OP ARG_NONE
198#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
199#define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
200#define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
201#define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
202#define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
203#define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
204#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME)
205#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME)
206#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST)
207#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
208#define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
209#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA)
210#define ARGP_ZERO_OP ARG_NONE
211
212
213/*
214 * All AML opcodes and the runtime arguments for each. Used by the AML interpreter Each list is compressed
215 * into a 32-bit number and stored in the master opcode table at the end of this file.
216 *
217 * (Used by prep_operands procedure and the ASL Compiler)
218 */
219
220
221#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE
222#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER)
223#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
224#define ARGI_ALIAS_OP ARGI_INVALID_OPCODE
225#define ARGI_ARG0 ARG_NONE
226#define ARGI_ARG1 ARG_NONE
227#define ARGI_ARG2 ARG_NONE
228#define ARGI_ARG3 ARG_NONE
229#define ARGI_ARG4 ARG_NONE
230#define ARGI_ARG5 ARG_NONE
231#define ARGI_ARG6 ARG_NONE
232#define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE
233#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
234#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
235#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
236#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
237#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
238#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
239#define ARGI_BREAK_OP ARG_NONE
240#define ARGI_BREAK_POINT_OP ARG_NONE
241#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER)
242#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
243#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
244#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
245#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
246#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
247#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE
248#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET)
249#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
250#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
251#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
252#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE)
253#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
254#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
255#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
256#define ARGI_DEBUG_OP ARG_NONE
257#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
258#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING)
259#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE
260#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF)
261#define ARGI_DWORD_OP ARGI_INVALID_OPCODE
262#define ARGI_ELSE_OP ARGI_INVALID_OPCODE
263#define ARGI_EVENT_OP ARGI_INVALID_OPCODE
264#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
265#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
266#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
267#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
268#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
269#define ARGI_IF_OP ARGI_INVALID_OPCODE
270#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
271#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
272#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF)
273#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
274#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
275#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
276#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE
277#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
278#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE
279#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
280#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
281#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_FIELD,ARGI_TARGETREF)
282#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)
283#define ARGI_LOCAL0 ARG_NONE
284#define ARGI_LOCAL1 ARG_NONE
285#define ARGI_LOCAL2 ARG_NONE
286#define ARGI_LOCAL3 ARG_NONE
287#define ARGI_LOCAL4 ARG_NONE
288#define ARGI_LOCAL5 ARG_NONE
289#define ARGI_LOCAL6 ARG_NONE
290#define ARGI_LOCAL7 ARG_NONE
291#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
292#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_COMPUTEDATA, ARGI_INTEGER,ARGI_COMPUTEDATA,ARGI_INTEGER)
293#define ARGI_METHOD_OP ARGI_INVALID_OPCODE
294#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE
295#define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
296#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
297#define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
298#define ARGI_MUTEX_OP ARGI_INVALID_OPCODE
299#define ARGI_NAME_OP ARGI_INVALID_OPCODE
300#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE
301#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE
302#define ARGI_NOOP_OP ARG_NONE
303#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER)
304#define ARGI_ONE_OP ARG_NONE
305#define ARGI_ONES_OP ARG_NONE
306#define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
307#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE
308#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE
309#define ARGI_QWORD_OP ARGI_INVALID_OPCODE
310#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF)
311#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
312#define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX)
313#define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE
314#define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT)
315#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
316#define ARGI_REVISION_OP ARG_NONE
317#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE
318#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
319#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
320#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT)
321#define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT)
322#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER)
323#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER)
324#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE
325#define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_TARGETREF)
326#define ARGI_STRING_OP ARGI_INVALID_OPCODE
327#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
328#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE
329#define ARGI_TIMER_OP ARG_NONE
330#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
331#define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
332#define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
333#define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
334#define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
335#define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET)
336#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE)
337#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE)
338#define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
339#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER)
340#define ARGI_WHILE_OP ARGI_INVALID_OPCODE
341#define ARGI_WORD_OP ARGI_INVALID_OPCODE
342#define ARGI_ZERO_OP ARG_NONE
343
344
345/* 66/*
346 * Summary of opcode types/flags 67 * Summary of opcode types/flags
347 */ 68 *
348
349/******************************************************************************
350 69
351 Opcodes that have associated namespace objects (AML_NSOBJECT flag) 70 Opcodes that have associated namespace objects (AML_NSOBJECT flag)
352 71
@@ -460,14 +179,13 @@
460 AML_CREATE_DWORD_FIELD_OP 179 AML_CREATE_DWORD_FIELD_OP
461 AML_CREATE_QWORD_FIELD_OP 180 AML_CREATE_QWORD_FIELD_OP
462 181
463******************************************************************************/ 182 ******************************************************************************/
464 183
465 184
466/* 185/*
467 * Master Opcode information table. A summary of everything we know about each opcode, all in one place. 186 * Master Opcode information table. A summary of everything we know about each
187 * opcode, all in one place.
468 */ 188 */
469
470
471const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = 189const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
472{ 190{
473/*! [Begin] no source code translation */ 191/*! [Begin] no source code translation */
@@ -693,8 +411,7 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] =
693 * 411 *
694 * PARAMETERS: Opcode - The AML opcode 412 * PARAMETERS: Opcode - The AML opcode
695 * 413 *
696 * RETURN: A pointer to the info about the opcode. NULL if the opcode was 414 * RETURN: A pointer to the info about the opcode.
697 * not found in the table.
698 * 415 *
699 * DESCRIPTION: Find AML opcode description based on the opcode. 416 * DESCRIPTION: Find AML opcode description based on the opcode.
700 * NOTE: This procedure must ALWAYS return a valid pointer! 417 * NOTE: This procedure must ALWAYS return a valid pointer!
@@ -731,7 +448,8 @@ acpi_ps_get_opcode_info (
731 448
732 default: 449 default:
733 450
734 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode [%4.4X]\n", opcode)); 451 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
452 "Unknown AML opcode [%4.4X]\n", opcode));
735 break; 453 break;
736 } 454 }
737 455
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c
index e79edb53cb3b..bbfdc1a58c27 100644
--- a/drivers/acpi/parser/psparse.c
+++ b/drivers/acpi/parser/psparse.c
@@ -64,6 +64,23 @@
64 64
65static u32 acpi_gbl_depth = 0; 65static u32 acpi_gbl_depth = 0;
66 66
67/* Local prototypes */
68
69static void
70acpi_ps_complete_this_op (
71 struct acpi_walk_state *walk_state,
72 union acpi_parse_object *op);
73
74static acpi_status
75acpi_ps_next_parse_state (
76 struct acpi_walk_state *walk_state,
77 union acpi_parse_object *op,
78 acpi_status callback_status);
79
80static acpi_status
81acpi_ps_parse_loop (
82 struct acpi_walk_state *walk_state);
83
67 84
68/******************************************************************************* 85/*******************************************************************************
69 * 86 *
@@ -100,7 +117,7 @@ acpi_ps_get_opcode_size (
100 * 117 *
101 * PARAMETERS: parser_state - A parser state object 118 * PARAMETERS: parser_state - A parser state object
102 * 119 *
103 * RETURN: Status 120 * RETURN: Next AML opcode
104 * 121 *
105 * DESCRIPTION: Get next AML opcode (without incrementing AML pointer) 122 * DESCRIPTION: Get next AML opcode (without incrementing AML pointer)
106 * 123 *
@@ -117,7 +134,6 @@ acpi_ps_peek_opcode (
117 aml = parser_state->aml; 134 aml = parser_state->aml;
118 opcode = (u16) ACPI_GET8 (aml); 135 opcode = (u16) ACPI_GET8 (aml);
119 136
120
121 if (opcode == AML_EXTOP) { 137 if (opcode == AML_EXTOP) {
122 /* Extended opcode */ 138 /* Extended opcode */
123 139
@@ -142,7 +158,7 @@ acpi_ps_peek_opcode (
142 * 158 *
143 ******************************************************************************/ 159 ******************************************************************************/
144 160
145void 161static void
146acpi_ps_complete_this_op ( 162acpi_ps_complete_this_op (
147 struct acpi_walk_state *walk_state, 163 struct acpi_walk_state *walk_state,
148 union acpi_parse_object *op) 164 union acpi_parse_object *op)
@@ -272,7 +288,6 @@ acpi_ps_complete_this_op (
272 next = NULL; 288 next = NULL;
273 } 289 }
274 } 290 }
275
276 prev = next; 291 prev = next;
277 } 292 }
278 } 293 }
@@ -280,7 +295,7 @@ acpi_ps_complete_this_op (
280 295
281cleanup: 296cleanup:
282 297
283 /* Now we can actually delete the subtree rooted at op */ 298 /* Now we can actually delete the subtree rooted at Op */
284 299
285 acpi_ps_delete_parse_tree (op); 300 acpi_ps_delete_parse_tree (op);
286 return_VOID; 301 return_VOID;
@@ -291,7 +306,9 @@ cleanup:
291 * 306 *
292 * FUNCTION: acpi_ps_next_parse_state 307 * FUNCTION: acpi_ps_next_parse_state
293 * 308 *
294 * PARAMETERS: parser_state - Current parser state object 309 * PARAMETERS: walk_state - Current state
310 * Op - Current parse op
311 * callback_status - Status from previous operation
295 * 312 *
296 * RETURN: Status 313 * RETURN: Status
297 * 314 *
@@ -300,7 +317,7 @@ cleanup:
300 * 317 *
301 ******************************************************************************/ 318 ******************************************************************************/
302 319
303acpi_status 320static acpi_status
304acpi_ps_next_parse_state ( 321acpi_ps_next_parse_state (
305 struct acpi_walk_state *walk_state, 322 struct acpi_walk_state *walk_state,
306 union acpi_parse_object *op, 323 union acpi_parse_object *op,
@@ -382,9 +399,8 @@ acpi_ps_next_parse_state (
382 399
383 case AE_CTRL_TRANSFER: 400 case AE_CTRL_TRANSFER:
384 401
385 /* 402 /* A method call (invocation) -- transfer control */
386 * A method call (invocation) -- transfer control 403
387 */
388 status = AE_CTRL_TRANSFER; 404 status = AE_CTRL_TRANSFER;
389 walk_state->prev_op = op; 405 walk_state->prev_op = op;
390 walk_state->method_call_op = op; 406 walk_state->method_call_op = op;
@@ -397,6 +413,7 @@ acpi_ps_next_parse_state (
397 413
398 414
399 default: 415 default:
416
400 status = callback_status; 417 status = callback_status;
401 if ((callback_status & AE_CODE_MASK) == AE_CODE_CONTROL) { 418 if ((callback_status & AE_CODE_MASK) == AE_CODE_CONTROL) {
402 status = AE_OK; 419 status = AE_OK;
@@ -412,7 +429,7 @@ acpi_ps_next_parse_state (
412 * 429 *
413 * FUNCTION: acpi_ps_parse_loop 430 * FUNCTION: acpi_ps_parse_loop
414 * 431 *
415 * PARAMETERS: parser_state - Current parser state object 432 * PARAMETERS: walk_state - Current state
416 * 433 *
417 * RETURN: Status 434 * RETURN: Status
418 * 435 *
@@ -421,7 +438,7 @@ acpi_ps_next_parse_state (
421 * 438 *
422 ******************************************************************************/ 439 ******************************************************************************/
423 440
424acpi_status 441static acpi_status
425acpi_ps_parse_loop ( 442acpi_ps_parse_loop (
426 struct acpi_walk_state *walk_state) 443 struct acpi_walk_state *walk_state)
427{ 444{
@@ -443,6 +460,7 @@ acpi_ps_parse_loop (
443 walk_state->arg_types = 0; 460 walk_state->arg_types = 0;
444 461
445#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) 462#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
463
446 if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { 464 if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
447 /* We are restarting a preempted control method */ 465 /* We are restarting a preempted control method */
448 466
@@ -471,7 +489,8 @@ acpi_ps_parse_loop (
471 acpi_format_exception (status))); 489 acpi_format_exception (status)));
472 490
473 } 491 }
474 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "get_predicate Failed, %s\n", 492 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
493 "get_predicate Failed, %s\n",
475 acpi_format_exception (status))); 494 acpi_format_exception (status)));
476 return_ACPI_STATUS (status); 495 return_ACPI_STATUS (status);
477 } 496 }
@@ -492,16 +511,15 @@ acpi_ps_parse_loop (
492 } 511 }
493#endif 512#endif
494 513
495 /* 514 /* Iterative parsing loop, while there is more AML to process: */
496 * Iterative parsing loop, while there is more aml to process: 515
497 */
498 while ((parser_state->aml < parser_state->aml_end) || (op)) { 516 while ((parser_state->aml < parser_state->aml_end) || (op)) {
499 aml_op_start = parser_state->aml; 517 aml_op_start = parser_state->aml;
500 if (!op) { 518 if (!op) {
501 /* Get the next opcode from the AML stream */ 519 /* Get the next opcode from the AML stream */
502 520
503 walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, 521 walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml,
504 parser_state->aml_start); 522 parser_state->aml_start);
505 walk_state->opcode = acpi_ps_peek_opcode (parser_state); 523 walk_state->opcode = acpi_ps_peek_opcode (parser_state);
506 524
507 /* 525 /*
@@ -578,8 +596,10 @@ acpi_ps_parse_loop (
578 INCREMENT_ARG_LIST (walk_state->arg_types); 596 INCREMENT_ARG_LIST (walk_state->arg_types);
579 } 597 }
580 598
581 /* Make sure that we found a NAME and didn't run out of arguments */ 599 /*
582 600 * Make sure that we found a NAME and didn't run out of
601 * arguments
602 */
583 if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) { 603 if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) {
584 status = AE_AML_NO_OPERAND; 604 status = AE_AML_NO_OPERAND;
585 goto close_this_op; 605 goto close_this_op;
@@ -597,12 +617,13 @@ acpi_ps_parse_loop (
597 617
598 status = walk_state->descending_callback (walk_state, &op); 618 status = walk_state->descending_callback (walk_state, &op);
599 if (ACPI_FAILURE (status)) { 619 if (ACPI_FAILURE (status)) {
600 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n", 620 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
601 acpi_format_exception (status))); 621 "During name lookup/catalog, %s\n",
622 acpi_format_exception (status)));
602 goto close_this_op; 623 goto close_this_op;
603 } 624 }
604 625
605 if (op == NULL) { 626 if (!op) {
606 continue; 627 continue;
607 } 628 }
608 629
@@ -659,7 +680,7 @@ acpi_ps_parse_loop (
659 680
660 if ((walk_state->descending_callback != NULL)) { 681 if ((walk_state->descending_callback != NULL)) {
661 /* 682 /*
662 * Find the object. This will either insert the object into 683 * Find the object. This will either insert the object into
663 * the namespace or simply look it up 684 * the namespace or simply look it up
664 */ 685 */
665 walk_state->op = op; 686 walk_state->op = op;
@@ -688,11 +709,15 @@ acpi_ps_parse_loop (
688 } 709 }
689 710
690 711
691 /* Start arg_count at zero because we don't know if there are any args yet */ 712 /*
692 713 * Start arg_count at zero because we don't know if there are
714 * any args yet
715 */
693 walk_state->arg_count = 0; 716 walk_state->arg_count = 0;
694 717
695 if (walk_state->arg_types) /* Are there any arguments that must be processed? */ { 718 /* Are there any arguments that must be processed? */
719
720 if (walk_state->arg_types) {
696 /* Get arguments */ 721 /* Get arguments */
697 722
698 switch (op->common.aml_opcode) { 723 switch (op->common.aml_opcode) {
@@ -720,14 +745,18 @@ acpi_ps_parse_loop (
720 745
721 default: 746 default:
722 747
723 /* Op is not a constant or string, append each argument to the Op */ 748 /*
724 749 * Op is not a constant or string, append each argument
750 * to the Op
751 */
725 while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && 752 while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
726 !walk_state->arg_count) { 753 !walk_state->arg_count) {
727 walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, 754 walk_state->aml_offset = (u32)
728 parser_state->aml_start); 755 ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start);
756
729 status = acpi_ps_get_next_arg (walk_state, parser_state, 757 status = acpi_ps_get_next_arg (walk_state, parser_state,
730 GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg); 758 GET_CURRENT_ARG_TYPE (walk_state->arg_types),
759 &arg);
731 if (ACPI_FAILURE (status)) { 760 if (ACPI_FAILURE (status)) {
732 goto close_this_op; 761 goto close_this_op;
733 } 762 }
@@ -752,7 +781,8 @@ acpi_ps_parse_loop (
752 * Save the length and address of the body 781 * Save the length and address of the body
753 */ 782 */
754 op->named.data = parser_state->aml; 783 op->named.data = parser_state->aml;
755 op->named.length = (u32) (parser_state->pkg_end - parser_state->aml); 784 op->named.length = (u32) (parser_state->pkg_end -
785 parser_state->aml);
756 786
757 /* Skip body of method */ 787 /* Skip body of method */
758 788
@@ -773,7 +803,8 @@ acpi_ps_parse_loop (
773 * to parse them correctly. 803 * to parse them correctly.
774 */ 804 */
775 op->named.data = aml_op_start; 805 op->named.data = aml_op_start;
776 op->named.length = (u32) (parser_state->pkg_end - aml_op_start); 806 op->named.length = (u32) (parser_state->pkg_end -
807 aml_op_start);
777 808
778 /* Skip body */ 809 /* Skip body */
779 810
@@ -785,7 +816,8 @@ acpi_ps_parse_loop (
785 case AML_WHILE_OP: 816 case AML_WHILE_OP:
786 817
787 if (walk_state->control_state) { 818 if (walk_state->control_state) {
788 walk_state->control_state->control.package_end = parser_state->pkg_end; 819 walk_state->control_state->control.package_end =
820 parser_state->pkg_end;
789 } 821 }
790 break; 822 break;
791 823
@@ -801,8 +833,10 @@ acpi_ps_parse_loop (
801 /* Check for arguments that need to be processed */ 833 /* Check for arguments that need to be processed */
802 834
803 if (walk_state->arg_count) { 835 if (walk_state->arg_count) {
804 /* There are arguments (complex ones), push Op and prepare for argument */ 836 /*
805 837 * There are arguments (complex ones), push Op and
838 * prepare for argument
839 */
806 status = acpi_ps_push_scope (parser_state, op, 840 status = acpi_ps_push_scope (parser_state, op,
807 walk_state->arg_types, walk_state->arg_count); 841 walk_state->arg_types, walk_state->arg_count);
808 if (ACPI_FAILURE (status)) { 842 if (ACPI_FAILURE (status)) {
@@ -812,8 +846,10 @@ acpi_ps_parse_loop (
812 continue; 846 continue;
813 } 847 }
814 848
815 /* All arguments have been processed -- Op is complete, prepare for next */ 849 /*
816 850 * All arguments have been processed -- Op is complete,
851 * prepare for next
852 */
817 walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); 853 walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
818 if (walk_state->op_info->flags & AML_NAMED) { 854 if (walk_state->op_info->flags & AML_NAMED) {
819 if (acpi_gbl_depth) { 855 if (acpi_gbl_depth) {
@@ -880,9 +916,8 @@ close_this_op:
880 916
881 case AE_CTRL_TRANSFER: 917 case AE_CTRL_TRANSFER:
882 918
883 /* 919 /* We are about to transfer to a called method. */
884 * We are about to transfer to a called method. 920
885 */
886 walk_state->prev_op = op; 921 walk_state->prev_op = op;
887 walk_state->prev_arg_types = walk_state->arg_types; 922 walk_state->prev_arg_types = walk_state->arg_types;
888 return_ACPI_STATUS (status); 923 return_ACPI_STATUS (status);
@@ -1051,10 +1086,7 @@ close_this_op:
1051 * 1086 *
1052 * FUNCTION: acpi_ps_parse_aml 1087 * FUNCTION: acpi_ps_parse_aml
1053 * 1088 *
1054 * PARAMETERS: start_scope - The starting point of the parse. Becomes the 1089 * PARAMETERS: walk_state - Current state
1055 * root of the parsed op tree.
1056 * Aml - Pointer to the raw AML code to parse
1057 * aml_size - Length of the AML to parse
1058 * 1090 *
1059 * 1091 *
1060 * RETURN: Status 1092 * RETURN: Status
@@ -1076,8 +1108,10 @@ acpi_ps_parse_aml (
1076 1108
1077 ACPI_FUNCTION_TRACE ("ps_parse_aml"); 1109 ACPI_FUNCTION_TRACE ("ps_parse_aml");
1078 1110
1079 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with walk_state=%p Aml=%p size=%X\n", 1111 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
1080 walk_state, walk_state->parser_state.aml, walk_state->parser_state.aml_size)); 1112 "Entered with walk_state=%p Aml=%p size=%X\n",
1113 walk_state, walk_state->parser_state.aml,
1114 walk_state->parser_state.aml_size));
1081 1115
1082 1116
1083 /* Create and initialize a new thread state */ 1117 /* Create and initialize a new thread state */
@@ -1142,9 +1176,10 @@ acpi_ps_parse_aml (
1142 if ((status == AE_ALREADY_EXISTS) && 1176 if ((status == AE_ALREADY_EXISTS) &&
1143 (!walk_state->method_desc->method.semaphore)) { 1177 (!walk_state->method_desc->method.semaphore)) {
1144 /* 1178 /*
1145 * This method is marked not_serialized, but it tried to create a named 1179 * This method is marked not_serialized, but it tried to create
1146 * object, causing the second thread entrance to fail. We will workaround 1180 * a named object, causing the second thread entrance to fail.
1147 * this by marking the method permanently as Serialized. 1181 * We will workaround this by marking the method permanently
1182 * as Serialized.
1148 */ 1183 */
1149 walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED; 1184 walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED;
1150 walk_state->method_desc->method.concurrency = 1; 1185 walk_state->method_desc->method.concurrency = 1;
@@ -1187,7 +1222,8 @@ acpi_ps_parse_aml (
1187 1222
1188 previous_walk_state = walk_state; 1223 previous_walk_state = walk_state;
1189 1224
1190 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "return_value=%p, implicit_value=%p State=%p\n", 1225 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
1226 "return_value=%p, implicit_value=%p State=%p\n",
1191 walk_state->return_desc, walk_state->implicit_return_obj, walk_state)); 1227 walk_state->return_desc, walk_state->implicit_return_obj, walk_state));
1192 1228
1193 /* Check if we have restarted a preempted walk */ 1229 /* Check if we have restarted a preempted walk */
@@ -1231,12 +1267,14 @@ acpi_ps_parse_aml (
1231 */ 1267 */
1232 else if (previous_walk_state->caller_return_desc) { 1268 else if (previous_walk_state->caller_return_desc) {
1233 if (previous_walk_state->implicit_return_obj) { 1269 if (previous_walk_state->implicit_return_obj) {
1234 *(previous_walk_state->caller_return_desc) = previous_walk_state->implicit_return_obj; 1270 *(previous_walk_state->caller_return_desc) =
1271 previous_walk_state->implicit_return_obj;
1235 } 1272 }
1236 else { 1273 else {
1237 /* NULL if no return value */ 1274 /* NULL if no return value */
1238 1275
1239 *(previous_walk_state->caller_return_desc) = previous_walk_state->return_desc; 1276 *(previous_walk_state->caller_return_desc) =
1277 previous_walk_state->return_desc;
1240 } 1278 }
1241 } 1279 }
1242 else { 1280 else {
diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c
index dcbed49608b0..8dcd1b1e7131 100644
--- a/drivers/acpi/parser/psscope.c
+++ b/drivers/acpi/parser/psscope.c
@@ -65,6 +65,7 @@ union acpi_parse_object *
65acpi_ps_get_parent_scope ( 65acpi_ps_get_parent_scope (
66 struct acpi_parse_state *parser_state) 66 struct acpi_parse_state *parser_state)
67{ 67{
68
68 return (parser_state->scope->parse_scope.op); 69 return (parser_state->scope->parse_scope.op);
69} 70}
70 71
@@ -87,8 +88,10 @@ u8
87acpi_ps_has_completed_scope ( 88acpi_ps_has_completed_scope (
88 struct acpi_parse_state *parser_state) 89 struct acpi_parse_state *parser_state)
89{ 90{
90 return ((u8) ((parser_state->aml >= parser_state->scope->parse_scope.arg_end || 91
91 !parser_state->scope->parse_scope.arg_count))); 92 return ((u8)
93 ((parser_state->aml >= parser_state->scope->parse_scope.arg_end ||
94 !parser_state->scope->parse_scope.arg_count)));
92} 95}
93 96
94 97
@@ -167,23 +170,23 @@ acpi_ps_push_scope (
167 return_ACPI_STATUS (AE_NO_MEMORY); 170 return_ACPI_STATUS (AE_NO_MEMORY);
168 } 171 }
169 172
170 scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE; 173 scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE;
171 scope->parse_scope.op = op; 174 scope->parse_scope.op = op;
172 scope->parse_scope.arg_list = remaining_args; 175 scope->parse_scope.arg_list = remaining_args;
173 scope->parse_scope.arg_count = arg_count; 176 scope->parse_scope.arg_count = arg_count;
174 scope->parse_scope.pkg_end = parser_state->pkg_end; 177 scope->parse_scope.pkg_end = parser_state->pkg_end;
175 178
176 /* Push onto scope stack */ 179 /* Push onto scope stack */
177 180
178 acpi_ut_push_generic_state (&parser_state->scope, scope); 181 acpi_ut_push_generic_state (&parser_state->scope, scope);
179 182
180 if (arg_count == ACPI_VAR_ARGS) { 183 if (arg_count == ACPI_VAR_ARGS) {
181 /* multiple arguments */ 184 /* Multiple arguments */
182 185
183 scope->parse_scope.arg_end = parser_state->pkg_end; 186 scope->parse_scope.arg_end = parser_state->pkg_end;
184 } 187 }
185 else { 188 else {
186 /* single argument */ 189 /* Single argument */
187 190
188 scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR); 191 scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR);
189 } 192 }
@@ -221,18 +224,17 @@ acpi_ps_pop_scope (
221 ACPI_FUNCTION_TRACE ("ps_pop_scope"); 224 ACPI_FUNCTION_TRACE ("ps_pop_scope");
222 225
223 226
224 /* 227 /* Only pop the scope if there is in fact a next scope */
225 * Only pop the scope if there is in fact a next scope 228
226 */
227 if (scope->common.next) { 229 if (scope->common.next) {
228 scope = acpi_ut_pop_generic_state (&parser_state->scope); 230 scope = acpi_ut_pop_generic_state (&parser_state->scope);
229 231
230 /* return to parsing previous op */ 232 /* return to parsing previous op */
231 233
232 *op = scope->parse_scope.op; 234 *op = scope->parse_scope.op;
233 *arg_list = scope->parse_scope.arg_list; 235 *arg_list = scope->parse_scope.arg_list;
234 *arg_count = scope->parse_scope.arg_count; 236 *arg_count = scope->parse_scope.arg_count;
235 parser_state->pkg_end = scope->parse_scope.pkg_end; 237 parser_state->pkg_end = scope->parse_scope.pkg_end;
236 238
237 /* All done with this scope state structure */ 239 /* All done with this scope state structure */
238 240
@@ -241,12 +243,13 @@ acpi_ps_pop_scope (
241 else { 243 else {
242 /* empty parse stack, prepare to fetch next opcode */ 244 /* empty parse stack, prepare to fetch next opcode */
243 245
244 *op = NULL; 246 *op = NULL;
245 *arg_list = 0; 247 *arg_list = 0;
246 *arg_count = 0; 248 *arg_count = 0;
247 } 249 }
248 250
249 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped Op %p Args %X\n", *op, *arg_count)); 251 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
252 "Popped Op %p Args %X\n", *op, *arg_count));
250 return_VOID; 253 return_VOID;
251} 254}
252 255
@@ -257,7 +260,7 @@ acpi_ps_pop_scope (
257 * 260 *
258 * PARAMETERS: parser_state - Current parser state object 261 * PARAMETERS: parser_state - Current parser state object
259 * 262 *
260 * RETURN: Status 263 * RETURN: None
261 * 264 *
262 * DESCRIPTION: Destroy available list, remaining stack levels, and return 265 * DESCRIPTION: Destroy available list, remaining stack levels, and return
263 * root scope 266 * root scope
diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c
index 2140bd1ac10b..d5aafe73fca0 100644
--- a/drivers/acpi/parser/pstree.c
+++ b/drivers/acpi/parser/pstree.c
@@ -49,6 +49,14 @@
49#define _COMPONENT ACPI_PARSER 49#define _COMPONENT ACPI_PARSER
50 ACPI_MODULE_NAME ("pstree") 50 ACPI_MODULE_NAME ("pstree")
51 51
52/* Local prototypes */
53
54#ifdef ACPI_OBSOLETE_FUNCTIONS
55union acpi_parse_object *
56acpi_ps_get_child (
57 union acpi_parse_object *op);
58#endif
59
52 60
53/******************************************************************************* 61/*******************************************************************************
54 * 62 *
@@ -57,7 +65,7 @@
57 * PARAMETERS: Op - Get an argument for this op 65 * PARAMETERS: Op - Get an argument for this op
58 * Argn - Nth argument to get 66 * Argn - Nth argument to get
59 * 67 *
60 * RETURN: The argument (as an Op object). NULL if argument does not exist 68 * RETURN: The argument (as an Op object). NULL if argument does not exist
61 * 69 *
62 * DESCRIPTION: Get the specified op's argument. 70 * DESCRIPTION: Get the specified op's argument.
63 * 71 *
@@ -152,7 +160,6 @@ acpi_ps_append_arg (
152 return; 160 return;
153 } 161 }
154 162
155
156 /* Append the argument to the linked argument list */ 163 /* Append the argument to the linked argument list */
157 164
158 if (op->common.value.arg) { 165 if (op->common.value.arg) {
@@ -164,14 +171,12 @@ acpi_ps_append_arg (
164 } 171 }
165 prev_arg->common.next = arg; 172 prev_arg->common.next = arg;
166 } 173 }
167
168 else { 174 else {
169 /* No argument list, this will be the first argument */ 175 /* No argument list, this will be the first argument */
170 176
171 op->common.value.arg = arg; 177 op->common.value.arg = arg;
172 } 178 }
173 179
174
175 /* Set the parent in this arg and any args linked after it */ 180 /* Set the parent in this arg and any args linked after it */
176 181
177 while (arg) { 182 while (arg) {
@@ -182,73 +187,6 @@ acpi_ps_append_arg (
182 187
183 188
184#ifdef ACPI_FUTURE_USAGE 189#ifdef ACPI_FUTURE_USAGE
185
186/*******************************************************************************
187 *
188 * FUNCTION: acpi_ps_get_child
189 *
190 * PARAMETERS: Op - Get the child of this Op
191 *
192 * RETURN: Child Op, Null if none is found.
193 *
194 * DESCRIPTION: Get op's children or NULL if none
195 *
196 ******************************************************************************/
197union acpi_parse_object *
198acpi_ps_get_child (
199 union acpi_parse_object *op)
200{
201 union acpi_parse_object *child = NULL;
202
203
204 ACPI_FUNCTION_ENTRY ();
205
206
207 switch (op->common.aml_opcode) {
208 case AML_SCOPE_OP:
209 case AML_ELSE_OP:
210 case AML_DEVICE_OP:
211 case AML_THERMAL_ZONE_OP:
212 case AML_INT_METHODCALL_OP:
213
214 child = acpi_ps_get_arg (op, 0);
215 break;
216
217
218 case AML_BUFFER_OP:
219 case AML_PACKAGE_OP:
220 case AML_METHOD_OP:
221 case AML_IF_OP:
222 case AML_WHILE_OP:
223 case AML_FIELD_OP:
224
225 child = acpi_ps_get_arg (op, 1);
226 break;
227
228
229 case AML_POWER_RES_OP:
230 case AML_INDEX_FIELD_OP:
231
232 child = acpi_ps_get_arg (op, 2);
233 break;
234
235
236 case AML_PROCESSOR_OP:
237 case AML_BANK_FIELD_OP:
238
239 child = acpi_ps_get_arg (op, 3);
240 break;
241
242
243 default:
244 /* All others have no children */
245 break;
246 }
247
248 return (child);
249}
250
251
252/******************************************************************************* 190/*******************************************************************************
253 * 191 *
254 * FUNCTION: acpi_ps_get_depth_next 192 * FUNCTION: acpi_ps_get_depth_next
@@ -280,21 +218,21 @@ acpi_ps_get_depth_next (
280 return (NULL); 218 return (NULL);
281 } 219 }
282 220
283 /* look for an argument or child */ 221 /* Look for an argument or child */
284 222
285 next = acpi_ps_get_arg (op, 0); 223 next = acpi_ps_get_arg (op, 0);
286 if (next) { 224 if (next) {
287 return (next); 225 return (next);
288 } 226 }
289 227
290 /* look for a sibling */ 228 /* Look for a sibling */
291 229
292 next = op->common.next; 230 next = op->common.next;
293 if (next) { 231 if (next) {
294 return (next); 232 return (next);
295 } 233 }
296 234
297 /* look for a sibling of parent */ 235 /* Look for a sibling of parent */
298 236
299 parent = op->common.parent; 237 parent = op->common.parent;
300 238
@@ -305,13 +243,13 @@ acpi_ps_get_depth_next (
305 } 243 }
306 244
307 if (arg == origin) { 245 if (arg == origin) {
308 /* reached parent of origin, end search */ 246 /* Reached parent of origin, end search */
309 247
310 return (NULL); 248 return (NULL);
311 } 249 }
312 250
313 if (parent->common.next) { 251 if (parent->common.next) {
314 /* found sibling of parent */ 252 /* Found sibling of parent */
315 253
316 return (parent->common.next); 254 return (parent->common.next);
317 } 255 }
@@ -323,5 +261,74 @@ acpi_ps_get_depth_next (
323 return (next); 261 return (next);
324} 262}
325 263
264
265#ifdef ACPI_OBSOLETE_FUNCTIONS
266/*******************************************************************************
267 *
268 * FUNCTION: acpi_ps_get_child
269 *
270 * PARAMETERS: Op - Get the child of this Op
271 *
272 * RETURN: Child Op, Null if none is found.
273 *
274 * DESCRIPTION: Get op's children or NULL if none
275 *
276 ******************************************************************************/
277
278union acpi_parse_object *
279acpi_ps_get_child (
280 union acpi_parse_object *op)
281{
282 union acpi_parse_object *child = NULL;
283
284
285 ACPI_FUNCTION_ENTRY ();
286
287
288 switch (op->common.aml_opcode) {
289 case AML_SCOPE_OP:
290 case AML_ELSE_OP:
291 case AML_DEVICE_OP:
292 case AML_THERMAL_ZONE_OP:
293 case AML_INT_METHODCALL_OP:
294
295 child = acpi_ps_get_arg (op, 0);
296 break;
297
298
299 case AML_BUFFER_OP:
300 case AML_PACKAGE_OP:
301 case AML_METHOD_OP:
302 case AML_IF_OP:
303 case AML_WHILE_OP:
304 case AML_FIELD_OP:
305
306 child = acpi_ps_get_arg (op, 1);
307 break;
308
309
310 case AML_POWER_RES_OP:
311 case AML_INDEX_FIELD_OP:
312
313 child = acpi_ps_get_arg (op, 2);
314 break;
315
316
317 case AML_PROCESSOR_OP:
318 case AML_BANK_FIELD_OP:
319
320 child = acpi_ps_get_arg (op, 3);
321 break;
322
323
324 default:
325 /* All others have no children */
326 break;
327 }
328
329 return (child);
330}
331#endif
332
326#endif /* ACPI_FUTURE_USAGE */ 333#endif /* ACPI_FUTURE_USAGE */
327 334
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c
index b3597cb19f88..a10f88715d43 100644
--- a/drivers/acpi/parser/psutils.c
+++ b/drivers/acpi/parser/psutils.c
@@ -45,7 +45,6 @@
45#include <acpi/acpi.h> 45#include <acpi/acpi.h>
46#include <acpi/acparser.h> 46#include <acpi/acparser.h>
47#include <acpi/amlcode.h> 47#include <acpi/amlcode.h>
48#include <acpi/acnamesp.h>
49 48
50#define _COMPONENT ACPI_PARSER 49#define _COMPONENT ACPI_PARSER
51 ACPI_MODULE_NAME ("psutils") 50 ACPI_MODULE_NAME ("psutils")
@@ -57,7 +56,7 @@
57 * 56 *
58 * PARAMETERS: None 57 * PARAMETERS: None
59 * 58 *
60 * RETURN: scope_op 59 * RETURN: A new Scope object, null on failure
61 * 60 *
62 * DESCRIPTION: Create a Scope and associated namepath op with the root name 61 * DESCRIPTION: Create a Scope and associated namepath op with the root name
63 * 62 *
@@ -75,7 +74,6 @@ acpi_ps_create_scope_op (
75 return (NULL); 74 return (NULL);
76 } 75 }
77 76
78
79 scope_op->named.name = ACPI_ROOT_NAME; 77 scope_op->named.name = ACPI_ROOT_NAME;
80 return (scope_op); 78 return (scope_op);
81} 79}
@@ -88,10 +86,9 @@ acpi_ps_create_scope_op (
88 * PARAMETERS: Op - A newly allocated Op object 86 * PARAMETERS: Op - A newly allocated Op object
89 * Opcode - Opcode to store in the Op 87 * Opcode - Opcode to store in the Op
90 * 88 *
91 * RETURN: Status 89 * RETURN: None
92 * 90 *
93 * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on 91 * DESCRIPTION: Initialize a parse (Op) object
94 * opcode
95 * 92 *
96 ******************************************************************************/ 93 ******************************************************************************/
97 94
@@ -107,7 +104,8 @@ acpi_ps_init_op (
107 op->common.aml_opcode = opcode; 104 op->common.aml_opcode = opcode;
108 105
109 ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name, 106 ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name,
110 (acpi_ps_get_opcode_info (opcode))->name, sizeof (op->common.aml_op_name))); 107 (acpi_ps_get_opcode_info (opcode))->name,
108 sizeof (op->common.aml_op_name)));
111} 109}
112 110
113 111
@@ -117,7 +115,7 @@ acpi_ps_init_op (
117 * 115 *
118 * PARAMETERS: Opcode - Opcode that will be stored in the new Op 116 * PARAMETERS: Opcode - Opcode that will be stored in the new Op
119 * 117 *
120 * RETURN: Pointer to the new Op. 118 * RETURN: Pointer to the new Op, null on failure
121 * 119 *
122 * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on 120 * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on
123 * opcode. A cache of opcodes is available for the pure 121 * opcode. A cache of opcodes is available for the pure
@@ -275,7 +273,6 @@ acpi_ps_get_name (
275 union acpi_parse_object *op) 273 union acpi_parse_object *op)
276{ 274{
277 275
278
279 /* The "generic" object has no name associated with it */ 276 /* The "generic" object has no name associated with it */
280 277
281 if (op->common.flags & ACPI_PARSEOP_GENERIC) { 278 if (op->common.flags & ACPI_PARSEOP_GENERIC) {
diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c
index 110d2ce917b6..9d20cb2ceb51 100644
--- a/drivers/acpi/parser/pswalk.c
+++ b/drivers/acpi/parser/pswalk.c
@@ -90,17 +90,15 @@ acpi_ps_delete_parse_tree (
90 } 90 }
91 } 91 }
92 92
93 /* 93 /* No more children, this Op is complete. */
94 * No more children, this Op is complete. 94
95 */
96 next = op->common.next; 95 next = op->common.next;
97 parent = op->common.parent; 96 parent = op->common.parent;
98 97
99 acpi_ps_free_op (op); 98 acpi_ps_free_op (op);
100 99
101 /* 100 /* If we are back to the starting point, the walk is complete. */
102 * If we are back to the starting point, the walk is complete. 101
103 */
104 if (op == subtree_root) { 102 if (op == subtree_root) {
105 return_VOID; 103 return_VOID;
106 } 104 }
@@ -111,5 +109,6 @@ acpi_ps_delete_parse_tree (
111 op = parent; 109 op = parent;
112 } 110 }
113 } 111 }
112
114 return_VOID; 113 return_VOID;
115} 114}
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c
index b318ad24726d..dba893648e84 100644
--- a/drivers/acpi/parser/psxface.c
+++ b/drivers/acpi/parser/psxface.c
@@ -57,13 +57,16 @@
57 * 57 *
58 * FUNCTION: acpi_psx_execute 58 * FUNCTION: acpi_psx_execute
59 * 59 *
60 * PARAMETERS: Info->Node - A method object containing both the AML 60 * PARAMETERS: Info - Method info block, contains:
61 * address and length. 61 * Node - Method Node to execute
62 * **Params - List of parameters to pass to method, 62 * Parameters - List of parameters to pass to the method,
63 * terminated by NULL. Params itself may be 63 * terminated by NULL. Params itself may be
64 * NULL if no parameters are being passed. 64 * NULL if no parameters are being passed.
65 * **return_obj_desc - Return object from execution of the 65 * return_object - Where to put method's return value (if
66 * method. 66 * any). If NULL, no value is returned.
67 * parameter_type - Type of Parameter list
68 * return_object - Where to put method's return value (if
69 * any). If NULL, no value is returned.
67 * 70 *
68 * RETURN: Status 71 * RETURN: Status
69 * 72 *
@@ -196,9 +199,8 @@ acpi_psx_execute (
196 goto cleanup3; 199 goto cleanup3;
197 } 200 }
198 201
199 /* 202 /* The walk of the parse tree is where we actually execute the method */
200 * The walk of the parse tree is where we actually execute the method 203
201 */
202 status = acpi_ps_parse_aml (walk_state); 204 status = acpi_ps_parse_aml (walk_state);
203 goto cleanup2; /* Walk state already deleted */ 205 goto cleanup2; /* Walk state already deleted */
204 206
@@ -217,7 +219,8 @@ cleanup1:
217 for (i = 0; info->parameters[i]; i++) { 219 for (i = 0; info->parameters[i]; i++) {
218 /* Ignore errors, just do them all */ 220 /* Ignore errors, just do them all */
219 221
220 (void) acpi_ut_update_object_reference (info->parameters[i], REF_DECREMENT); 222 (void) acpi_ut_update_object_reference (
223 info->parameters[i], REF_DECREMENT);
221 } 224 }
222 } 225 }
223 226
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c
index 4788c079735d..55d264771c48 100644
--- a/drivers/acpi/resources/rsaddr.c
+++ b/drivers/acpi/resources/rsaddr.c
@@ -77,21 +77,21 @@ acpi_rs_address16_resource (
77 u8 **output_buffer, 77 u8 **output_buffer,
78 acpi_size *structure_size) 78 acpi_size *structure_size)
79{ 79{
80 u8 *buffer = byte_stream_buffer;
81 struct acpi_resource *output_struct = (void *) *output_buffer;
82 u8 *temp_ptr;
83 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16);
84 u32 index; 80 u32 index;
85 u16 temp16; 81 u16 temp16;
86 u8 temp8; 82 u8 temp8;
83 u8 *temp_ptr;
84 u8 *buffer = byte_stream_buffer;
85 struct acpi_resource *output_struct = (void *) *output_buffer;
86 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
87 struct acpi_resource_address16);
87 88
88 89
89 ACPI_FUNCTION_TRACE ("rs_address16_resource"); 90 ACPI_FUNCTION_TRACE ("rs_address16_resource");
90 91
91 92
92 /* 93 /* Point past the Descriptor to get the number of bytes consumed */
93 * Point past the Descriptor to get the number of bytes consumed 94
94 */
95 buffer += 1; 95 buffer += 1;
96 ACPI_MOVE_16_TO_16 (&temp16, buffer); 96 ACPI_MOVE_16_TO_16 (&temp16, buffer);
97 97
@@ -104,9 +104,8 @@ acpi_rs_address16_resource (
104 *bytes_consumed = temp16 + 3; 104 *bytes_consumed = temp16 + 3;
105 output_struct->id = ACPI_RSTYPE_ADDRESS16; 105 output_struct->id = ACPI_RSTYPE_ADDRESS16;
106 106
107 /* 107 /* Get the Resource Type (Byte3) */
108 * Get the Resource Type (Byte3) 108
109 */
110 buffer += 2; 109 buffer += 2;
111 temp8 = *buffer; 110 temp8 = *buffer;
112 111
@@ -118,9 +117,8 @@ acpi_rs_address16_resource (
118 117
119 output_struct->data.address16.resource_type = temp8; 118 output_struct->data.address16.resource_type = temp8;
120 119
121 /* 120 /* Get the General Flags (Byte4) */
122 * Get the General Flags (Byte4) 121
123 */
124 buffer += 1; 122 buffer += 1;
125 temp8 = *buffer; 123 temp8 = *buffer;
126 124
@@ -140,9 +138,8 @@ acpi_rs_address16_resource (
140 138
141 output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01; 139 output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01;
142 140
143 /* 141 /* Get the Type Specific Flags (Byte5) */
144 * Get the Type Specific Flags (Byte5) 142
145 */
146 buffer += 1; 143 buffer += 1;
147 temp8 = *buffer; 144 temp8 = *buffer;
148 145
@@ -165,39 +162,34 @@ acpi_rs_address16_resource (
165 } 162 }
166 } 163 }
167 164
168 /* 165 /* Get Granularity (Bytes 6-7) */
169 * Get Granularity (Bytes 6-7) 166
170 */
171 buffer += 1; 167 buffer += 1;
172 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer); 168 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer);
173 169
174 /* 170 /* Get min_address_range (Bytes 8-9) */
175 * Get min_address_range (Bytes 8-9) 171
176 */
177 buffer += 2; 172 buffer += 2;
178 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer); 173 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer);
179 174
180 /* 175 /* Get max_address_range (Bytes 10-11) */
181 * Get max_address_range (Bytes 10-11) 176
182 */
183 buffer += 2; 177 buffer += 2;
184 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer); 178 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer);
185 179
186 /* 180 /* Get address_translation_offset (Bytes 12-13) */
187 * Get address_translation_offset (Bytes 12-13) 181
188 */
189 buffer += 2; 182 buffer += 2;
190 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset, buffer); 183 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset,
184 buffer);
185
186 /* Get address_length (Bytes 14-15) */
191 187
192 /*
193 * Get address_length (Bytes 14-15)
194 */
195 buffer += 2; 188 buffer += 2;
196 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer); 189 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer);
197 190
198 /* 191 /* Resource Source Index (if present) */
199 * Resource Source Index (if present) 192
200 */
201 buffer += 2; 193 buffer += 2;
202 194
203 /* 195 /*
@@ -225,7 +217,8 @@ acpi_rs_address16_resource (
225 output_struct->data.address16.resource_source.string_ptr = 217 output_struct->data.address16.resource_source.string_ptr =
226 (char *)((u8 * )output_struct + struct_size); 218 (char *)((u8 * )output_struct + struct_size);
227 219
228 temp_ptr = (u8 *) output_struct->data.address16.resource_source.string_ptr; 220 temp_ptr = (u8 *)
221 output_struct->data.address16.resource_source.string_ptr;
229 222
230 /* Copy the string into the buffer */ 223 /* Copy the string into the buffer */
231 224
@@ -239,9 +232,8 @@ acpi_rs_address16_resource (
239 index += 1; 232 index += 1;
240 } 233 }
241 234
242 /* 235 /* Add the terminating null */
243 * Add the terminating null 236
244 */
245 *temp_ptr = 0x00; 237 *temp_ptr = 0x00;
246 238
247 output_struct->data.address16.resource_source.string_length = index + 1; 239 output_struct->data.address16.resource_source.string_length = index + 1;
@@ -260,14 +252,12 @@ acpi_rs_address16_resource (
260 output_struct->data.address16.resource_source.string_ptr = NULL; 252 output_struct->data.address16.resource_source.string_ptr = NULL;
261 } 253 }
262 254
263 /* 255 /* Set the Length parameter */
264 * Set the Length parameter 256
265 */
266 output_struct->length = (u32) struct_size; 257 output_struct->length = (u32) struct_size;
267 258
268 /* 259 /* Return the final size of the structure */
269 * Return the final size of the structure 260
270 */
271 *structure_size = struct_size; 261 *structure_size = struct_size;
272 return_ACPI_STATUS (AE_OK); 262 return_ACPI_STATUS (AE_OK);
273} 263}
@@ -305,28 +295,24 @@ acpi_rs_address16_stream (
305 ACPI_FUNCTION_TRACE ("rs_address16_stream"); 295 ACPI_FUNCTION_TRACE ("rs_address16_stream");
306 296
307 297
308 /* 298 /* The descriptor field is static */
309 * The descriptor field is static 299
310 */
311 *buffer = 0x88; 300 *buffer = 0x88;
312 buffer += 1; 301 buffer += 1;
313 302
314 /* 303 /* Save a pointer to the Length field - to be filled in later */
315 * Save a pointer to the Length field - to be filled in later 304
316 */
317 length_field = buffer; 305 length_field = buffer;
318 buffer += 2; 306 buffer += 2;
319 307
320 /* 308 /* Set the Resource Type (Memory, Io, bus_number) */
321 * Set the Resource Type (Memory, Io, bus_number) 309
322 */
323 temp8 = (u8) (linked_list->data.address16.resource_type & 0x03); 310 temp8 = (u8) (linked_list->data.address16.resource_type & 0x03);
324 *buffer = temp8; 311 *buffer = temp8;
325 buffer += 1; 312 buffer += 1;
326 313
327 /* 314 /* Set the general flags */
328 * Set the general flags 315
329 */
330 temp8 = (u8) (linked_list->data.address16.producer_consumer & 0x01); 316 temp8 = (u8) (linked_list->data.address16.producer_consumer & 0x01);
331 317
332 temp8 |= (linked_list->data.address16.decode & 0x01) << 1; 318 temp8 |= (linked_list->data.address16.decode & 0x01) << 1;
@@ -336,9 +322,8 @@ acpi_rs_address16_stream (
336 *buffer = temp8; 322 *buffer = temp8;
337 buffer += 1; 323 buffer += 1;
338 324
339 /* 325 /* Set the type specific flags */
340 * Set the type specific flags 326
341 */
342 temp8 = 0; 327 temp8 = 0;
343 328
344 if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) { 329 if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) {
@@ -362,39 +347,34 @@ acpi_rs_address16_stream (
362 *buffer = temp8; 347 *buffer = temp8;
363 buffer += 1; 348 buffer += 1;
364 349
365 /* 350 /* Set the address space granularity */
366 * Set the address space granularity 351
367 */
368 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity); 352 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity);
369 buffer += 2; 353 buffer += 2;
370 354
371 /* 355 /* Set the address range minimum */
372 * Set the address range minimum 356
373 */
374 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range); 357 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range);
375 buffer += 2; 358 buffer += 2;
376 359
377 /* 360 /* Set the address range maximum */
378 * Set the address range maximum 361
379 */
380 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range); 362 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range);
381 buffer += 2; 363 buffer += 2;
382 364
383 /* 365 /* Set the address translation offset */
384 * Set the address translation offset 366
385 */ 367 ACPI_MOVE_32_TO_16 (buffer,
386 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_translation_offset); 368 &linked_list->data.address16.address_translation_offset);
387 buffer += 2; 369 buffer += 2;
388 370
389 /* 371 /* Set the address length */
390 * Set the address length 372
391 */
392 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length); 373 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length);
393 buffer += 2; 374 buffer += 2;
394 375
395 /* 376 /* Resource Source Index and Resource Source are optional */
396 * Resource Source Index and Resource Source are optional 377
397 */
398 if (0 != linked_list->data.address16.resource_source.string_length) { 378 if (0 != linked_list->data.address16.resource_source.string_length) {
399 temp8 = (u8) linked_list->data.address16.resource_source.index; 379 temp8 = (u8) linked_list->data.address16.resource_source.index;
400 380
@@ -403,9 +383,8 @@ acpi_rs_address16_stream (
403 383
404 temp_pointer = (char *) buffer; 384 temp_pointer = (char *) buffer;
405 385
406 /* 386 /* Copy the string */
407 * Copy the string 387
408 */
409 ACPI_STRCPY (temp_pointer, 388 ACPI_STRCPY (temp_pointer,
410 linked_list->data.address16.resource_source.string_ptr); 389 linked_list->data.address16.resource_source.string_ptr);
411 390
@@ -413,12 +392,12 @@ acpi_rs_address16_stream (
413 * Buffer needs to be set to the length of the sting + one for the 392 * Buffer needs to be set to the length of the sting + one for the
414 * terminating null 393 * terminating null
415 */ 394 */
416 buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address16.resource_source.string_ptr) + 1); 395 buffer += (acpi_size)(ACPI_STRLEN (
396 linked_list->data.address16.resource_source.string_ptr) + 1);
417 } 397 }
418 398
419 /* 399 /* Return the number of bytes consumed in this operation */
420 * Return the number of bytes consumed in this operation 400
421 */
422 actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer); 401 actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer);
423 *bytes_consumed = actual_bytes; 402 *bytes_consumed = actual_bytes;
424 403
@@ -475,9 +454,8 @@ acpi_rs_address32_resource (
475 buffer = byte_stream_buffer; 454 buffer = byte_stream_buffer;
476 struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32); 455 struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32);
477 456
478 /* 457 /* Point past the Descriptor to get the number of bytes consumed */
479 * Point past the Descriptor to get the number of bytes consumed 458
480 */
481 buffer += 1; 459 buffer += 1;
482 ACPI_MOVE_16_TO_16 (&temp16, buffer); 460 ACPI_MOVE_16_TO_16 (&temp16, buffer);
483 461
@@ -490,9 +468,8 @@ acpi_rs_address32_resource (
490 *bytes_consumed = temp16 + 3; 468 *bytes_consumed = temp16 + 3;
491 output_struct->id = ACPI_RSTYPE_ADDRESS32; 469 output_struct->id = ACPI_RSTYPE_ADDRESS32;
492 470
493 /* 471 /* Get the Resource Type (Byte3) */
494 * Get the Resource Type (Byte3) 472
495 */
496 buffer += 2; 473 buffer += 2;
497 temp8 = *buffer; 474 temp8 = *buffer;
498 475
@@ -504,35 +481,29 @@ acpi_rs_address32_resource (
504 481
505 output_struct->data.address32.resource_type = temp8; 482 output_struct->data.address32.resource_type = temp8;
506 483
507 /* 484 /* Get the General Flags (Byte4) */
508 * Get the General Flags (Byte4) 485
509 */
510 buffer += 1; 486 buffer += 1;
511 temp8 = *buffer; 487 temp8 = *buffer;
512 488
513 /* 489 /* Producer / Consumer */
514 * Producer / Consumer 490
515 */
516 output_struct->data.address32.producer_consumer = temp8 & 0x01; 491 output_struct->data.address32.producer_consumer = temp8 & 0x01;
517 492
518 /* 493 /* Decode */
519 * Decode 494
520 */
521 output_struct->data.address32.decode = (temp8 >> 1) & 0x01; 495 output_struct->data.address32.decode = (temp8 >> 1) & 0x01;
522 496
523 /* 497 /* Min Address Fixed */
524 * Min Address Fixed 498
525 */
526 output_struct->data.address32.min_address_fixed = (temp8 >> 2) & 0x01; 499 output_struct->data.address32.min_address_fixed = (temp8 >> 2) & 0x01;
527 500
528 /* 501 /* Max Address Fixed */
529 * Max Address Fixed 502
530 */
531 output_struct->data.address32.max_address_fixed = (temp8 >> 3) & 0x01; 503 output_struct->data.address32.max_address_fixed = (temp8 >> 3) & 0x01;
532 504
533 /* 505 /* Get the Type Specific Flags (Byte5) */
534 * Get the Type Specific Flags (Byte5) 506
535 */
536 buffer += 1; 507 buffer += 1;
537 temp8 = *buffer; 508 temp8 = *buffer;
538 509
@@ -556,39 +527,34 @@ acpi_rs_address32_resource (
556 } 527 }
557 } 528 }
558 529
559 /* 530 /* Get Granularity (Bytes 6-9) */
560 * Get Granularity (Bytes 6-9) 531
561 */
562 buffer += 1; 532 buffer += 1;
563 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer); 533 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer);
564 534
565 /* 535 /* Get min_address_range (Bytes 10-13) */
566 * Get min_address_range (Bytes 10-13) 536
567 */
568 buffer += 4; 537 buffer += 4;
569 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer); 538 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer);
570 539
571 /* 540 /* Get max_address_range (Bytes 14-17) */
572 * Get max_address_range (Bytes 14-17) 541
573 */
574 buffer += 4; 542 buffer += 4;
575 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer); 543 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer);
576 544
577 /* 545 /* Get address_translation_offset (Bytes 18-21) */
578 * Get address_translation_offset (Bytes 18-21) 546
579 */
580 buffer += 4; 547 buffer += 4;
581 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset, buffer); 548 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset,
549 buffer);
550
551 /* Get address_length (Bytes 22-25) */
582 552
583 /*
584 * Get address_length (Bytes 22-25)
585 */
586 buffer += 4; 553 buffer += 4;
587 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer); 554 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer);
588 555
589 /* 556 /* Resource Source Index (if present) */
590 * Resource Source Index (if present) 557
591 */
592 buffer += 4; 558 buffer += 4;
593 559
594 /* 560 /*
@@ -615,7 +581,8 @@ acpi_rs_address32_resource (
615 output_struct->data.address32.resource_source.string_ptr = 581 output_struct->data.address32.resource_source.string_ptr =
616 (char *)((u8 *)output_struct + struct_size); 582 (char *)((u8 *)output_struct + struct_size);
617 583
618 temp_ptr = (u8 *) output_struct->data.address32.resource_source.string_ptr; 584 temp_ptr = (u8 *)
585 output_struct->data.address32.resource_source.string_ptr;
619 586
620 /* Copy the string into the buffer */ 587 /* Copy the string into the buffer */
621 588
@@ -628,9 +595,8 @@ acpi_rs_address32_resource (
628 index += 1; 595 index += 1;
629 } 596 }
630 597
631 /* 598 /* Add the terminating null */
632 * Add the terminating null 599
633 */
634 *temp_ptr = 0x00; 600 *temp_ptr = 0x00;
635 output_struct->data.address32.resource_source.string_length = index + 1; 601 output_struct->data.address32.resource_source.string_length = index + 1;
636 602
@@ -648,14 +614,12 @@ acpi_rs_address32_resource (
648 output_struct->data.address32.resource_source.string_ptr = NULL; 614 output_struct->data.address32.resource_source.string_ptr = NULL;
649 } 615 }
650 616
651 /* 617 /* Set the Length parameter */
652 * Set the Length parameter 618
653 */
654 output_struct->length = (u32) struct_size; 619 output_struct->length = (u32) struct_size;
655 620
656 /* 621 /* Return the final size of the structure */
657 * Return the final size of the structure 622
658 */
659 *structure_size = struct_size; 623 *structure_size = struct_size;
660 return_ACPI_STATUS (AE_OK); 624 return_ACPI_STATUS (AE_OK);
661} 625}
@@ -694,29 +658,25 @@ acpi_rs_address32_stream (
694 658
695 buffer = *output_buffer; 659 buffer = *output_buffer;
696 660
697 /* 661 /* The descriptor field is static */
698 * The descriptor field is static 662
699 */
700 *buffer = 0x87; 663 *buffer = 0x87;
701 buffer += 1; 664 buffer += 1;
702 665
703 /* 666 /* Set a pointer to the Length field - to be filled in later */
704 * Set a pointer to the Length field - to be filled in later 667
705 */
706 length_field = ACPI_CAST_PTR (u16, buffer); 668 length_field = ACPI_CAST_PTR (u16, buffer);
707 buffer += 2; 669 buffer += 2;
708 670
709 /* 671 /* Set the Resource Type (Memory, Io, bus_number) */
710 * Set the Resource Type (Memory, Io, bus_number) 672
711 */
712 temp8 = (u8) (linked_list->data.address32.resource_type & 0x03); 673 temp8 = (u8) (linked_list->data.address32.resource_type & 0x03);
713 674
714 *buffer = temp8; 675 *buffer = temp8;
715 buffer += 1; 676 buffer += 1;
716 677
717 /* 678 /* Set the general flags */
718 * Set the general flags 679
719 */
720 temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01); 680 temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01);
721 temp8 |= (linked_list->data.address32.decode & 0x01) << 1; 681 temp8 |= (linked_list->data.address32.decode & 0x01) << 1;
722 temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2; 682 temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2;
@@ -725,9 +685,8 @@ acpi_rs_address32_stream (
725 *buffer = temp8; 685 *buffer = temp8;
726 buffer += 1; 686 buffer += 1;
727 687
728 /* 688 /* Set the type specific flags */
729 * Set the type specific flags 689
730 */
731 temp8 = 0; 690 temp8 = 0;
732 691
733 if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) { 692 if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) {
@@ -751,39 +710,34 @@ acpi_rs_address32_stream (
751 *buffer = temp8; 710 *buffer = temp8;
752 buffer += 1; 711 buffer += 1;
753 712
754 /* 713 /* Set the address space granularity */
755 * Set the address space granularity 714
756 */
757 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity); 715 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity);
758 buffer += 4; 716 buffer += 4;
759 717
760 /* 718 /* Set the address range minimum */
761 * Set the address range minimum 719
762 */
763 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range); 720 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range);
764 buffer += 4; 721 buffer += 4;
765 722
766 /* 723 /* Set the address range maximum */
767 * Set the address range maximum 724
768 */
769 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range); 725 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range);
770 buffer += 4; 726 buffer += 4;
771 727
772 /* 728 /* Set the address translation offset */
773 * Set the address translation offset 729
774 */ 730 ACPI_MOVE_32_TO_32 (buffer,
775 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_translation_offset); 731 &linked_list->data.address32.address_translation_offset);
776 buffer += 4; 732 buffer += 4;
777 733
778 /* 734 /* Set the address length */
779 * Set the address length 735
780 */
781 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length); 736 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length);
782 buffer += 4; 737 buffer += 4;
783 738
784 /* 739 /* Resource Source Index and Resource Source are optional */
785 * Resource Source Index and Resource Source are optional 740
786 */
787 if (0 != linked_list->data.address32.resource_source.string_length) { 741 if (0 != linked_list->data.address32.resource_source.string_length) {
788 temp8 = (u8) linked_list->data.address32.resource_source.index; 742 temp8 = (u8) linked_list->data.address32.resource_source.index;
789 743
@@ -792,9 +746,8 @@ acpi_rs_address32_stream (
792 746
793 temp_pointer = (char *) buffer; 747 temp_pointer = (char *) buffer;
794 748
795 /* 749 /* Copy the string */
796 * Copy the string 750
797 */
798 ACPI_STRCPY (temp_pointer, 751 ACPI_STRCPY (temp_pointer,
799 linked_list->data.address32.resource_source.string_ptr); 752 linked_list->data.address32.resource_source.string_ptr);
800 753
@@ -802,12 +755,12 @@ acpi_rs_address32_stream (
802 * Buffer needs to be set to the length of the sting + one for the 755 * Buffer needs to be set to the length of the sting + one for the
803 * terminating null 756 * terminating null
804 */ 757 */
805 buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address32.resource_source.string_ptr) + 1); 758 buffer += (acpi_size)(ACPI_STRLEN (
759 linked_list->data.address32.resource_source.string_ptr) + 1);
806 } 760 }
807 761
808 /* 762 /* Return the number of bytes consumed in this operation */
809 * Return the number of bytes consumed in this operation 763
810 */
811 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 764 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
812 765
813 /* 766 /*
@@ -864,9 +817,8 @@ acpi_rs_address64_resource (
864 struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64); 817 struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64);
865 resource_type = *buffer; 818 resource_type = *buffer;
866 819
867 /* 820 /* Point past the Descriptor to get the number of bytes consumed */
868 * Point past the Descriptor to get the number of bytes consumed 821
869 */
870 buffer += 1; 822 buffer += 1;
871 ACPI_MOVE_16_TO_16 (&temp16, buffer); 823 ACPI_MOVE_16_TO_16 (&temp16, buffer);
872 824
@@ -879,9 +831,8 @@ acpi_rs_address64_resource (
879 *bytes_consumed = temp16 + 3; 831 *bytes_consumed = temp16 + 3;
880 output_struct->id = ACPI_RSTYPE_ADDRESS64; 832 output_struct->id = ACPI_RSTYPE_ADDRESS64;
881 833
882 /* 834 /* Get the Resource Type (Byte3) */
883 * Get the Resource Type (Byte3) 835
884 */
885 buffer += 2; 836 buffer += 2;
886 temp8 = *buffer; 837 temp8 = *buffer;
887 838
@@ -893,35 +844,29 @@ acpi_rs_address64_resource (
893 844
894 output_struct->data.address64.resource_type = temp8; 845 output_struct->data.address64.resource_type = temp8;
895 846
896 /* 847 /* Get the General Flags (Byte4) */
897 * Get the General Flags (Byte4) 848
898 */
899 buffer += 1; 849 buffer += 1;
900 temp8 = *buffer; 850 temp8 = *buffer;
901 851
902 /* 852 /* Producer / Consumer */
903 * Producer / Consumer 853
904 */
905 output_struct->data.address64.producer_consumer = temp8 & 0x01; 854 output_struct->data.address64.producer_consumer = temp8 & 0x01;
906 855
907 /* 856 /* Decode */
908 * Decode 857
909 */
910 output_struct->data.address64.decode = (temp8 >> 1) & 0x01; 858 output_struct->data.address64.decode = (temp8 >> 1) & 0x01;
911 859
912 /* 860 /* Min Address Fixed */
913 * Min Address Fixed 861
914 */
915 output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01; 862 output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01;
916 863
917 /* 864 /* Max Address Fixed */
918 * Max Address Fixed 865
919 */
920 output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01; 866 output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01;
921 867
922 /* 868 /* Get the Type Specific Flags (Byte5) */
923 * Get the Type Specific Flags (Byte5) 869
924 */
925 buffer += 1; 870 buffer += 1;
926 temp8 = *buffer; 871 temp8 = *buffer;
927 872
@@ -951,33 +896,29 @@ acpi_rs_address64_resource (
951 buffer += 2; 896 buffer += 2;
952 } 897 }
953 898
954 /* 899 /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */
955 * Get Granularity (Bytes 6-13) or (Bytes 8-15) 900
956 */
957 buffer += 1; 901 buffer += 1;
958 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer); 902 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer);
959 903
960 /* 904 /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */
961 * Get min_address_range (Bytes 14-21) or (Bytes 16-23) 905
962 */
963 buffer += 8; 906 buffer += 8;
964 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer); 907 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer);
965 908
966 /* 909 /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */
967 * Get max_address_range (Bytes 22-29) or (Bytes 24-31) 910
968 */
969 buffer += 8; 911 buffer += 8;
970 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer); 912 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer);
971 913
972 /* 914 /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */
973 * Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) 915
974 */
975 buffer += 8; 916 buffer += 8;
976 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset, buffer); 917 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset,
918 buffer);
919
920 /* Get address_length (Bytes 38-45) or (Bytes 40-47) */
977 921
978 /*
979 * Get address_length (Bytes 38-45) or (Bytes 40-47)
980 */
981 buffer += 8; 922 buffer += 8;
982 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer); 923 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer);
983 924
@@ -989,14 +930,15 @@ acpi_rs_address64_resource (
989 /* Get type_specific_attribute (Bytes 48-55) */ 930 /* Get type_specific_attribute (Bytes 48-55) */
990 931
991 buffer += 8; 932 buffer += 8;
992 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.type_specific_attributes, buffer); 933 ACPI_MOVE_64_TO_64 (
934 &output_struct->data.address64.type_specific_attributes,
935 buffer);
993 } 936 }
994 else { 937 else {
995 output_struct->data.address64.type_specific_attributes = 0; 938 output_struct->data.address64.type_specific_attributes = 0;
996 939
997 /* 940 /* Resource Source Index (if present) */
998 * Resource Source Index (if present) 941
999 */
1000 buffer += 8; 942 buffer += 8;
1001 943
1002 /* 944 /*
@@ -1025,7 +967,8 @@ acpi_rs_address64_resource (
1025 output_struct->data.address64.resource_source.string_ptr = 967 output_struct->data.address64.resource_source.string_ptr =
1026 (char *)((u8 *)output_struct + struct_size); 968 (char *)((u8 *)output_struct + struct_size);
1027 969
1028 temp_ptr = (u8 *) output_struct->data.address64.resource_source.string_ptr; 970 temp_ptr = (u8 *)
971 output_struct->data.address64.resource_source.string_ptr;
1029 972
1030 /* Copy the string into the buffer */ 973 /* Copy the string into the buffer */
1031 974
@@ -1042,7 +985,8 @@ acpi_rs_address64_resource (
1042 * Add the terminating null 985 * Add the terminating null
1043 */ 986 */
1044 *temp_ptr = 0x00; 987 *temp_ptr = 0x00;
1045 output_struct->data.address64.resource_source.string_length = index + 1; 988 output_struct->data.address64.resource_source.string_length =
989 index + 1;
1046 990
1047 /* 991 /*
1048 * In order for the struct_size to fall on a 32-bit boundary, 992 * In order for the struct_size to fall on a 32-bit boundary,
@@ -1054,14 +998,12 @@ acpi_rs_address64_resource (
1054 } 998 }
1055 } 999 }
1056 1000
1057 /* 1001 /* Set the Length parameter */
1058 * Set the Length parameter 1002
1059 */
1060 output_struct->length = (u32) struct_size; 1003 output_struct->length = (u32) struct_size;
1061 1004
1062 /* 1005 /* Return the final size of the structure */
1063 * Return the final size of the structure 1006
1064 */
1065 *structure_size = struct_size; 1007 *structure_size = struct_size;
1066 return_ACPI_STATUS (AE_OK); 1008 return_ACPI_STATUS (AE_OK);
1067} 1009}
@@ -1100,29 +1042,25 @@ acpi_rs_address64_stream (
1100 1042
1101 buffer = *output_buffer; 1043 buffer = *output_buffer;
1102 1044
1103 /* 1045 /* The descriptor field is static */
1104 * The descriptor field is static 1046
1105 */
1106 *buffer = 0x8A; 1047 *buffer = 0x8A;
1107 buffer += 1; 1048 buffer += 1;
1108 1049
1109 /* 1050 /* Set a pointer to the Length field - to be filled in later */
1110 * Set a pointer to the Length field - to be filled in later 1051
1111 */
1112 length_field = ACPI_CAST_PTR (u16, buffer); 1052 length_field = ACPI_CAST_PTR (u16, buffer);
1113 buffer += 2; 1053 buffer += 2;
1114 1054
1115 /* 1055 /* Set the Resource Type (Memory, Io, bus_number) */
1116 * Set the Resource Type (Memory, Io, bus_number) 1056
1117 */
1118 temp8 = (u8) (linked_list->data.address64.resource_type & 0x03); 1057 temp8 = (u8) (linked_list->data.address64.resource_type & 0x03);
1119 1058
1120 *buffer = temp8; 1059 *buffer = temp8;
1121 buffer += 1; 1060 buffer += 1;
1122 1061
1123 /* 1062 /* Set the general flags */
1124 * Set the general flags 1063
1125 */
1126 temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01); 1064 temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01);
1127 temp8 |= (linked_list->data.address64.decode & 0x01) << 1; 1065 temp8 |= (linked_list->data.address64.decode & 0x01) << 1;
1128 temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2; 1066 temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2;
@@ -1131,9 +1069,8 @@ acpi_rs_address64_stream (
1131 *buffer = temp8; 1069 *buffer = temp8;
1132 buffer += 1; 1070 buffer += 1;
1133 1071
1134 /* 1072 /* Set the type specific flags */
1135 * Set the type specific flags 1073
1136 */
1137 temp8 = 0; 1074 temp8 = 0;
1138 1075
1139 if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) { 1076 if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) {
@@ -1157,39 +1094,34 @@ acpi_rs_address64_stream (
1157 *buffer = temp8; 1094 *buffer = temp8;
1158 buffer += 1; 1095 buffer += 1;
1159 1096
1160 /* 1097 /* Set the address space granularity */
1161 * Set the address space granularity 1098
1162 */
1163 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity); 1099 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity);
1164 buffer += 8; 1100 buffer += 8;
1165 1101
1166 /* 1102 /* Set the address range minimum */
1167 * Set the address range minimum 1103
1168 */
1169 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range); 1104 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range);
1170 buffer += 8; 1105 buffer += 8;
1171 1106
1172 /* 1107 /* Set the address range maximum */
1173 * Set the address range maximum 1108
1174 */
1175 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range); 1109 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range);
1176 buffer += 8; 1110 buffer += 8;
1177 1111
1178 /* 1112 /* Set the address translation offset */
1179 * Set the address translation offset 1113
1180 */ 1114 ACPI_MOVE_64_TO_64 (buffer,
1181 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_translation_offset); 1115 &linked_list->data.address64.address_translation_offset);
1182 buffer += 8; 1116 buffer += 8;
1183 1117
1184 /* 1118 /* Set the address length */
1185 * Set the address length 1119
1186 */
1187 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length); 1120 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length);
1188 buffer += 8; 1121 buffer += 8;
1189 1122
1190 /* 1123 /* Resource Source Index and Resource Source are optional */
1191 * Resource Source Index and Resource Source are optional 1124
1192 */
1193 if (0 != linked_list->data.address64.resource_source.string_length) { 1125 if (0 != linked_list->data.address64.resource_source.string_length) {
1194 temp8 = (u8) linked_list->data.address64.resource_source.index; 1126 temp8 = (u8) linked_list->data.address64.resource_source.index;
1195 1127
@@ -1198,21 +1130,21 @@ acpi_rs_address64_stream (
1198 1130
1199 temp_pointer = (char *) buffer; 1131 temp_pointer = (char *) buffer;
1200 1132
1201 /* 1133 /* Copy the string */
1202 * Copy the string 1134
1203 */ 1135 ACPI_STRCPY (temp_pointer,
1204 ACPI_STRCPY (temp_pointer, linked_list->data.address64.resource_source.string_ptr); 1136 linked_list->data.address64.resource_source.string_ptr);
1205 1137
1206 /* 1138 /*
1207 * Buffer needs to be set to the length of the sting + one for the 1139 * Buffer needs to be set to the length of the sting + one for the
1208 * terminating null 1140 * terminating null
1209 */ 1141 */
1210 buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address64.resource_source.string_ptr) + 1); 1142 buffer += (acpi_size)(ACPI_STRLEN (
1143 linked_list->data.address64.resource_source.string_ptr) + 1);
1211 } 1144 }
1212 1145
1213 /* 1146 /* Return the number of bytes consumed in this operation */
1214 * Return the number of bytes consumed in this operation 1147
1215 */
1216 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 1148 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
1217 1149
1218 /* 1150 /*
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c
index 8a5f0a52371d..98176f2fcb5d 100644
--- a/drivers/acpi/resources/rscalc.c
+++ b/drivers/acpi/resources/rscalc.c
@@ -81,9 +81,8 @@ acpi_rs_get_byte_stream_length (
81 81
82 82
83 while (!done) { 83 while (!done) {
84 /* 84 /* Init the variable that will hold the size to add to the total. */
85 * Init the variable that will hold the size to add to the total. 85
86 */
87 segment_size = 0; 86 segment_size = 0;
88 87
89 switch (linked_list->id) { 88 switch (linked_list->id) {
@@ -196,7 +195,8 @@ acpi_rs_get_byte_stream_length (
196 segment_size = 16; 195 segment_size = 16;
197 196
198 if (linked_list->data.address16.resource_source.string_ptr) { 197 if (linked_list->data.address16.resource_source.string_ptr) {
199 segment_size += linked_list->data.address16.resource_source.string_length; 198 segment_size +=
199 linked_list->data.address16.resource_source.string_length;
200 segment_size++; 200 segment_size++;
201 } 201 }
202 break; 202 break;
@@ -212,7 +212,8 @@ acpi_rs_get_byte_stream_length (
212 segment_size = 26; 212 segment_size = 26;
213 213
214 if (linked_list->data.address32.resource_source.string_ptr) { 214 if (linked_list->data.address32.resource_source.string_ptr) {
215 segment_size += linked_list->data.address32.resource_source.string_length; 215 segment_size +=
216 linked_list->data.address32.resource_source.string_length;
216 segment_size++; 217 segment_size++;
217 } 218 }
218 break; 219 break;
@@ -227,7 +228,8 @@ acpi_rs_get_byte_stream_length (
227 segment_size = 46; 228 segment_size = 46;
228 229
229 if (linked_list->data.address64.resource_source.string_ptr) { 230 if (linked_list->data.address64.resource_source.string_ptr) {
230 segment_size += linked_list->data.address64.resource_source.string_length; 231 segment_size +=
232 linked_list->data.address64.resource_source.string_length;
231 segment_size++; 233 segment_size++;
232 } 234 }
233 break; 235 break;
@@ -241,38 +243,36 @@ acpi_rs_get_byte_stream_length (
241 * Index + the length of the null terminated string 243 * Index + the length of the null terminated string
242 * Resource Source + 1 for the null. 244 * Resource Source + 1 for the null.
243 */ 245 */
244 segment_size = 9 + 246 segment_size = 9 + (((acpi_size)
245 (((acpi_size) linked_list->data.extended_irq.number_of_interrupts - 1) * 4); 247 linked_list->data.extended_irq.number_of_interrupts - 1) * 4);
246 248
247 if (linked_list->data.extended_irq.resource_source.string_ptr) { 249 if (linked_list->data.extended_irq.resource_source.string_ptr) {
248 segment_size += linked_list->data.extended_irq.resource_source.string_length; 250 segment_size +=
251 linked_list->data.extended_irq.resource_source.string_length;
249 segment_size++; 252 segment_size++;
250 } 253 }
251 break; 254 break;
252 255
253 default: 256 default:
254 /* 257
255 * If we get here, everything is out of sync, exit with error 258 /* If we get here, everything is out of sync, exit with error */
256 */ 259
257 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); 260 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
258 261
259 } /* switch (linked_list->Id) */ 262 } /* switch (linked_list->Id) */
260 263
261 /* 264 /* Update the total */
262 * Update the total 265
263 */
264 byte_stream_size_needed += segment_size; 266 byte_stream_size_needed += segment_size;
265 267
266 /* 268 /* Point to the next object */
267 * Point to the next object 269
268 */
269 linked_list = ACPI_PTR_ADD (struct acpi_resource, 270 linked_list = ACPI_PTR_ADD (struct acpi_resource,
270 linked_list, linked_list->length); 271 linked_list, linked_list->length);
271 } 272 }
272 273
273 /* 274 /* This is the data the caller needs */
274 * This is the data the caller needs 275
275 */
276 *size_needed = byte_stream_size_needed; 276 *size_needed = byte_stream_size_needed;
277 return_ACPI_STATUS (AE_OK); 277 return_ACPI_STATUS (AE_OK);
278} 278}
@@ -320,9 +320,8 @@ acpi_rs_get_list_length (
320 320
321 321
322 while (bytes_parsed < byte_stream_buffer_length) { 322 while (bytes_parsed < byte_stream_buffer_length) {
323 /* 323 /* The next byte in the stream is the resource type */
324 * The next byte in the stream is the resource type 324
325 */
326 resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); 325 resource_type = acpi_rs_get_resource_type (*byte_stream_buffer);
327 326
328 switch (resource_type) { 327 switch (resource_type) {
@@ -346,9 +345,8 @@ acpi_rs_get_list_length (
346 ACPI_MOVE_16_TO_16 (&temp16, buffer); 345 ACPI_MOVE_16_TO_16 (&temp16, buffer);
347 bytes_consumed = temp16 + 3; 346 bytes_consumed = temp16 + 3;
348 347
349 /* 348 /* Ensure a 32-bit boundary for the structure */
350 * Ensure a 32-bit boundary for the structure 349
351 */
352 temp16 = (u16) ACPI_ROUND_UP_to_32_bITS (temp16); 350 temp16 = (u16) ACPI_ROUND_UP_to_32_bITS (temp16);
353 351
354 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + 352 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) +
@@ -416,9 +414,8 @@ acpi_rs_get_list_length (
416 temp8 = 0; 414 temp8 = 0;
417 } 415 }
418 416
419 /* 417 /* Ensure a 64-bit boundary for the structure */
420 * Ensure a 64-bit boundary for the structure 418
421 */
422 temp8 = (u8) ACPI_ROUND_UP_to_64_bITS (temp8); 419 temp8 = (u8) ACPI_ROUND_UP_to_64_bITS (temp8);
423 420
424 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64) + 421 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64) +
@@ -452,9 +449,8 @@ acpi_rs_get_list_length (
452 temp8 = 0; 449 temp8 = 0;
453 } 450 }
454 451
455 /* 452 /* Ensure a 32-bit boundary for the structure */
456 * Ensure a 32-bit boundary for the structure 453
457 */
458 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); 454 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
459 455
460 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32) + 456 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32) +
@@ -488,9 +484,8 @@ acpi_rs_get_list_length (
488 temp8 = 0; 484 temp8 = 0;
489 } 485 }
490 486
491 /* 487 /* Ensure a 32-bit boundary for the structure */
492 * Ensure a 32-bit boundary for the structure 488
493 */
494 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); 489 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
495 490
496 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16) + 491 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16) +
@@ -537,9 +532,8 @@ acpi_rs_get_list_length (
537 temp8 = 0; 532 temp8 = 0;
538 } 533 }
539 534
540 /* 535 /* Ensure a 32-bit boundary for the structure */
541 * Ensure a 32-bit boundary for the structure 536
542 */
543 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); 537 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
544 538
545 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq) + 539 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq) +
@@ -567,9 +561,8 @@ acpi_rs_get_list_length (
567 561
568 ++buffer; 562 ++buffer;
569 563
570 /* 564 /* Look at the number of bits set */
571 * Look at the number of bits set 565
572 */
573 ACPI_MOVE_16_TO_16 (&temp16, buffer); 566 ACPI_MOVE_16_TO_16 (&temp16, buffer);
574 567
575 for (index = 0; index < 16; index++) { 568 for (index = 0; index < 16; index++) {
@@ -596,9 +589,8 @@ acpi_rs_get_list_length (
596 589
597 ++buffer; 590 ++buffer;
598 591
599 /* 592 /* Look at the number of bits set */
600 * Look at the number of bits set 593
601 */
602 temp8 = *buffer; 594 temp8 = *buffer;
603 595
604 for(index = 0; index < 8; index++) { 596 for(index = 0; index < 8; index++) {
@@ -670,9 +662,8 @@ acpi_rs_get_list_length (
670 temp8 = (u8) (temp8 & 0x7); 662 temp8 = (u8) (temp8 & 0x7);
671 bytes_consumed = temp8 + 1; 663 bytes_consumed = temp8 + 1;
672 664
673 /* 665 /* Ensure a 32-bit boundary for the structure */
674 * Ensure a 32-bit boundary for the structure 666
675 */
676 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); 667 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
677 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + 668 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) +
678 (temp8 * sizeof (u8)); 669 (temp8 * sizeof (u8));
@@ -697,21 +688,18 @@ acpi_rs_get_list_length (
697 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); 688 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
698 } 689 }
699 690
700 /* 691 /* Update the return value and counter */
701 * Update the return value and counter 692
702 */
703 buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE (structure_size); 693 buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE (structure_size);
704 bytes_parsed += bytes_consumed; 694 bytes_parsed += bytes_consumed;
705 695
706 /* 696 /* Set the byte stream to point to the next resource */
707 * Set the byte stream to point to the next resource 697
708 */
709 byte_stream_buffer += bytes_consumed; 698 byte_stream_buffer += bytes_consumed;
710 } 699 }
711 700
712 /* 701 /* This is the data the caller needs */
713 * This is the data the caller needs 702
714 */
715 *size_needed = buffer_size; 703 *size_needed = buffer_size;
716 return_ACPI_STATUS (AE_OK); 704 return_ACPI_STATUS (AE_OK);
717} 705}
@@ -767,9 +755,8 @@ acpi_rs_get_pci_routing_table_length (
767 top_object_list = package_object->package.elements; 755 top_object_list = package_object->package.elements;
768 756
769 for (index = 0; index < number_of_elements; index++) { 757 for (index = 0; index < number_of_elements; index++) {
770 /* 758 /* Dereference the sub-package */
771 * Dereference the sub-package 759
772 */
773 package_element = *top_object_list; 760 package_element = *top_object_list;
774 761
775 /* 762 /*
@@ -778,37 +765,40 @@ acpi_rs_get_pci_routing_table_length (
778 */ 765 */
779 sub_object_list = package_element->package.elements; 766 sub_object_list = package_element->package.elements;
780 767
781 /* 768 /* Scan the irq_table_elements for the Source Name String */
782 * Scan the irq_table_elements for the Source Name String 769
783 */
784 name_found = FALSE; 770 name_found = FALSE;
785 771
786 for (table_index = 0; table_index < 4 && !name_found; table_index++) { 772 for (table_index = 0; table_index < 4 && !name_found; table_index++) {
787 if ((ACPI_TYPE_STRING == ACPI_GET_OBJECT_TYPE (*sub_object_list)) || 773 if ((ACPI_TYPE_STRING ==
788 ((ACPI_TYPE_LOCAL_REFERENCE == ACPI_GET_OBJECT_TYPE (*sub_object_list)) && 774 ACPI_GET_OBJECT_TYPE (*sub_object_list)) ||
789 ((*sub_object_list)->reference.opcode == AML_INT_NAMEPATH_OP))) { 775
776 ((ACPI_TYPE_LOCAL_REFERENCE ==
777 ACPI_GET_OBJECT_TYPE (*sub_object_list)) &&
778
779 ((*sub_object_list)->reference.opcode ==
780 AML_INT_NAMEPATH_OP))) {
790 name_found = TRUE; 781 name_found = TRUE;
791 } 782 }
792 else { 783 else {
793 /* 784 /* Look at the next element */
794 * Look at the next element 785
795 */
796 sub_object_list++; 786 sub_object_list++;
797 } 787 }
798 } 788 }
799 789
800 temp_size_needed += (sizeof (struct acpi_pci_routing_table) - 4); 790 temp_size_needed += (sizeof (struct acpi_pci_routing_table) - 4);
801 791
802 /* 792 /* Was a String type found? */
803 * Was a String type found? 793
804 */
805 if (name_found) { 794 if (name_found) {
806 if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) { 795 if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) {
807 /* 796 /*
808 * The length String.Length field does not include the 797 * The length String.Length field does not include the
809 * terminating NULL, add 1 798 * terminating NULL, add 1
810 */ 799 */
811 temp_size_needed += ((acpi_size) (*sub_object_list)->string.length + 1); 800 temp_size_needed += ((acpi_size)
801 (*sub_object_list)->string.length + 1);
812 } 802 }
813 else { 803 else {
814 temp_size_needed += acpi_ns_get_pathname_length ( 804 temp_size_needed += acpi_ns_get_pathname_length (
@@ -827,14 +817,14 @@ acpi_rs_get_pci_routing_table_length (
827 817
828 temp_size_needed = ACPI_ROUND_UP_to_64_bITS (temp_size_needed); 818 temp_size_needed = ACPI_ROUND_UP_to_64_bITS (temp_size_needed);
829 819
830 /* 820 /* Point to the next union acpi_operand_object */
831 * Point to the next union acpi_operand_object 821
832 */
833 top_object_list++; 822 top_object_list++;
834 } 823 }
835 824
836 /* 825 /*
837 * Adding an extra element to the end of the list, essentially a NULL terminator 826 * Adding an extra element to the end of the list, essentially a
827 * NULL terminator
838 */ 828 */
839 *buffer_size_needed = temp_size_needed + sizeof (struct acpi_pci_routing_table); 829 *buffer_size_needed = temp_size_needed + sizeof (struct acpi_pci_routing_table);
840 return_ACPI_STATUS (AE_OK); 830 return_ACPI_STATUS (AE_OK);
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c
index a3a0cbfda68d..8e0eae0d50bb 100644
--- a/drivers/acpi/resources/rscreate.c
+++ b/drivers/acpi/resources/rscreate.c
@@ -87,9 +87,8 @@ acpi_rs_create_resource_list (
87 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n", 87 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n",
88 byte_stream_buffer)); 88 byte_stream_buffer));
89 89
90 /* 90 /* Params already validated, so we don't re-validate here */
91 * Params already validated, so we don't re-validate here 91
92 */
93 byte_stream_buffer_length = byte_stream_buffer->buffer.length; 92 byte_stream_buffer_length = byte_stream_buffer->buffer.length;
94 byte_stream_start = byte_stream_buffer->buffer.pointer; 93 byte_stream_start = byte_stream_buffer->buffer.pointer;
95 94
@@ -171,9 +170,8 @@ acpi_rs_create_pci_routing_table (
171 170
172 /* Params already validated, so we don't re-validate here */ 171 /* Params already validated, so we don't re-validate here */
173 172
174 /* 173 /* Get the required buffer length */
175 * Get the required buffer length 174
176 */
177 status = acpi_rs_get_pci_routing_table_length (package_object, 175 status = acpi_rs_get_pci_routing_table_length (package_object,
178 &buffer_size_needed); 176 &buffer_size_needed);
179 if (ACPI_FAILURE (status)) { 177 if (ACPI_FAILURE (status)) {
@@ -217,9 +215,8 @@ acpi_rs_create_pci_routing_table (
217 */ 215 */
218 user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4); 216 user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4);
219 217
220 /* 218 /* Each element of the top-level package must also be a package */
221 * Each element of the top-level package must also be a package 219
222 */
223 if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) { 220 if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) {
224 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 221 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
225 "(PRT[%X]) Need sub-package, found %s\n", 222 "(PRT[%X]) Need sub-package, found %s\n",
@@ -243,9 +240,8 @@ acpi_rs_create_pci_routing_table (
243 */ 240 */
244 sub_object_list = (*top_object_list)->package.elements; 241 sub_object_list = (*top_object_list)->package.elements;
245 242
246 /* 243 /* 1) First subobject: Dereference the PRT.Address */
247 * 1) First subobject: Dereference the PRT.Address 244
248 */
249 obj_desc = sub_object_list[0]; 245 obj_desc = sub_object_list[0];
250 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { 246 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
251 user_prt->address = obj_desc->integer.value; 247 user_prt->address = obj_desc->integer.value;
@@ -257,9 +253,8 @@ acpi_rs_create_pci_routing_table (
257 return_ACPI_STATUS (AE_BAD_DATA); 253 return_ACPI_STATUS (AE_BAD_DATA);
258 } 254 }
259 255
260 /* 256 /* 2) Second subobject: Dereference the PRT.Pin */
261 * 2) Second subobject: Dereference the PRT.Pin 257
262 */
263 obj_desc = sub_object_list[1]; 258 obj_desc = sub_object_list[1];
264 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { 259 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
265 user_prt->pin = (u32) obj_desc->integer.value; 260 user_prt->pin = (u32) obj_desc->integer.value;
@@ -271,9 +266,8 @@ acpi_rs_create_pci_routing_table (
271 return_ACPI_STATUS (AE_BAD_DATA); 266 return_ACPI_STATUS (AE_BAD_DATA);
272 } 267 }
273 268
274 /* 269 /* 3) Third subobject: Dereference the PRT.source_name */
275 * 3) Third subobject: Dereference the PRT.source_name 270
276 */
277 obj_desc = sub_object_list[2]; 271 obj_desc = sub_object_list[2];
278 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { 272 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
279 case ACPI_TYPE_LOCAL_REFERENCE: 273 case ACPI_TYPE_LOCAL_REFERENCE:
@@ -296,7 +290,9 @@ acpi_rs_create_pci_routing_table (
296 290
297 status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer); 291 status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer);
298 292
299 user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1; /* include null terminator */ 293 /* +1 to include null terminator */
294
295 user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1;
300 break; 296 break;
301 297
302 298
@@ -304,8 +300,10 @@ acpi_rs_create_pci_routing_table (
304 300
305 ACPI_STRCPY (user_prt->source, obj_desc->string.pointer); 301 ACPI_STRCPY (user_prt->source, obj_desc->string.pointer);
306 302
307 /* Add to the Length field the length of the string (add 1 for terminator) */ 303 /*
308 304 * Add to the Length field the length of the string
305 * (add 1 for terminator)
306 */
309 user_prt->length += obj_desc->string.length + 1; 307 user_prt->length += obj_desc->string.length + 1;
310 break; 308 break;
311 309
@@ -333,9 +331,8 @@ acpi_rs_create_pci_routing_table (
333 331
334 user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length); 332 user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length);
335 333
336 /* 334 /* 4) Fourth subobject: Dereference the PRT.source_index */
337 * 4) Fourth subobject: Dereference the PRT.source_index 335
338 */
339 obj_desc = sub_object_list[3]; 336 obj_desc = sub_object_list[3];
340 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { 337 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
341 user_prt->source_index = (u32) obj_desc->integer.value; 338 user_prt->source_index = (u32) obj_desc->integer.value;
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c
index eef1b1f2c685..1935dab2ab51 100644
--- a/drivers/acpi/resources/rsdump.c
+++ b/drivers/acpi/resources/rsdump.c
@@ -48,9 +48,62 @@
48#define _COMPONENT ACPI_RESOURCES 48#define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME ("rsdump") 49 ACPI_MODULE_NAME ("rsdump")
50 50
51/* Local prototypes */
51 52
52#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 53static void
54acpi_rs_dump_irq (
55 union acpi_resource_data *data);
56
57static void
58acpi_rs_dump_address16 (
59 union acpi_resource_data *data);
60
61static void
62acpi_rs_dump_address32 (
63 union acpi_resource_data *data);
64
65static void
66acpi_rs_dump_address64 (
67 union acpi_resource_data *data);
68
69static void
70acpi_rs_dump_dma (
71 union acpi_resource_data *data);
72
73static void
74acpi_rs_dump_io (
75 union acpi_resource_data *data);
76
77static void
78acpi_rs_dump_extended_irq (
79 union acpi_resource_data *data);
53 80
81static void
82acpi_rs_dump_fixed_io (
83 union acpi_resource_data *data);
84
85static void
86acpi_rs_dump_fixed_memory32 (
87 union acpi_resource_data *data);
88
89static void
90acpi_rs_dump_memory24 (
91 union acpi_resource_data *data);
92
93static void
94acpi_rs_dump_memory32 (
95 union acpi_resource_data *data);
96
97static void
98acpi_rs_dump_start_depend_fns (
99 union acpi_resource_data *data);
100
101static void
102acpi_rs_dump_vendor_specific (
103 union acpi_resource_data *data);
104
105
106#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
54/******************************************************************************* 107/*******************************************************************************
55 * 108 *
56 * FUNCTION: acpi_rs_dump_irq 109 * FUNCTION: acpi_rs_dump_irq
@@ -63,7 +116,7 @@
63 * 116 *
64 ******************************************************************************/ 117 ******************************************************************************/
65 118
66void 119static void
67acpi_rs_dump_irq ( 120acpi_rs_dump_irq (
68 union acpi_resource_data *data) 121 union acpi_resource_data *data)
69{ 122{
@@ -77,13 +130,13 @@ acpi_rs_dump_irq (
77 acpi_os_printf ("IRQ Resource\n"); 130 acpi_os_printf ("IRQ Resource\n");
78 131
79 acpi_os_printf (" %s Triggered\n", 132 acpi_os_printf (" %s Triggered\n",
80 ACPI_LEVEL_SENSITIVE == irq_data->edge_level ? "Level" : "Edge"); 133 ACPI_LEVEL_SENSITIVE == irq_data->edge_level ? "Level" : "Edge");
81 134
82 acpi_os_printf (" Active %s\n", 135 acpi_os_printf (" Active %s\n",
83 ACPI_ACTIVE_LOW == irq_data->active_high_low ? "Low" : "High"); 136 ACPI_ACTIVE_LOW == irq_data->active_high_low ? "Low" : "High");
84 137
85 acpi_os_printf (" %s\n", 138 acpi_os_printf (" %s\n",
86 ACPI_SHARED == irq_data->shared_exclusive ? "Shared" : "Exclusive"); 139 ACPI_SHARED == irq_data->shared_exclusive ? "Shared" : "Exclusive");
87 140
88 acpi_os_printf (" %X Interrupts ( ", irq_data->number_of_interrupts); 141 acpi_os_printf (" %X Interrupts ( ", irq_data->number_of_interrupts);
89 142
@@ -108,7 +161,7 @@ acpi_rs_dump_irq (
108 * 161 *
109 ******************************************************************************/ 162 ******************************************************************************/
110 163
111void 164static void
112acpi_rs_dump_dma ( 165acpi_rs_dump_dma (
113 union acpi_resource_data *data) 166 union acpi_resource_data *data)
114{ 167{
@@ -144,7 +197,7 @@ acpi_rs_dump_dma (
144 } 197 }
145 198
146 acpi_os_printf (" %sBus Master\n", 199 acpi_os_printf (" %sBus Master\n",
147 ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a "); 200 ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a ");
148 201
149 202
150 switch (dma_data->transfer) { 203 switch (dma_data->transfer) {
@@ -165,7 +218,8 @@ acpi_rs_dump_dma (
165 break; 218 break;
166 } 219 }
167 220
168 acpi_os_printf (" Number of Channels: %X ( ", dma_data->number_of_channels); 221 acpi_os_printf (" Number of Channels: %X ( ",
222 dma_data->number_of_channels);
169 223
170 for (index = 0; index < dma_data->number_of_channels; index++) { 224 for (index = 0; index < dma_data->number_of_channels; index++) {
171 acpi_os_printf ("%X ", dma_data->channels[index]); 225 acpi_os_printf ("%X ", dma_data->channels[index]);
@@ -188,7 +242,7 @@ acpi_rs_dump_dma (
188 * 242 *
189 ******************************************************************************/ 243 ******************************************************************************/
190 244
191void 245static void
192acpi_rs_dump_start_depend_fns ( 246acpi_rs_dump_start_depend_fns (
193 union acpi_resource_data *data) 247 union acpi_resource_data *data)
194{ 248{
@@ -232,8 +286,7 @@ acpi_rs_dump_start_depend_fns (
232 break; 286 break;
233 287
234 default: 288 default:
235 acpi_os_printf (" Invalid performance " 289 acpi_os_printf (" Invalid performance robustness preference\n");
236 "robustness preference\n");
237 break; 290 break;
238 } 291 }
239 292
@@ -253,7 +306,7 @@ acpi_rs_dump_start_depend_fns (
253 * 306 *
254 ******************************************************************************/ 307 ******************************************************************************/
255 308
256void 309static void
257acpi_rs_dump_io ( 310acpi_rs_dump_io (
258 union acpi_resource_data *data) 311 union acpi_resource_data *data)
259{ 312{
@@ -266,19 +319,15 @@ acpi_rs_dump_io (
266 acpi_os_printf ("Io Resource\n"); 319 acpi_os_printf ("Io Resource\n");
267 320
268 acpi_os_printf (" %d bit decode\n", 321 acpi_os_printf (" %d bit decode\n",
269 ACPI_DECODE_16 == io_data->io_decode ? 16 : 10); 322 ACPI_DECODE_16 == io_data->io_decode ? 16 : 10);
270 323
271 acpi_os_printf (" Range minimum base: %08X\n", 324 acpi_os_printf (" Range minimum base: %08X\n", io_data->min_base_address);
272 io_data->min_base_address);
273 325
274 acpi_os_printf (" Range maximum base: %08X\n", 326 acpi_os_printf (" Range maximum base: %08X\n", io_data->max_base_address);
275 io_data->max_base_address);
276 327
277 acpi_os_printf (" Alignment: %08X\n", 328 acpi_os_printf (" Alignment: %08X\n", io_data->alignment);
278 io_data->alignment);
279 329
280 acpi_os_printf (" Range Length: %08X\n", 330 acpi_os_printf (" Range Length: %08X\n", io_data->range_length);
281 io_data->range_length);
282 331
283 return; 332 return;
284} 333}
@@ -296,7 +345,7 @@ acpi_rs_dump_io (
296 * 345 *
297 ******************************************************************************/ 346 ******************************************************************************/
298 347
299void 348static void
300acpi_rs_dump_fixed_io ( 349acpi_rs_dump_fixed_io (
301 union acpi_resource_data *data) 350 union acpi_resource_data *data)
302{ 351{
@@ -307,11 +356,9 @@ acpi_rs_dump_fixed_io (
307 356
308 357
309 acpi_os_printf ("Fixed Io Resource\n"); 358 acpi_os_printf ("Fixed Io Resource\n");
310 acpi_os_printf (" Range base address: %08X", 359 acpi_os_printf (" Range base address: %08X", fixed_io_data->base_address);
311 fixed_io_data->base_address);
312 360
313 acpi_os_printf (" Range length: %08X", 361 acpi_os_printf (" Range length: %08X", fixed_io_data->range_length);
314 fixed_io_data->range_length);
315 362
316 return; 363 return;
317} 364}
@@ -329,7 +376,7 @@ acpi_rs_dump_fixed_io (
329 * 376 *
330 ******************************************************************************/ 377 ******************************************************************************/
331 378
332void 379static void
333acpi_rs_dump_vendor_specific ( 380acpi_rs_dump_vendor_specific (
334 union acpi_resource_data *data) 381 union acpi_resource_data *data)
335{ 382{
@@ -346,7 +393,7 @@ acpi_rs_dump_vendor_specific (
346 393
347 for (index = 0; index < vendor_data->length; index++) { 394 for (index = 0; index < vendor_data->length; index++) {
348 acpi_os_printf (" Byte %X: %08X\n", 395 acpi_os_printf (" Byte %X: %08X\n",
349 index, vendor_data->reserved[index]); 396 index, vendor_data->reserved[index]);
350 } 397 }
351 398
352 return; 399 return;
@@ -365,7 +412,7 @@ acpi_rs_dump_vendor_specific (
365 * 412 *
366 ******************************************************************************/ 413 ******************************************************************************/
367 414
368void 415static void
369acpi_rs_dump_memory24 ( 416acpi_rs_dump_memory24 (
370 union acpi_resource_data *data) 417 union acpi_resource_data *data)
371{ 418{
@@ -378,21 +425,19 @@ acpi_rs_dump_memory24 (
378 acpi_os_printf ("24-Bit Memory Range Resource\n"); 425 acpi_os_printf ("24-Bit Memory Range Resource\n");
379 426
380 acpi_os_printf (" Read%s\n", 427 acpi_os_printf (" Read%s\n",
381 ACPI_READ_WRITE_MEMORY == 428 ACPI_READ_WRITE_MEMORY ==
382 memory24_data->read_write_attribute ? 429 memory24_data->read_write_attribute ?
383 "/Write" : " only"); 430 "/Write" : " only");
384 431
385 acpi_os_printf (" Range minimum base: %08X\n", 432 acpi_os_printf (" Range minimum base: %08X\n",
386 memory24_data->min_base_address); 433 memory24_data->min_base_address);
387 434
388 acpi_os_printf (" Range maximum base: %08X\n", 435 acpi_os_printf (" Range maximum base: %08X\n",
389 memory24_data->max_base_address); 436 memory24_data->max_base_address);
390 437
391 acpi_os_printf (" Alignment: %08X\n", 438 acpi_os_printf (" Alignment: %08X\n", memory24_data->alignment);
392 memory24_data->alignment);
393 439
394 acpi_os_printf (" Range length: %08X\n", 440 acpi_os_printf (" Range length: %08X\n", memory24_data->range_length);
395 memory24_data->range_length);
396 441
397 return; 442 return;
398} 443}
@@ -410,7 +455,7 @@ acpi_rs_dump_memory24 (
410 * 455 *
411 ******************************************************************************/ 456 ******************************************************************************/
412 457
413void 458static void
414acpi_rs_dump_memory32 ( 459acpi_rs_dump_memory32 (
415 union acpi_resource_data *data) 460 union acpi_resource_data *data)
416{ 461{
@@ -423,21 +468,19 @@ acpi_rs_dump_memory32 (
423 acpi_os_printf ("32-Bit Memory Range Resource\n"); 468 acpi_os_printf ("32-Bit Memory Range Resource\n");
424 469
425 acpi_os_printf (" Read%s\n", 470 acpi_os_printf (" Read%s\n",
426 ACPI_READ_WRITE_MEMORY == 471 ACPI_READ_WRITE_MEMORY ==
427 memory32_data->read_write_attribute ? 472 memory32_data->read_write_attribute ?
428 "/Write" : " only"); 473 "/Write" : " only");
429 474
430 acpi_os_printf (" Range minimum base: %08X\n", 475 acpi_os_printf (" Range minimum base: %08X\n",
431 memory32_data->min_base_address); 476 memory32_data->min_base_address);
432 477
433 acpi_os_printf (" Range maximum base: %08X\n", 478 acpi_os_printf (" Range maximum base: %08X\n",
434 memory32_data->max_base_address); 479 memory32_data->max_base_address);
435 480
436 acpi_os_printf (" Alignment: %08X\n", 481 acpi_os_printf (" Alignment: %08X\n", memory32_data->alignment);
437 memory32_data->alignment);
438 482
439 acpi_os_printf (" Range length: %08X\n", 483 acpi_os_printf (" Range length: %08X\n", memory32_data->range_length);
440 memory32_data->range_length);
441 484
442 return; 485 return;
443} 486}
@@ -455,11 +498,12 @@ acpi_rs_dump_memory32 (
455 * 498 *
456 ******************************************************************************/ 499 ******************************************************************************/
457 500
458void 501static void
459acpi_rs_dump_fixed_memory32 ( 502acpi_rs_dump_fixed_memory32 (
460 union acpi_resource_data *data) 503 union acpi_resource_data *data)
461{ 504{
462 struct acpi_resource_fixed_mem32 *fixed_memory32_data = (struct acpi_resource_fixed_mem32 *) data; 505 struct acpi_resource_fixed_mem32 *fixed_memory32_data =
506 (struct acpi_resource_fixed_mem32 *) data;
463 507
464 508
465 ACPI_FUNCTION_ENTRY (); 509 ACPI_FUNCTION_ENTRY ();
@@ -468,15 +512,14 @@ acpi_rs_dump_fixed_memory32 (
468 acpi_os_printf ("32-Bit Fixed Location Memory Range Resource\n"); 512 acpi_os_printf ("32-Bit Fixed Location Memory Range Resource\n");
469 513
470 acpi_os_printf (" Read%s\n", 514 acpi_os_printf (" Read%s\n",
471 ACPI_READ_WRITE_MEMORY == 515 ACPI_READ_WRITE_MEMORY ==
472 fixed_memory32_data->read_write_attribute ? 516 fixed_memory32_data->read_write_attribute ? "/Write" : " Only");
473 "/Write" : " Only");
474 517
475 acpi_os_printf (" Range base address: %08X\n", 518 acpi_os_printf (" Range base address: %08X\n",
476 fixed_memory32_data->range_base_address); 519 fixed_memory32_data->range_base_address);
477 520
478 acpi_os_printf (" Range length: %08X\n", 521 acpi_os_printf (" Range length: %08X\n",
479 fixed_memory32_data->range_length); 522 fixed_memory32_data->range_length);
480 523
481 return; 524 return;
482} 525}
@@ -494,7 +537,7 @@ acpi_rs_dump_fixed_memory32 (
494 * 537 *
495 ******************************************************************************/ 538 ******************************************************************************/
496 539
497void 540static void
498acpi_rs_dump_address16 ( 541acpi_rs_dump_address16 (
499 union acpi_resource_data *data) 542 union acpi_resource_data *data)
500{ 543{
@@ -514,35 +557,30 @@ acpi_rs_dump_address16 (
514 557
515 switch (address16_data->attribute.memory.cache_attribute) { 558 switch (address16_data->attribute.memory.cache_attribute) {
516 case ACPI_NON_CACHEABLE_MEMORY: 559 case ACPI_NON_CACHEABLE_MEMORY:
517 acpi_os_printf (" Type Specific: " 560 acpi_os_printf (" Type Specific: Noncacheable memory\n");
518 "Noncacheable memory\n");
519 break; 561 break;
520 562
521 case ACPI_CACHABLE_MEMORY: 563 case ACPI_CACHABLE_MEMORY:
522 acpi_os_printf (" Type Specific: " 564 acpi_os_printf (" Type Specific: Cacheable memory\n");
523 "Cacheable memory\n");
524 break; 565 break;
525 566
526 case ACPI_WRITE_COMBINING_MEMORY: 567 case ACPI_WRITE_COMBINING_MEMORY:
527 acpi_os_printf (" Type Specific: " 568 acpi_os_printf (" Type Specific: Write-combining memory\n");
528 "Write-combining memory\n");
529 break; 569 break;
530 570
531 case ACPI_PREFETCHABLE_MEMORY: 571 case ACPI_PREFETCHABLE_MEMORY:
532 acpi_os_printf (" Type Specific: " 572 acpi_os_printf (" Type Specific: Prefetchable memory\n");
533 "Prefetchable memory\n");
534 break; 573 break;
535 574
536 default: 575 default:
537 acpi_os_printf (" Type Specific: " 576 acpi_os_printf (" Type Specific: Invalid cache attribute\n");
538 "Invalid cache attribute\n");
539 break; 577 break;
540 } 578 }
541 579
542 acpi_os_printf (" Type Specific: Read%s\n", 580 acpi_os_printf (" Type Specific: Read%s\n",
543 ACPI_READ_WRITE_MEMORY == 581 ACPI_READ_WRITE_MEMORY ==
544 address16_data->attribute.memory.read_write_attribute ? 582 address16_data->attribute.memory.read_write_attribute ?
545 "/Write" : " Only"); 583 "/Write" : " Only");
546 break; 584 break;
547 585
548 case ACPI_IO_RANGE: 586 case ACPI_IO_RANGE:
@@ -551,30 +589,26 @@ acpi_rs_dump_address16 (
551 589
552 switch (address16_data->attribute.io.range_attribute) { 590 switch (address16_data->attribute.io.range_attribute) {
553 case ACPI_NON_ISA_ONLY_RANGES: 591 case ACPI_NON_ISA_ONLY_RANGES:
554 acpi_os_printf (" Type Specific: " 592 acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n");
555 "Non-ISA Io Addresses\n");
556 break; 593 break;
557 594
558 case ACPI_ISA_ONLY_RANGES: 595 case ACPI_ISA_ONLY_RANGES:
559 acpi_os_printf (" Type Specific: " 596 acpi_os_printf (" Type Specific: ISA Io Addresses\n");
560 "ISA Io Addresses\n");
561 break; 597 break;
562 598
563 case ACPI_ENTIRE_RANGE: 599 case ACPI_ENTIRE_RANGE:
564 acpi_os_printf (" Type Specific: " 600 acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n");
565 "ISA and non-ISA Io Addresses\n");
566 break; 601 break;
567 602
568 default: 603 default:
569 acpi_os_printf (" Type Specific: " 604 acpi_os_printf (" Type Specific: Invalid range attribute\n");
570 "Invalid range attribute\n");
571 break; 605 break;
572 } 606 }
573 607
574 acpi_os_printf (" Type Specific: %s Translation\n", 608 acpi_os_printf (" Type Specific: %s Translation\n",
575 ACPI_SPARSE_TRANSLATION == 609 ACPI_SPARSE_TRANSLATION ==
576 address16_data->attribute.io.translation_attribute ? 610 address16_data->attribute.io.translation_attribute ?
577 "Sparse" : "Dense"); 611 "Sparse" : "Dense");
578 break; 612 break;
579 613
580 case ACPI_BUS_NUMBER_RANGE: 614 case ACPI_BUS_NUMBER_RANGE:
@@ -589,41 +623,42 @@ acpi_rs_dump_address16 (
589 } 623 }
590 624
591 acpi_os_printf (" Resource %s\n", 625 acpi_os_printf (" Resource %s\n",
592 ACPI_CONSUMER == address16_data->producer_consumer ? 626 ACPI_CONSUMER == address16_data->producer_consumer ?
593 "Consumer" : "Producer"); 627 "Consumer" : "Producer");
594 628
595 acpi_os_printf (" %s decode\n", 629 acpi_os_printf (" %s decode\n",
596 ACPI_SUB_DECODE == address16_data->decode ? 630 ACPI_SUB_DECODE == address16_data->decode ?
597 "Subtractive" : "Positive"); 631 "Subtractive" : "Positive");
598 632
599 acpi_os_printf (" Min address is %s fixed\n", 633 acpi_os_printf (" Min address is %s fixed\n",
600 ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ? 634 ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ?
601 "" : "not"); 635 "" : "not");
602 636
603 acpi_os_printf (" Max address is %s fixed\n", 637 acpi_os_printf (" Max address is %s fixed\n",
604 ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ? 638 ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ?
605 "" : "not"); 639 "" : "not");
606 640
607 acpi_os_printf (" Granularity: %08X\n", 641 acpi_os_printf (" Granularity: %08X\n",
608 address16_data->granularity); 642 address16_data->granularity);
609 643
610 acpi_os_printf (" Address range min: %08X\n", 644 acpi_os_printf (" Address range min: %08X\n",
611 address16_data->min_address_range); 645 address16_data->min_address_range);
612 646
613 acpi_os_printf (" Address range max: %08X\n", 647 acpi_os_printf (" Address range max: %08X\n",
614 address16_data->max_address_range); 648 address16_data->max_address_range);
615 649
616 acpi_os_printf (" Address translation offset: %08X\n", 650 acpi_os_printf (" Address translation offset: %08X\n",
617 address16_data->address_translation_offset); 651 address16_data->address_translation_offset);
618 652
619 acpi_os_printf (" Address Length: %08X\n", 653 acpi_os_printf (" Address Length: %08X\n",
620 address16_data->address_length); 654 address16_data->address_length);
621 655
622 if (0xFF != address16_data->resource_source.index) { 656 if (0xFF != address16_data->resource_source.index) {
623 acpi_os_printf (" Resource Source Index: %X\n", 657 acpi_os_printf (" Resource Source Index: %X\n",
624 address16_data->resource_source.index); 658 address16_data->resource_source.index);
659
625 acpi_os_printf (" Resource Source: %s\n", 660 acpi_os_printf (" Resource Source: %s\n",
626 address16_data->resource_source.string_ptr); 661 address16_data->resource_source.string_ptr);
627 } 662 }
628 663
629 return; 664 return;
@@ -642,7 +677,7 @@ acpi_rs_dump_address16 (
642 * 677 *
643 ******************************************************************************/ 678 ******************************************************************************/
644 679
645void 680static void
646acpi_rs_dump_address32 ( 681acpi_rs_dump_address32 (
647 union acpi_resource_data *data) 682 union acpi_resource_data *data)
648{ 683{
@@ -661,35 +696,30 @@ acpi_rs_dump_address32 (
661 696
662 switch (address32_data->attribute.memory.cache_attribute) { 697 switch (address32_data->attribute.memory.cache_attribute) {
663 case ACPI_NON_CACHEABLE_MEMORY: 698 case ACPI_NON_CACHEABLE_MEMORY:
664 acpi_os_printf (" Type Specific: " 699 acpi_os_printf (" Type Specific: Noncacheable memory\n");
665 "Noncacheable memory\n");
666 break; 700 break;
667 701
668 case ACPI_CACHABLE_MEMORY: 702 case ACPI_CACHABLE_MEMORY:
669 acpi_os_printf (" Type Specific: " 703 acpi_os_printf (" Type Specific: Cacheable memory\n");
670 "Cacheable memory\n");
671 break; 704 break;
672 705
673 case ACPI_WRITE_COMBINING_MEMORY: 706 case ACPI_WRITE_COMBINING_MEMORY:
674 acpi_os_printf (" Type Specific: " 707 acpi_os_printf (" Type Specific: Write-combining memory\n");
675 "Write-combining memory\n");
676 break; 708 break;
677 709
678 case ACPI_PREFETCHABLE_MEMORY: 710 case ACPI_PREFETCHABLE_MEMORY:
679 acpi_os_printf (" Type Specific: " 711 acpi_os_printf (" Type Specific: Prefetchable memory\n");
680 "Prefetchable memory\n");
681 break; 712 break;
682 713
683 default: 714 default:
684 acpi_os_printf (" Type Specific: " 715 acpi_os_printf (" Type Specific: Invalid cache attribute\n");
685 "Invalid cache attribute\n");
686 break; 716 break;
687 } 717 }
688 718
689 acpi_os_printf (" Type Specific: Read%s\n", 719 acpi_os_printf (" Type Specific: Read%s\n",
690 ACPI_READ_WRITE_MEMORY == 720 ACPI_READ_WRITE_MEMORY ==
691 address32_data->attribute.memory.read_write_attribute ? 721 address32_data->attribute.memory.read_write_attribute ?
692 "/Write" : " Only"); 722 "/Write" : " Only");
693 break; 723 break;
694 724
695 case ACPI_IO_RANGE: 725 case ACPI_IO_RANGE:
@@ -698,30 +728,26 @@ acpi_rs_dump_address32 (
698 728
699 switch (address32_data->attribute.io.range_attribute) { 729 switch (address32_data->attribute.io.range_attribute) {
700 case ACPI_NON_ISA_ONLY_RANGES: 730 case ACPI_NON_ISA_ONLY_RANGES:
701 acpi_os_printf (" Type Specific: " 731 acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n");
702 "Non-ISA Io Addresses\n");
703 break; 732 break;
704 733
705 case ACPI_ISA_ONLY_RANGES: 734 case ACPI_ISA_ONLY_RANGES:
706 acpi_os_printf (" Type Specific: " 735 acpi_os_printf (" Type Specific: ISA Io Addresses\n");
707 "ISA Io Addresses\n");
708 break; 736 break;
709 737
710 case ACPI_ENTIRE_RANGE: 738 case ACPI_ENTIRE_RANGE:
711 acpi_os_printf (" Type Specific: " 739 acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n");
712 "ISA and non-ISA Io Addresses\n");
713 break; 740 break;
714 741
715 default: 742 default:
716 acpi_os_printf (" Type Specific: " 743 acpi_os_printf (" Type Specific: Invalid Range attribute");
717 "Invalid Range attribute");
718 break; 744 break;
719 } 745 }
720 746
721 acpi_os_printf (" Type Specific: %s Translation\n", 747 acpi_os_printf (" Type Specific: %s Translation\n",
722 ACPI_SPARSE_TRANSLATION == 748 ACPI_SPARSE_TRANSLATION ==
723 address32_data->attribute.io.translation_attribute ? 749 address32_data->attribute.io.translation_attribute ?
724 "Sparse" : "Dense"); 750 "Sparse" : "Dense");
725 break; 751 break;
726 752
727 case ACPI_BUS_NUMBER_RANGE: 753 case ACPI_BUS_NUMBER_RANGE:
@@ -731,46 +757,48 @@ acpi_rs_dump_address32 (
731 757
732 default: 758 default:
733 759
734 acpi_os_printf (" Resource Type: 0x%2.2X\n", address32_data->resource_type); 760 acpi_os_printf (" Resource Type: 0x%2.2X\n",
761 address32_data->resource_type);
735 break; 762 break;
736 } 763 }
737 764
738 acpi_os_printf (" Resource %s\n", 765 acpi_os_printf (" Resource %s\n",
739 ACPI_CONSUMER == address32_data->producer_consumer ? 766 ACPI_CONSUMER == address32_data->producer_consumer ?
740 "Consumer" : "Producer"); 767 "Consumer" : "Producer");
741 768
742 acpi_os_printf (" %s decode\n", 769 acpi_os_printf (" %s decode\n",
743 ACPI_SUB_DECODE == address32_data->decode ? 770 ACPI_SUB_DECODE == address32_data->decode ?
744 "Subtractive" : "Positive"); 771 "Subtractive" : "Positive");
745 772
746 acpi_os_printf (" Min address is %s fixed\n", 773 acpi_os_printf (" Min address is %s fixed\n",
747 ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ? 774 ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ?
748 "" : "not "); 775 "" : "not ");
749 776
750 acpi_os_printf (" Max address is %s fixed\n", 777 acpi_os_printf (" Max address is %s fixed\n",
751 ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ? 778 ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ?
752 "" : "not "); 779 "" : "not ");
753 780
754 acpi_os_printf (" Granularity: %08X\n", 781 acpi_os_printf (" Granularity: %08X\n",
755 address32_data->granularity); 782 address32_data->granularity);
756 783
757 acpi_os_printf (" Address range min: %08X\n", 784 acpi_os_printf (" Address range min: %08X\n",
758 address32_data->min_address_range); 785 address32_data->min_address_range);
759 786
760 acpi_os_printf (" Address range max: %08X\n", 787 acpi_os_printf (" Address range max: %08X\n",
761 address32_data->max_address_range); 788 address32_data->max_address_range);
762 789
763 acpi_os_printf (" Address translation offset: %08X\n", 790 acpi_os_printf (" Address translation offset: %08X\n",
764 address32_data->address_translation_offset); 791 address32_data->address_translation_offset);
765 792
766 acpi_os_printf (" Address Length: %08X\n", 793 acpi_os_printf (" Address Length: %08X\n",
767 address32_data->address_length); 794 address32_data->address_length);
768 795
769 if(0xFF != address32_data->resource_source.index) { 796 if(0xFF != address32_data->resource_source.index) {
770 acpi_os_printf (" Resource Source Index: %X\n", 797 acpi_os_printf (" Resource Source Index: %X\n",
771 address32_data->resource_source.index); 798 address32_data->resource_source.index);
799
772 acpi_os_printf (" Resource Source: %s\n", 800 acpi_os_printf (" Resource Source: %s\n",
773 address32_data->resource_source.string_ptr); 801 address32_data->resource_source.string_ptr);
774 } 802 }
775 803
776 return; 804 return;
@@ -789,7 +817,7 @@ acpi_rs_dump_address32 (
789 * 817 *
790 ******************************************************************************/ 818 ******************************************************************************/
791 819
792void 820static void
793acpi_rs_dump_address64 ( 821acpi_rs_dump_address64 (
794 union acpi_resource_data *data) 822 union acpi_resource_data *data)
795{ 823{
@@ -808,35 +836,30 @@ acpi_rs_dump_address64 (
808 836
809 switch (address64_data->attribute.memory.cache_attribute) { 837 switch (address64_data->attribute.memory.cache_attribute) {
810 case ACPI_NON_CACHEABLE_MEMORY: 838 case ACPI_NON_CACHEABLE_MEMORY:
811 acpi_os_printf (" Type Specific: " 839 acpi_os_printf (" Type Specific: Noncacheable memory\n");
812 "Noncacheable memory\n");
813 break; 840 break;
814 841
815 case ACPI_CACHABLE_MEMORY: 842 case ACPI_CACHABLE_MEMORY:
816 acpi_os_printf (" Type Specific: " 843 acpi_os_printf (" Type Specific: Cacheable memory\n");
817 "Cacheable memory\n");
818 break; 844 break;
819 845
820 case ACPI_WRITE_COMBINING_MEMORY: 846 case ACPI_WRITE_COMBINING_MEMORY:
821 acpi_os_printf (" Type Specific: " 847 acpi_os_printf (" Type Specific: Write-combining memory\n");
822 "Write-combining memory\n");
823 break; 848 break;
824 849
825 case ACPI_PREFETCHABLE_MEMORY: 850 case ACPI_PREFETCHABLE_MEMORY:
826 acpi_os_printf (" Type Specific: " 851 acpi_os_printf (" Type Specific: Prefetchable memory\n");
827 "Prefetchable memory\n");
828 break; 852 break;
829 853
830 default: 854 default:
831 acpi_os_printf (" Type Specific: " 855 acpi_os_printf (" Type Specific: Invalid cache attribute\n");
832 "Invalid cache attribute\n");
833 break; 856 break;
834 } 857 }
835 858
836 acpi_os_printf (" Type Specific: Read%s\n", 859 acpi_os_printf (" Type Specific: Read%s\n",
837 ACPI_READ_WRITE_MEMORY == 860 ACPI_READ_WRITE_MEMORY ==
838 address64_data->attribute.memory.read_write_attribute ? 861 address64_data->attribute.memory.read_write_attribute ?
839 "/Write" : " Only"); 862 "/Write" : " Only");
840 break; 863 break;
841 864
842 case ACPI_IO_RANGE: 865 case ACPI_IO_RANGE:
@@ -845,30 +868,26 @@ acpi_rs_dump_address64 (
845 868
846 switch (address64_data->attribute.io.range_attribute) { 869 switch (address64_data->attribute.io.range_attribute) {
847 case ACPI_NON_ISA_ONLY_RANGES: 870 case ACPI_NON_ISA_ONLY_RANGES:
848 acpi_os_printf (" Type Specific: " 871 acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n");
849 "Non-ISA Io Addresses\n");
850 break; 872 break;
851 873
852 case ACPI_ISA_ONLY_RANGES: 874 case ACPI_ISA_ONLY_RANGES:
853 acpi_os_printf (" Type Specific: " 875 acpi_os_printf (" Type Specific: ISA Io Addresses\n");
854 "ISA Io Addresses\n");
855 break; 876 break;
856 877
857 case ACPI_ENTIRE_RANGE: 878 case ACPI_ENTIRE_RANGE:
858 acpi_os_printf (" Type Specific: " 879 acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n");
859 "ISA and non-ISA Io Addresses\n");
860 break; 880 break;
861 881
862 default: 882 default:
863 acpi_os_printf (" Type Specific: " 883 acpi_os_printf (" Type Specific: Invalid Range attribute");
864 "Invalid Range attribute");
865 break; 884 break;
866 } 885 }
867 886
868 acpi_os_printf (" Type Specific: %s Translation\n", 887 acpi_os_printf (" Type Specific: %s Translation\n",
869 ACPI_SPARSE_TRANSLATION == 888 ACPI_SPARSE_TRANSLATION ==
870 address64_data->attribute.io.translation_attribute ? 889 address64_data->attribute.io.translation_attribute ?
871 "Sparse" : "Dense"); 890 "Sparse" : "Dense");
872 break; 891 break;
873 892
874 case ACPI_BUS_NUMBER_RANGE: 893 case ACPI_BUS_NUMBER_RANGE:
@@ -878,49 +897,51 @@ acpi_rs_dump_address64 (
878 897
879 default: 898 default:
880 899
881 acpi_os_printf (" Resource Type: 0x%2.2X\n", address64_data->resource_type); 900 acpi_os_printf (" Resource Type: 0x%2.2X\n",
901 address64_data->resource_type);
882 break; 902 break;
883 } 903 }
884 904
885 acpi_os_printf (" Resource %s\n", 905 acpi_os_printf (" Resource %s\n",
886 ACPI_CONSUMER == address64_data->producer_consumer ? 906 ACPI_CONSUMER == address64_data->producer_consumer ?
887 "Consumer" : "Producer"); 907 "Consumer" : "Producer");
888 908
889 acpi_os_printf (" %s decode\n", 909 acpi_os_printf (" %s decode\n",
890 ACPI_SUB_DECODE == address64_data->decode ? 910 ACPI_SUB_DECODE == address64_data->decode ?
891 "Subtractive" : "Positive"); 911 "Subtractive" : "Positive");
892 912
893 acpi_os_printf (" Min address is %s fixed\n", 913 acpi_os_printf (" Min address is %s fixed\n",
894 ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ? 914 ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ?
895 "" : "not "); 915 "" : "not ");
896 916
897 acpi_os_printf (" Max address is %s fixed\n", 917 acpi_os_printf (" Max address is %s fixed\n",
898 ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ? 918 ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ?
899 "" : "not "); 919 "" : "not ");
900 920
901 acpi_os_printf (" Granularity: %8.8X%8.8X\n", 921 acpi_os_printf (" Granularity: %8.8X%8.8X\n",
902 ACPI_FORMAT_UINT64 (address64_data->granularity)); 922 ACPI_FORMAT_UINT64 (address64_data->granularity));
903 923
904 acpi_os_printf (" Address range min: %8.8X%8.8X\n", 924 acpi_os_printf (" Address range min: %8.8X%8.8X\n",
905 ACPI_FORMAT_UINT64 (address64_data->min_address_range)); 925 ACPI_FORMAT_UINT64 (address64_data->min_address_range));
906 926
907 acpi_os_printf (" Address range max: %8.8X%8.8X\n", 927 acpi_os_printf (" Address range max: %8.8X%8.8X\n",
908 ACPI_FORMAT_UINT64 (address64_data->max_address_range)); 928 ACPI_FORMAT_UINT64 (address64_data->max_address_range));
909 929
910 acpi_os_printf (" Address translation offset: %8.8X%8.8X\n", 930 acpi_os_printf (" Address translation offset: %8.8X%8.8X\n",
911 ACPI_FORMAT_UINT64 (address64_data->address_translation_offset)); 931 ACPI_FORMAT_UINT64 (address64_data->address_translation_offset));
912 932
913 acpi_os_printf (" Address Length: %8.8X%8.8X\n", 933 acpi_os_printf (" Address Length: %8.8X%8.8X\n",
914 ACPI_FORMAT_UINT64 (address64_data->address_length)); 934 ACPI_FORMAT_UINT64 (address64_data->address_length));
915 935
916 acpi_os_printf (" Type Specific Attributes: %8.8X%8.8X\n", 936 acpi_os_printf (" Type Specific Attributes: %8.8X%8.8X\n",
917 ACPI_FORMAT_UINT64 (address64_data->type_specific_attributes)); 937 ACPI_FORMAT_UINT64 (address64_data->type_specific_attributes));
918 938
919 if (0xFF != address64_data->resource_source.index) { 939 if (0xFF != address64_data->resource_source.index) {
920 acpi_os_printf (" Resource Source Index: %X\n", 940 acpi_os_printf (" Resource Source Index: %X\n",
921 address64_data->resource_source.index); 941 address64_data->resource_source.index);
942
922 acpi_os_printf (" Resource Source: %s\n", 943 acpi_os_printf (" Resource Source: %s\n",
923 address64_data->resource_source.string_ptr); 944 address64_data->resource_source.string_ptr);
924 } 945 }
925 946
926 return; 947 return;
@@ -939,7 +960,7 @@ acpi_rs_dump_address64 (
939 * 960 *
940 ******************************************************************************/ 961 ******************************************************************************/
941 962
942void 963static void
943acpi_rs_dump_extended_irq ( 964acpi_rs_dump_extended_irq (
944 union acpi_resource_data *data) 965 union acpi_resource_data *data)
945{ 966{
@@ -953,23 +974,22 @@ acpi_rs_dump_extended_irq (
953 acpi_os_printf ("Extended IRQ Resource\n"); 974 acpi_os_printf ("Extended IRQ Resource\n");
954 975
955 acpi_os_printf (" Resource %s\n", 976 acpi_os_printf (" Resource %s\n",
956 ACPI_CONSUMER == ext_irq_data->producer_consumer ? 977 ACPI_CONSUMER == ext_irq_data->producer_consumer ?
957 "Consumer" : "Producer"); 978 "Consumer" : "Producer");
958 979
959 acpi_os_printf (" %s\n", 980 acpi_os_printf (" %s\n",
960 ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ? 981 ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ?
961 "Level" : "Edge"); 982 "Level" : "Edge");
962 983
963 acpi_os_printf (" Active %s\n", 984 acpi_os_printf (" Active %s\n",
964 ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ? 985 ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ?
965 "low" : "high"); 986 "low" : "high");
966 987
967 acpi_os_printf (" %s\n", 988 acpi_os_printf (" %s\n",
968 ACPI_SHARED == ext_irq_data->shared_exclusive ? 989 ACPI_SHARED == ext_irq_data->shared_exclusive ?
969 "Shared" : "Exclusive"); 990 "Shared" : "Exclusive");
970 991
971 acpi_os_printf (" Interrupts : %X ( ", 992 acpi_os_printf (" Interrupts : %X ( ", ext_irq_data->number_of_interrupts);
972 ext_irq_data->number_of_interrupts);
973 993
974 for (index = 0; index < ext_irq_data->number_of_interrupts; index++) { 994 for (index = 0; index < ext_irq_data->number_of_interrupts; index++) {
975 acpi_os_printf ("%X ", ext_irq_data->interrupts[index]); 995 acpi_os_printf ("%X ", ext_irq_data->interrupts[index]);
@@ -979,9 +999,10 @@ acpi_rs_dump_extended_irq (
979 999
980 if(0xFF != ext_irq_data->resource_source.index) { 1000 if(0xFF != ext_irq_data->resource_source.index) {
981 acpi_os_printf (" Resource Source Index: %X", 1001 acpi_os_printf (" Resource Source Index: %X",
982 ext_irq_data->resource_source.index); 1002 ext_irq_data->resource_source.index);
1003
983 acpi_os_printf (" Resource Source: %s", 1004 acpi_os_printf (" Resource Source: %s",
984 ext_irq_data->resource_source.string_ptr); 1005 ext_irq_data->resource_source.string_ptr);
985 } 1006 }
986 1007
987 return; 1008 return;
@@ -992,7 +1013,7 @@ acpi_rs_dump_extended_irq (
992 * 1013 *
993 * FUNCTION: acpi_rs_dump_resource_list 1014 * FUNCTION: acpi_rs_dump_resource_list
994 * 1015 *
995 * PARAMETERS: Data - pointer to the resource structure to dump. 1016 * PARAMETERS: Resource - pointer to the resource structure to dump.
996 * 1017 *
997 * RETURN: None 1018 * RETURN: None
998 * 1019 *
@@ -1096,7 +1117,7 @@ acpi_rs_dump_resource_list (
1096 * 1117 *
1097 * FUNCTION: acpi_rs_dump_irq_list 1118 * FUNCTION: acpi_rs_dump_irq_list
1098 * 1119 *
1099 * PARAMETERS: Data - pointer to the routing table to dump. 1120 * PARAMETERS: route_table - pointer to the routing table to dump.
1100 * 1121 *
1101 * RETURN: None 1122 * RETURN: None
1102 * 1123 *
@@ -1124,20 +1145,17 @@ acpi_rs_dump_irq_list (
1124 acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++); 1145 acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++);
1125 1146
1126 acpi_os_printf (" Address: %8.8X%8.8X\n", 1147 acpi_os_printf (" Address: %8.8X%8.8X\n",
1127 ACPI_FORMAT_UINT64 (prt_element->address)); 1148 ACPI_FORMAT_UINT64 (prt_element->address));
1128 1149
1129 acpi_os_printf (" Pin: %X\n", prt_element->pin); 1150 acpi_os_printf (" Pin: %X\n", prt_element->pin);
1130 1151
1131 acpi_os_printf (" Source: %s\n", prt_element->source); 1152 acpi_os_printf (" Source: %s\n", prt_element->source);
1132 1153
1133 acpi_os_printf (" source_index: %X\n", 1154 acpi_os_printf (" source_index: %X\n", prt_element->source_index);
1134 prt_element->source_index);
1135 1155
1136 buffer += prt_element->length; 1156 buffer += prt_element->length;
1137
1138 prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); 1157 prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer);
1139 1158 if (0 == prt_element->length) {
1140 if(0 == prt_element->length) {
1141 done = TRUE; 1159 done = TRUE;
1142 } 1160 }
1143 } 1161 }
diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c
index 972c746d37e4..23a4d149fac8 100644
--- a/drivers/acpi/resources/rsio.c
+++ b/drivers/acpi/resources/rsio.c
@@ -81,67 +81,60 @@ acpi_rs_io_resource (
81 struct acpi_resource *output_struct = (void *) *output_buffer; 81 struct acpi_resource *output_struct = (void *) *output_buffer;
82 u16 temp16 = 0; 82 u16 temp16 = 0;
83 u8 temp8 = 0; 83 u8 temp8 = 0;
84 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_io); 84 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
85 struct acpi_resource_io);
85 86
86 87
87 ACPI_FUNCTION_TRACE ("rs_io_resource"); 88 ACPI_FUNCTION_TRACE ("rs_io_resource");
88 89
89 90
90 /* 91 /* The number of bytes consumed are Constant */
91 * The number of bytes consumed are Constant 92
92 */
93 *bytes_consumed = 8; 93 *bytes_consumed = 8;
94 94
95 output_struct->id = ACPI_RSTYPE_IO; 95 output_struct->id = ACPI_RSTYPE_IO;
96 96
97 /* 97 /* Check Decode */
98 * Check Decode 98
99 */
100 buffer += 1; 99 buffer += 1;
101 temp8 = *buffer; 100 temp8 = *buffer;
102 101
103 output_struct->data.io.io_decode = temp8 & 0x01; 102 output_struct->data.io.io_decode = temp8 & 0x01;
104 103
105 /* 104 /* Check min_base Address */
106 * Check min_base Address 105
107 */
108 buffer += 1; 106 buffer += 1;
109 ACPI_MOVE_16_TO_16 (&temp16, buffer); 107 ACPI_MOVE_16_TO_16 (&temp16, buffer);
110 108
111 output_struct->data.io.min_base_address = temp16; 109 output_struct->data.io.min_base_address = temp16;
112 110
113 /* 111 /* Check max_base Address */
114 * Check max_base Address 112
115 */
116 buffer += 2; 113 buffer += 2;
117 ACPI_MOVE_16_TO_16 (&temp16, buffer); 114 ACPI_MOVE_16_TO_16 (&temp16, buffer);
118 115
119 output_struct->data.io.max_base_address = temp16; 116 output_struct->data.io.max_base_address = temp16;
120 117
121 /* 118 /* Check Base alignment */
122 * Check Base alignment 119
123 */
124 buffer += 2; 120 buffer += 2;
125 temp8 = *buffer; 121 temp8 = *buffer;
126 122
127 output_struct->data.io.alignment = temp8; 123 output_struct->data.io.alignment = temp8;
128 124
129 /* 125 /* Check range_length */
130 * Check range_length 126
131 */
132 buffer += 1; 127 buffer += 1;
133 temp8 = *buffer; 128 temp8 = *buffer;
134 129
135 output_struct->data.io.range_length = temp8; 130 output_struct->data.io.range_length = temp8;
136 131
137 /* 132 /* Set the Length parameter */
138 * Set the Length parameter 133
139 */
140 output_struct->length = (u32) struct_size; 134 output_struct->length = (u32) struct_size;
141 135
142 /* 136 /* Return the final size of the structure */
143 * Return the final size of the structure 137
144 */
145 *structure_size = struct_size; 138 *structure_size = struct_size;
146 return_ACPI_STATUS (AE_OK); 139 return_ACPI_STATUS (AE_OK);
147} 140}
@@ -179,43 +172,39 @@ acpi_rs_fixed_io_resource (
179 struct acpi_resource *output_struct = (void *) *output_buffer; 172 struct acpi_resource *output_struct = (void *) *output_buffer;
180 u16 temp16 = 0; 173 u16 temp16 = 0;
181 u8 temp8 = 0; 174 u8 temp8 = 0;
182 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_io); 175 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
176 struct acpi_resource_fixed_io);
183 177
184 178
185 ACPI_FUNCTION_TRACE ("rs_fixed_io_resource"); 179 ACPI_FUNCTION_TRACE ("rs_fixed_io_resource");
186 180
187 181
188 /* 182 /* The number of bytes consumed are Constant */
189 * The number of bytes consumed are Constant 183
190 */
191 *bytes_consumed = 4; 184 *bytes_consumed = 4;
192 185
193 output_struct->id = ACPI_RSTYPE_FIXED_IO; 186 output_struct->id = ACPI_RSTYPE_FIXED_IO;
194 187
195 /* 188 /* Check Range Base Address */
196 * Check Range Base Address 189
197 */
198 buffer += 1; 190 buffer += 1;
199 ACPI_MOVE_16_TO_16 (&temp16, buffer); 191 ACPI_MOVE_16_TO_16 (&temp16, buffer);
200 192
201 output_struct->data.fixed_io.base_address = temp16; 193 output_struct->data.fixed_io.base_address = temp16;
202 194
203 /* 195 /* Check range_length */
204 * Check range_length 196
205 */
206 buffer += 2; 197 buffer += 2;
207 temp8 = *buffer; 198 temp8 = *buffer;
208 199
209 output_struct->data.fixed_io.range_length = temp8; 200 output_struct->data.fixed_io.range_length = temp8;
210 201
211 /* 202 /* Set the Length parameter */
212 * Set the Length parameter 203
213 */
214 output_struct->length = (u32) struct_size; 204 output_struct->length = (u32) struct_size;
215 205
216 /* 206 /* Return the final size of the structure */
217 * Return the final size of the structure 207
218 */
219 *structure_size = struct_size; 208 *structure_size = struct_size;
220 return_ACPI_STATUS (AE_OK); 209 return_ACPI_STATUS (AE_OK);
221} 210}
@@ -251,55 +240,48 @@ acpi_rs_io_stream (
251 ACPI_FUNCTION_TRACE ("rs_io_stream"); 240 ACPI_FUNCTION_TRACE ("rs_io_stream");
252 241
253 242
254 /* 243 /* The descriptor field is static */
255 * The descriptor field is static 244
256 */
257 *buffer = 0x47; 245 *buffer = 0x47;
258 buffer += 1; 246 buffer += 1;
259 247
260 /* 248 /* Io Information Byte */
261 * Io Information Byte 249
262 */
263 temp8 = (u8) (linked_list->data.io.io_decode & 0x01); 250 temp8 = (u8) (linked_list->data.io.io_decode & 0x01);
264 251
265 *buffer = temp8; 252 *buffer = temp8;
266 buffer += 1; 253 buffer += 1;
267 254
268 /* 255 /* Set the Range minimum base address */
269 * Set the Range minimum base address 256
270 */
271 temp16 = (u16) linked_list->data.io.min_base_address; 257 temp16 = (u16) linked_list->data.io.min_base_address;
272 258
273 ACPI_MOVE_16_TO_16 (buffer, &temp16); 259 ACPI_MOVE_16_TO_16 (buffer, &temp16);
274 buffer += 2; 260 buffer += 2;
275 261
276 /* 262 /* Set the Range maximum base address */
277 * Set the Range maximum base address 263
278 */
279 temp16 = (u16) linked_list->data.io.max_base_address; 264 temp16 = (u16) linked_list->data.io.max_base_address;
280 265
281 ACPI_MOVE_16_TO_16 (buffer, &temp16); 266 ACPI_MOVE_16_TO_16 (buffer, &temp16);
282 buffer += 2; 267 buffer += 2;
283 268
284 /* 269 /* Set the base alignment */
285 * Set the base alignment 270
286 */
287 temp8 = (u8) linked_list->data.io.alignment; 271 temp8 = (u8) linked_list->data.io.alignment;
288 272
289 *buffer = temp8; 273 *buffer = temp8;
290 buffer += 1; 274 buffer += 1;
291 275
292 /* 276 /* Set the range length */
293 * Set the range length 277
294 */
295 temp8 = (u8) linked_list->data.io.range_length; 278 temp8 = (u8) linked_list->data.io.range_length;
296 279
297 *buffer = temp8; 280 *buffer = temp8;
298 buffer += 1; 281 buffer += 1;
299 282
300 /* 283 /* Return the number of bytes consumed in this operation */
301 * Return the number of bytes consumed in this operation 284
302 */
303 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 285 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
304 return_ACPI_STATUS (AE_OK); 286 return_ACPI_STATUS (AE_OK);
305} 287}
@@ -335,32 +317,28 @@ acpi_rs_fixed_io_stream (
335 ACPI_FUNCTION_TRACE ("rs_fixed_io_stream"); 317 ACPI_FUNCTION_TRACE ("rs_fixed_io_stream");
336 318
337 319
338 /* 320 /* The descriptor field is static */
339 * The descriptor field is static 321
340 */
341 *buffer = 0x4B; 322 *buffer = 0x4B;
342 323
343 buffer += 1; 324 buffer += 1;
344 325
345 /* 326 /* Set the Range base address */
346 * Set the Range base address 327
347 */
348 temp16 = (u16) linked_list->data.fixed_io.base_address; 328 temp16 = (u16) linked_list->data.fixed_io.base_address;
349 329
350 ACPI_MOVE_16_TO_16 (buffer, &temp16); 330 ACPI_MOVE_16_TO_16 (buffer, &temp16);
351 buffer += 2; 331 buffer += 2;
352 332
353 /* 333 /* Set the range length */
354 * Set the range length 334
355 */
356 temp8 = (u8) linked_list->data.fixed_io.range_length; 335 temp8 = (u8) linked_list->data.fixed_io.range_length;
357 336
358 *buffer = temp8; 337 *buffer = temp8;
359 buffer += 1; 338 buffer += 1;
360 339
361 /* 340 /* Return the number of bytes consumed in this operation */
362 * Return the number of bytes consumed in this operation 341
363 */
364 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 342 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
365 return_ACPI_STATUS (AE_OK); 343 return_ACPI_STATUS (AE_OK);
366} 344}
@@ -399,21 +377,20 @@ acpi_rs_dma_resource (
399 u8 temp8 = 0; 377 u8 temp8 = 0;
400 u8 index; 378 u8 index;
401 u8 i; 379 u8 i;
402 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_dma); 380 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
381 struct acpi_resource_dma);
403 382
404 383
405 ACPI_FUNCTION_TRACE ("rs_dma_resource"); 384 ACPI_FUNCTION_TRACE ("rs_dma_resource");
406 385
407 386
408 /* 387 /* The number of bytes consumed are Constant */
409 * The number of bytes consumed are Constant 388
410 */
411 *bytes_consumed = 3; 389 *bytes_consumed = 3;
412 output_struct->id = ACPI_RSTYPE_DMA; 390 output_struct->id = ACPI_RSTYPE_DMA;
413 391
414 /* 392 /* Point to the 8-bits of Byte 1 */
415 * Point to the 8-bits of Byte 1 393
416 */
417 buffer += 1; 394 buffer += 1;
418 temp8 = *buffer; 395 temp8 = *buffer;
419 396
@@ -430,46 +407,40 @@ acpi_rs_dma_resource (
430 407
431 output_struct->data.dma.number_of_channels = i; 408 output_struct->data.dma.number_of_channels = i;
432 if (i > 0) { 409 if (i > 0) {
433 /* 410 /* Calculate the structure size based upon the number of interrupts */
434 * Calculate the structure size based upon the number of interrupts 411
435 */
436 struct_size += ((acpi_size) i - 1) * 4; 412 struct_size += ((acpi_size) i - 1) * 4;
437 } 413 }
438 414
439 /* 415 /* Point to Byte 2 */
440 * Point to Byte 2 416
441 */
442 buffer += 1; 417 buffer += 1;
443 temp8 = *buffer; 418 temp8 = *buffer;
444 419
445 /* 420 /* Check for transfer preference (Bits[1:0]) */
446 * Check for transfer preference (Bits[1:0]) 421
447 */
448 output_struct->data.dma.transfer = temp8 & 0x03; 422 output_struct->data.dma.transfer = temp8 & 0x03;
449 423
450 if (0x03 == output_struct->data.dma.transfer) { 424 if (0x03 == output_struct->data.dma.transfer) {
451 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid DMA.Transfer preference (3)\n")); 425 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
426 "Invalid DMA.Transfer preference (3)\n"));
452 return_ACPI_STATUS (AE_BAD_DATA); 427 return_ACPI_STATUS (AE_BAD_DATA);
453 } 428 }
454 429
455 /* 430 /* Get bus master preference (Bit[2]) */
456 * Get bus master preference (Bit[2]) 431
457 */
458 output_struct->data.dma.bus_master = (temp8 >> 2) & 0x01; 432 output_struct->data.dma.bus_master = (temp8 >> 2) & 0x01;
459 433
460 /* 434 /* Get channel speed support (Bits[6:5]) */
461 * Get channel speed support (Bits[6:5]) 435
462 */
463 output_struct->data.dma.type = (temp8 >> 5) & 0x03; 436 output_struct->data.dma.type = (temp8 >> 5) & 0x03;
464 437
465 /* 438 /* Set the Length parameter */
466 * Set the Length parameter 439
467 */
468 output_struct->length = (u32) struct_size; 440 output_struct->length = (u32) struct_size;
469 441
470 /* 442 /* Return the final size of the structure */
471 * Return the final size of the structure 443
472 */
473 *structure_size = struct_size; 444 *structure_size = struct_size;
474 return_ACPI_STATUS (AE_OK); 445 return_ACPI_STATUS (AE_OK);
475} 446}
@@ -506,16 +477,14 @@ acpi_rs_dma_stream (
506 ACPI_FUNCTION_TRACE ("rs_dma_stream"); 477 ACPI_FUNCTION_TRACE ("rs_dma_stream");
507 478
508 479
509 /* 480 /* The descriptor field is static */
510 * The descriptor field is static 481
511 */
512 *buffer = 0x2A; 482 *buffer = 0x2A;
513 buffer += 1; 483 buffer += 1;
514 temp8 = 0; 484 temp8 = 0;
515 485
516 /* 486 /* Loop through all of the Channels and set the mask bits */
517 * Loop through all of the Channels and set the mask bits 487
518 */
519 for (index = 0; 488 for (index = 0;
520 index < linked_list->data.dma.number_of_channels; 489 index < linked_list->data.dma.number_of_channels;
521 index++) { 490 index++) {
@@ -526,9 +495,8 @@ acpi_rs_dma_stream (
526 *buffer = temp8; 495 *buffer = temp8;
527 buffer += 1; 496 buffer += 1;
528 497
529 /* 498 /* Set the DMA Info */
530 * Set the DMA Info 499
531 */
532 temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5); 500 temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5);
533 temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2); 501 temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2);
534 temp8 |= (linked_list->data.dma.transfer & 0x03); 502 temp8 |= (linked_list->data.dma.transfer & 0x03);
@@ -536,9 +504,8 @@ acpi_rs_dma_stream (
536 *buffer = temp8; 504 *buffer = temp8;
537 buffer += 1; 505 buffer += 1;
538 506
539 /* 507 /* Return the number of bytes consumed in this operation */
540 * Return the number of bytes consumed in this operation 508
541 */
542 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 509 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
543 return_ACPI_STATUS (AE_OK); 510 return_ACPI_STATUS (AE_OK);
544} 511}
diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c
index fd07a8702fbe..8a2b630be45b 100644
--- a/drivers/acpi/resources/rsirq.c
+++ b/drivers/acpi/resources/rsirq.c
@@ -83,7 +83,8 @@ acpi_rs_irq_resource (
83 u8 temp8 = 0; 83 u8 temp8 = 0;
84 u8 index; 84 u8 index;
85 u8 i; 85 u8 i;
86 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_irq); 86 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
87 struct acpi_resource_irq);
87 88
88 89
89 ACPI_FUNCTION_TRACE ("rs_irq_resource"); 90 ACPI_FUNCTION_TRACE ("rs_irq_resource");
@@ -91,15 +92,14 @@ acpi_rs_irq_resource (
91 92
92 /* 93 /*
93 * The number of bytes consumed are contained in the descriptor 94 * The number of bytes consumed are contained in the descriptor
94 * (Bits:0-1) 95 * (Bits:0-1)
95 */ 96 */
96 temp8 = *buffer; 97 temp8 = *buffer;
97 *bytes_consumed = (temp8 & 0x03) + 1; 98 *bytes_consumed = (temp8 & 0x03) + 1;
98 output_struct->id = ACPI_RSTYPE_IRQ; 99 output_struct->id = ACPI_RSTYPE_IRQ;
99 100
100 /* 101 /* Point to the 16-bits of Bytes 1 and 2 */
101 * Point to the 16-bits of Bytes 1 and 2 102
102 */
103 buffer += 1; 103 buffer += 1;
104 ACPI_MOVE_16_TO_16 (&temp16, buffer); 104 ACPI_MOVE_16_TO_16 (&temp16, buffer);
105 105
@@ -118,22 +118,19 @@ acpi_rs_irq_resource (
118 118
119 output_struct->data.irq.number_of_interrupts = i; 119 output_struct->data.irq.number_of_interrupts = i;
120 if (i > 0) { 120 if (i > 0) {
121 /* 121 /* Calculate the structure size based upon the number of interrupts */
122 * Calculate the structure size based upon the number of interrupts 122
123 */
124 struct_size += ((acpi_size) i - 1) * 4; 123 struct_size += ((acpi_size) i - 1) * 4;
125 } 124 }
126 125
127 /* 126 /* Point to Byte 3 if it is used */
128 * Point to Byte 3 if it is used 127
129 */
130 if (4 == *bytes_consumed) { 128 if (4 == *bytes_consumed) {
131 buffer += 2; 129 buffer += 2;
132 temp8 = *buffer; 130 temp8 = *buffer;
133 131
134 /* 132 /* Check for HE, LL interrupts */
135 * Check for HE, LL interrupts 133
136 */
137 switch (temp8 & 0x09) { 134 switch (temp8 & 0x09) {
138 case 0x01: /* HE */ 135 case 0x01: /* HE */
139 output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE; 136 output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE;
@@ -152,13 +149,13 @@ acpi_rs_irq_resource (
152 * so 0x00 and 0x09 are illegal. 149 * so 0x00 and 0x09 are illegal.
153 */ 150 */
154 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 151 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
155 "Invalid interrupt polarity/trigger in resource list, %X\n", temp8)); 152 "Invalid interrupt polarity/trigger in resource list, %X\n",
153 temp8));
156 return_ACPI_STATUS (AE_BAD_DATA); 154 return_ACPI_STATUS (AE_BAD_DATA);
157 } 155 }
158 156
159 /* 157 /* Check for sharable */
160 * Check for sharable 158
161 */
162 output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01; 159 output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01;
163 } 160 }
164 else { 161 else {
@@ -171,14 +168,12 @@ acpi_rs_irq_resource (
171 output_struct->data.irq.shared_exclusive = ACPI_EXCLUSIVE; 168 output_struct->data.irq.shared_exclusive = ACPI_EXCLUSIVE;
172 } 169 }
173 170
174 /* 171 /* Set the Length parameter */
175 * Set the Length parameter 172
176 */
177 output_struct->length = (u32) struct_size; 173 output_struct->length = (u32) struct_size;
178 174
179 /* 175 /* Return the final size of the structure */
180 * Return the final size of the structure 176
181 */
182 *structure_size = struct_size; 177 *structure_size = struct_size;
183 return_ACPI_STATUS (AE_OK); 178 return_ACPI_STATUS (AE_OK);
184} 179}
@@ -234,9 +229,8 @@ acpi_rs_irq_stream (
234 buffer += 1; 229 buffer += 1;
235 temp16 = 0; 230 temp16 = 0;
236 231
237 /* 232 /* Loop through all of the interrupts and set the mask bits */
238 * Loop through all of the interrupts and set the mask bits 233
239 */
240 for(index = 0; 234 for(index = 0;
241 index < linked_list->data.irq.number_of_interrupts; 235 index < linked_list->data.irq.number_of_interrupts;
242 index++) { 236 index++) {
@@ -247,9 +241,8 @@ acpi_rs_irq_stream (
247 ACPI_MOVE_16_TO_16 (buffer, &temp16); 241 ACPI_MOVE_16_TO_16 (buffer, &temp16);
248 buffer += 2; 242 buffer += 2;
249 243
250 /* 244 /* Set the IRQ Info byte if needed. */
251 * Set the IRQ Info byte if needed. 245
252 */
253 if (IRqinfo_byte_needed) { 246 if (IRqinfo_byte_needed) {
254 temp8 = 0; 247 temp8 = 0;
255 temp8 = (u8) ((linked_list->data.irq.shared_exclusive & 248 temp8 = (u8) ((linked_list->data.irq.shared_exclusive &
@@ -267,9 +260,8 @@ acpi_rs_irq_stream (
267 buffer += 1; 260 buffer += 1;
268 } 261 }
269 262
270 /* 263 /* Return the number of bytes consumed in this operation */
271 * Return the number of bytes consumed in this operation 264
272 */
273 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 265 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
274 return_ACPI_STATUS (AE_OK); 266 return_ACPI_STATUS (AE_OK);
275} 267}
@@ -309,15 +301,15 @@ acpi_rs_extended_irq_resource (
309 u8 temp8 = 0; 301 u8 temp8 = 0;
310 u8 *temp_ptr; 302 u8 *temp_ptr;
311 u8 index; 303 u8 index;
312 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq); 304 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
305 struct acpi_resource_ext_irq);
313 306
314 307
315 ACPI_FUNCTION_TRACE ("rs_extended_irq_resource"); 308 ACPI_FUNCTION_TRACE ("rs_extended_irq_resource");
316 309
317 310
318 /* 311 /* Point past the Descriptor to get the number of bytes consumed */
319 * Point past the Descriptor to get the number of bytes consumed 312
320 */
321 buffer += 1; 313 buffer += 1;
322 ACPI_MOVE_16_TO_16 (&temp16, buffer); 314 ACPI_MOVE_16_TO_16 (&temp16, buffer);
323 315
@@ -330,9 +322,8 @@ acpi_rs_extended_irq_resource (
330 *bytes_consumed = temp16 + 3; 322 *bytes_consumed = temp16 + 3;
331 output_struct->id = ACPI_RSTYPE_EXT_IRQ; 323 output_struct->id = ACPI_RSTYPE_EXT_IRQ;
332 324
333 /* 325 /* Point to the Byte3 */
334 * Point to the Byte3 326
335 */
336 buffer += 2; 327 buffer += 2;
337 temp8 = *buffer; 328 temp8 = *buffer;
338 329
@@ -347,21 +338,18 @@ acpi_rs_extended_irq_resource (
347 * - Edge/Level are defined opposite in the table vs the headers 338 * - Edge/Level are defined opposite in the table vs the headers
348 */ 339 */
349 output_struct->data.extended_irq.edge_level = 340 output_struct->data.extended_irq.edge_level =
350 (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; 341 (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE;
342
343 /* Check Interrupt Polarity */
351 344
352 /*
353 * Check Interrupt Polarity
354 */
355 output_struct->data.extended_irq.active_high_low = (temp8 >> 2) & 0x1; 345 output_struct->data.extended_irq.active_high_low = (temp8 >> 2) & 0x1;
356 346
357 /* 347 /* Check for sharable */
358 * Check for sharable 348
359 */
360 output_struct->data.extended_irq.shared_exclusive = (temp8 >> 3) & 0x01; 349 output_struct->data.extended_irq.shared_exclusive = (temp8 >> 3) & 0x01;
361 350
362 /* 351 /* Point to Byte4 (IRQ Table length) */
363 * Point to Byte4 (IRQ Table length) 352
364 */
365 buffer += 1; 353 buffer += 1;
366 temp8 = *buffer; 354 temp8 = *buffer;
367 355
@@ -379,14 +367,12 @@ acpi_rs_extended_irq_resource (
379 */ 367 */
380 struct_size += (temp8 - 1) * 4; 368 struct_size += (temp8 - 1) * 4;
381 369
382 /* 370 /* Point to Byte5 (First IRQ Number) */
383 * Point to Byte5 (First IRQ Number) 371
384 */
385 buffer += 1; 372 buffer += 1;
386 373
387 /* 374 /* Cycle through every IRQ in the table */
388 * Cycle through every IRQ in the table 375
389 */
390 for (index = 0; index < temp8; index++) { 376 for (index = 0; index < temp8; index++) {
391 ACPI_MOVE_32_TO_32 ( 377 ACPI_MOVE_32_TO_32 (
392 &output_struct->data.extended_irq.interrupts[index], buffer); 378 &output_struct->data.extended_irq.interrupts[index], buffer);
@@ -407,7 +393,8 @@ acpi_rs_extended_irq_resource (
407 * we add 1 to the length. 393 * we add 1 to the length.
408 */ 394 */
409 if (*bytes_consumed > 395 if (*bytes_consumed >
410 ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * 4) + (5 + 1)) { 396 ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * 4) +
397 (5 + 1)) {
411 /* Dereference the Index */ 398 /* Dereference the Index */
412 399
413 temp8 = *buffer; 400 temp8 = *buffer;
@@ -417,13 +404,13 @@ acpi_rs_extended_irq_resource (
417 404
418 buffer += 1; 405 buffer += 1;
419 406
420 /* 407 /* Point the String pointer to the end of this structure. */
421 * Point the String pointer to the end of this structure. 408
422 */
423 output_struct->data.extended_irq.resource_source.string_ptr = 409 output_struct->data.extended_irq.resource_source.string_ptr =
424 (char *)((char *) output_struct + struct_size); 410 (char *)((char *) output_struct + struct_size);
425 411
426 temp_ptr = (u8 *) output_struct->data.extended_irq.resource_source.string_ptr; 412 temp_ptr = (u8 *)
413 output_struct->data.extended_irq.resource_source.string_ptr;
427 414
428 /* Copy the string into the buffer */ 415 /* Copy the string into the buffer */
429 416
@@ -436,9 +423,8 @@ acpi_rs_extended_irq_resource (
436 index += 1; 423 index += 1;
437 } 424 }
438 425
439 /* 426 /* Add the terminating null */
440 * Add the terminating null 427
441 */
442 *temp_ptr = 0x00; 428 *temp_ptr = 0x00;
443 output_struct->data.extended_irq.resource_source.string_length = index + 1; 429 output_struct->data.extended_irq.resource_source.string_length = index + 1;
444 430
@@ -456,14 +442,12 @@ acpi_rs_extended_irq_resource (
456 output_struct->data.extended_irq.resource_source.string_ptr = NULL; 442 output_struct->data.extended_irq.resource_source.string_ptr = NULL;
457 } 443 }
458 444
459 /* 445 /* Set the Length parameter */
460 * Set the Length parameter 446
461 */
462 output_struct->length = (u32) struct_size; 447 output_struct->length = (u32) struct_size;
463 448
464 /* 449 /* Return the final size of the structure */
465 * Return the final size of the structure 450
466 */
467 *structure_size = struct_size; 451 *structure_size = struct_size;
468 return_ACPI_STATUS (AE_OK); 452 return_ACPI_STATUS (AE_OK);
469} 453}
@@ -501,21 +485,18 @@ acpi_rs_extended_irq_stream (
501 ACPI_FUNCTION_TRACE ("rs_extended_irq_stream"); 485 ACPI_FUNCTION_TRACE ("rs_extended_irq_stream");
502 486
503 487
504 /* 488 /* The descriptor field is static */
505 * The descriptor field is static 489
506 */
507 *buffer = 0x89; 490 *buffer = 0x89;
508 buffer += 1; 491 buffer += 1;
509 492
510 /* 493 /* Set a pointer to the Length field - to be filled in later */
511 * Set a pointer to the Length field - to be filled in later 494
512 */
513 length_field = ACPI_CAST_PTR (u16, buffer); 495 length_field = ACPI_CAST_PTR (u16, buffer);
514 buffer += 2; 496 buffer += 2;
515 497
516 /* 498 /* Set the Interrupt vector flags */
517 * Set the Interrupt vector flags 499
518 */
519 temp8 = (u8)(linked_list->data.extended_irq.producer_consumer & 0x01); 500 temp8 = (u8)(linked_list->data.extended_irq.producer_consumer & 0x01);
520 temp8 |= ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3); 501 temp8 |= ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3);
521 502
@@ -532,17 +513,15 @@ acpi_rs_extended_irq_stream (
532 temp8 |= 0x2; 513 temp8 |= 0x2;
533 } 514 }
534 515
535 /* 516 /* Set the Interrupt Polarity */
536 * Set the Interrupt Polarity 517
537 */
538 temp8 |= ((linked_list->data.extended_irq.active_high_low & 0x1) << 2); 518 temp8 |= ((linked_list->data.extended_irq.active_high_low & 0x1) << 2);
539 519
540 *buffer = temp8; 520 *buffer = temp8;
541 buffer += 1; 521 buffer += 1;
542 522
543 /* 523 /* Set the Interrupt table length */
544 * Set the Interrupt table length 524
545 */
546 temp8 = (u8) linked_list->data.extended_irq.number_of_interrupts; 525 temp8 = (u8) linked_list->data.extended_irq.number_of_interrupts;
547 526
548 *buffer = temp8; 527 *buffer = temp8;
@@ -555,18 +534,16 @@ acpi_rs_extended_irq_stream (
555 buffer += 4; 534 buffer += 4;
556 } 535 }
557 536
558 /* 537 /* Resource Source Index and Resource Source are optional */
559 * Resource Source Index and Resource Source are optional 538
560 */
561 if (0 != linked_list->data.extended_irq.resource_source.string_length) { 539 if (0 != linked_list->data.extended_irq.resource_source.string_length) {
562 *buffer = (u8) linked_list->data.extended_irq.resource_source.index; 540 *buffer = (u8) linked_list->data.extended_irq.resource_source.index;
563 buffer += 1; 541 buffer += 1;
564 542
565 temp_pointer = (char *) buffer; 543 temp_pointer = (char *) buffer;
566 544
567 /* 545 /* Copy the string */
568 * Copy the string 546
569 */
570 ACPI_STRCPY (temp_pointer, 547 ACPI_STRCPY (temp_pointer,
571 linked_list->data.extended_irq.resource_source.string_ptr); 548 linked_list->data.extended_irq.resource_source.string_ptr);
572 549
@@ -574,12 +551,12 @@ acpi_rs_extended_irq_stream (
574 * Buffer needs to be set to the length of the sting + one for the 551 * Buffer needs to be set to the length of the sting + one for the
575 * terminating null 552 * terminating null
576 */ 553 */
577 buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.extended_irq.resource_source.string_ptr) + 1); 554 buffer += (acpi_size) (ACPI_STRLEN (
555 linked_list->data.extended_irq.resource_source.string_ptr) + 1);
578 } 556 }
579 557
580 /* 558 /* Return the number of bytes consumed in this operation */
581 * Return the number of bytes consumed in this operation 559
582 */
583 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 560 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
584 561
585 /* 562 /*
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c
index e49c1e030f99..db7bcb4e60e3 100644
--- a/drivers/acpi/resources/rslist.c
+++ b/drivers/acpi/resources/rslist.c
@@ -55,7 +55,7 @@
55 * 55 *
56 * PARAMETERS: resource_start_byte - Byte 0 of a resource descriptor 56 * PARAMETERS: resource_start_byte - Byte 0 of a resource descriptor
57 * 57 *
58 * RETURN: The Resource Type (Name) with no extraneous bits 58 * RETURN: The Resource Type with no extraneous bits
59 * 59 *
60 * DESCRIPTION: Extract the Resource Type/Name from the first byte of 60 * DESCRIPTION: Extract the Resource Type/Name from the first byte of
61 * a resource descriptor. 61 * a resource descriptor.
@@ -70,28 +70,25 @@ acpi_rs_get_resource_type (
70 ACPI_FUNCTION_ENTRY (); 70 ACPI_FUNCTION_ENTRY ();
71 71
72 72
73 /* 73 /* Determine if this is a small or large resource */
74 * Determine if this is a small or large resource 74
75 */
76 switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) { 75 switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) {
77 case ACPI_RDESC_TYPE_SMALL: 76 case ACPI_RDESC_TYPE_SMALL:
78 77
79 /* 78 /* Small Resource Type -- Only bits 6:3 are valid */
80 * Small Resource Type -- Only bits 6:3 are valid 79
81 */
82 return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK)); 80 return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK));
83 81
84 82
85 case ACPI_RDESC_TYPE_LARGE: 83 case ACPI_RDESC_TYPE_LARGE:
86 84
87 /* 85 /* Large Resource Type -- All bits are valid */
88 * Large Resource Type -- All bits are valid 86
89 */
90 return (resource_start_byte); 87 return (resource_start_byte);
91 88
92 89
93 default: 90 default:
94 /* No other types of resource descriptor */ 91 /* Invalid type */
95 break; 92 break;
96 } 93 }
97 94
@@ -135,9 +132,8 @@ acpi_rs_byte_stream_to_list (
135 132
136 while (bytes_parsed < byte_stream_buffer_length && 133 while (bytes_parsed < byte_stream_buffer_length &&
137 !end_tag_processed) { 134 !end_tag_processed) {
138 /* 135 /* The next byte in the stream is the resource type */
139 * The next byte in the stream is the resource type 136
140 */
141 resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); 137 resource_type = acpi_rs_get_resource_type (*byte_stream_buffer);
142 138
143 switch (resource_type) { 139 switch (resource_type) {
@@ -299,28 +295,23 @@ acpi_rs_byte_stream_to_list (
299 return_ACPI_STATUS (status); 295 return_ACPI_STATUS (status);
300 } 296 }
301 297
302 /* 298 /* Update the return value and counter */
303 * Update the return value and counter 299
304 */
305 bytes_parsed += bytes_consumed; 300 bytes_parsed += bytes_consumed;
306 301
307 /* 302 /* Set the byte stream to point to the next resource */
308 * Set the byte stream to point to the next resource 303
309 */
310 byte_stream_buffer += bytes_consumed; 304 byte_stream_buffer += bytes_consumed;
311 305
312 /* 306 /* Set the Buffer to the next structure */
313 * Set the Buffer to the next structure 307
314 */
315 resource = ACPI_CAST_PTR (struct acpi_resource, buffer); 308 resource = ACPI_CAST_PTR (struct acpi_resource, buffer);
316 resource->length = (u32) ACPI_ALIGN_RESOURCE_SIZE (resource->length); 309 resource->length = (u32) ACPI_ALIGN_RESOURCE_SIZE (resource->length);
317 buffer += ACPI_ALIGN_RESOURCE_SIZE (structure_size); 310 buffer += ACPI_ALIGN_RESOURCE_SIZE (structure_size);
311 }
318 312
319 } /* end while */ 313 /* Check the reason for exiting the while loop */
320 314
321 /*
322 * Check the reason for exiting the while loop
323 */
324 if (!end_tag_processed) { 315 if (!end_tag_processed) {
325 return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); 316 return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
326 } 317 }
@@ -424,9 +415,8 @@ acpi_rs_list_to_byte_stream (
424 */ 415 */
425 status = acpi_rs_end_tag_stream (linked_list, &buffer, &bytes_consumed); 416 status = acpi_rs_end_tag_stream (linked_list, &buffer, &bytes_consumed);
426 417
427 /* 418 /* An End Tag indicates the end of the Resource Template */
428 * An End Tag indicates the end of the Resource Template 419
429 */
430 done = TRUE; 420 done = TRUE;
431 break; 421 break;
432 422
@@ -488,27 +478,25 @@ acpi_rs_list_to_byte_stream (
488 default: 478 default:
489 /* 479 /*
490 * If we get here, everything is out of sync, 480 * If we get here, everything is out of sync,
491 * so exit with an error 481 * so exit with an error
492 */ 482 */
493 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid descriptor type (%X) in resource list\n", 483 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
484 "Invalid descriptor type (%X) in resource list\n",
494 linked_list->id)); 485 linked_list->id));
495 status = AE_BAD_DATA; 486 status = AE_BAD_DATA;
496 break; 487 break;
497 488 }
498 } /* switch (linked_list->Id) */
499 489
500 if (ACPI_FAILURE (status)) { 490 if (ACPI_FAILURE (status)) {
501 return_ACPI_STATUS (status); 491 return_ACPI_STATUS (status);
502 } 492 }
503 493
504 /* 494 /* Set the Buffer to point to the open byte */
505 * Set the Buffer to point to the open byte 495
506 */
507 buffer += bytes_consumed; 496 buffer += bytes_consumed;
508 497
509 /* 498 /* Point to the next object */
510 * Point to the next object 499
511 */
512 linked_list = ACPI_PTR_ADD (struct acpi_resource, 500 linked_list = ACPI_PTR_ADD (struct acpi_resource,
513 linked_list, linked_list->length); 501 linked_list, linked_list->length);
514 } 502 }
diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c
index 7c935aecf075..91d0207f01ac 100644
--- a/drivers/acpi/resources/rsmemory.c
+++ b/drivers/acpi/resources/rsmemory.c
@@ -81,15 +81,15 @@ acpi_rs_memory24_resource (
81 struct acpi_resource *output_struct = (void *) *output_buffer; 81 struct acpi_resource *output_struct = (void *) *output_buffer;
82 u16 temp16 = 0; 82 u16 temp16 = 0;
83 u8 temp8 = 0; 83 u8 temp8 = 0;
84 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem24); 84 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
85 struct acpi_resource_mem24);
85 86
86 87
87 ACPI_FUNCTION_TRACE ("rs_memory24_resource"); 88 ACPI_FUNCTION_TRACE ("rs_memory24_resource");
88 89
89 90
90 /* 91 /* Point past the Descriptor to get the number of bytes consumed */
91 * Point past the Descriptor to get the number of bytes consumed 92
92 */
93 buffer += 1; 93 buffer += 1;
94 94
95 ACPI_MOVE_16_TO_16 (&temp16, buffer); 95 ACPI_MOVE_16_TO_16 (&temp16, buffer);
@@ -97,48 +97,41 @@ acpi_rs_memory24_resource (
97 *bytes_consumed = (acpi_size) temp16 + 3; 97 *bytes_consumed = (acpi_size) temp16 + 3;
98 output_struct->id = ACPI_RSTYPE_MEM24; 98 output_struct->id = ACPI_RSTYPE_MEM24;
99 99
100 /* 100 /* Check Byte 3 the Read/Write bit */
101 * Check Byte 3 the Read/Write bit 101
102 */
103 temp8 = *buffer; 102 temp8 = *buffer;
104 buffer += 1; 103 buffer += 1;
105 output_struct->data.memory24.read_write_attribute = temp8 & 0x01; 104 output_struct->data.memory24.read_write_attribute = temp8 & 0x01;
106 105
107 /* 106 /* Get min_base_address (Bytes 4-5) */
108 * Get min_base_address (Bytes 4-5) 107
109 */
110 ACPI_MOVE_16_TO_16 (&temp16, buffer); 108 ACPI_MOVE_16_TO_16 (&temp16, buffer);
111 buffer += 2; 109 buffer += 2;
112 output_struct->data.memory24.min_base_address = temp16; 110 output_struct->data.memory24.min_base_address = temp16;
113 111
114 /* 112 /* Get max_base_address (Bytes 6-7) */
115 * Get max_base_address (Bytes 6-7) 113
116 */
117 ACPI_MOVE_16_TO_16 (&temp16, buffer); 114 ACPI_MOVE_16_TO_16 (&temp16, buffer);
118 buffer += 2; 115 buffer += 2;
119 output_struct->data.memory24.max_base_address = temp16; 116 output_struct->data.memory24.max_base_address = temp16;
120 117
121 /* 118 /* Get Alignment (Bytes 8-9) */
122 * Get Alignment (Bytes 8-9) 119
123 */
124 ACPI_MOVE_16_TO_16 (&temp16, buffer); 120 ACPI_MOVE_16_TO_16 (&temp16, buffer);
125 buffer += 2; 121 buffer += 2;
126 output_struct->data.memory24.alignment = temp16; 122 output_struct->data.memory24.alignment = temp16;
127 123
128 /* 124 /* Get range_length (Bytes 10-11) */
129 * Get range_length (Bytes 10-11) 125
130 */
131 ACPI_MOVE_16_TO_16 (&temp16, buffer); 126 ACPI_MOVE_16_TO_16 (&temp16, buffer);
132 output_struct->data.memory24.range_length = temp16; 127 output_struct->data.memory24.range_length = temp16;
133 128
134 /* 129 /* Set the Length parameter */
135 * Set the Length parameter 130
136 */
137 output_struct->length = (u32) struct_size; 131 output_struct->length = (u32) struct_size;
138 132
139 /* 133 /* Return the final size of the structure */
140 * Return the final size of the structure 134
141 */
142 *structure_size = struct_size; 135 *structure_size = struct_size;
143 return_ACPI_STATUS (AE_OK); 136 return_ACPI_STATUS (AE_OK);
144} 137}
@@ -174,53 +167,45 @@ acpi_rs_memory24_stream (
174 ACPI_FUNCTION_TRACE ("rs_memory24_stream"); 167 ACPI_FUNCTION_TRACE ("rs_memory24_stream");
175 168
176 169
177 /* 170 /* The descriptor field is static */
178 * The descriptor field is static 171
179 */
180 *buffer = 0x81; 172 *buffer = 0x81;
181 buffer += 1; 173 buffer += 1;
182 174
183 /* 175 /* The length field is static */
184 * The length field is static 176
185 */
186 temp16 = 0x09; 177 temp16 = 0x09;
187 ACPI_MOVE_16_TO_16 (buffer, &temp16); 178 ACPI_MOVE_16_TO_16 (buffer, &temp16);
188 buffer += 2; 179 buffer += 2;
189 180
190 /* 181 /* Set the Information Byte */
191 * Set the Information Byte 182
192 */
193 temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01); 183 temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01);
194 *buffer = temp8; 184 *buffer = temp8;
195 buffer += 1; 185 buffer += 1;
196 186
197 /* 187 /* Set the Range minimum base address */
198 * Set the Range minimum base address 188
199 */
200 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.min_base_address); 189 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.min_base_address);
201 buffer += 2; 190 buffer += 2;
202 191
203 /* 192 /* Set the Range maximum base address */
204 * Set the Range maximum base address 193
205 */
206 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.max_base_address); 194 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.max_base_address);
207 buffer += 2; 195 buffer += 2;
208 196
209 /* 197 /* Set the base alignment */
210 * Set the base alignment 198
211 */
212 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.alignment); 199 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.alignment);
213 buffer += 2; 200 buffer += 2;
214 201
215 /* 202 /* Set the range length */
216 * Set the range length 203
217 */
218 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.range_length); 204 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.range_length);
219 buffer += 2; 205 buffer += 2;
220 206
221 /* 207 /* Return the number of bytes consumed in this operation */
222 * Return the number of bytes consumed in this operation 208
223 */
224 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 209 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
225 return_ACPI_STATUS (AE_OK); 210 return_ACPI_STATUS (AE_OK);
226} 211}
@@ -258,15 +243,15 @@ acpi_rs_memory32_range_resource (
258 struct acpi_resource *output_struct = (void *) *output_buffer; 243 struct acpi_resource *output_struct = (void *) *output_buffer;
259 u16 temp16 = 0; 244 u16 temp16 = 0;
260 u8 temp8 = 0; 245 u8 temp8 = 0;
261 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem32); 246 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
247 struct acpi_resource_mem32);
262 248
263 249
264 ACPI_FUNCTION_TRACE ("rs_memory32_range_resource"); 250 ACPI_FUNCTION_TRACE ("rs_memory32_range_resource");
265 251
266 252
267 /* 253 /* Point past the Descriptor to get the number of bytes consumed */
268 * Point past the Descriptor to get the number of bytes consumed 254
269 */
270 buffer += 1; 255 buffer += 1;
271 256
272 ACPI_MOVE_16_TO_16 (&temp16, buffer); 257 ACPI_MOVE_16_TO_16 (&temp16, buffer);
@@ -285,45 +270,38 @@ acpi_rs_memory32_range_resource (
285 * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(u8) 270 * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(u8)
286 */ 271 */
287 272
288 /* 273 /* Check Byte 3 the Read/Write bit */
289 * Check Byte 3 the Read/Write bit 274
290 */
291 temp8 = *buffer; 275 temp8 = *buffer;
292 buffer += 1; 276 buffer += 1;
293 277
294 output_struct->data.memory32.read_write_attribute = temp8 & 0x01; 278 output_struct->data.memory32.read_write_attribute = temp8 & 0x01;
295 279
296 /* 280 /* Get min_base_address (Bytes 4-7) */
297 * Get min_base_address (Bytes 4-7) 281
298 */
299 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.min_base_address, buffer); 282 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.min_base_address, buffer);
300 buffer += 4; 283 buffer += 4;
301 284
302 /* 285 /* Get max_base_address (Bytes 8-11) */
303 * Get max_base_address (Bytes 8-11) 286
304 */
305 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.max_base_address, buffer); 287 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.max_base_address, buffer);
306 buffer += 4; 288 buffer += 4;
307 289
308 /* 290 /* Get Alignment (Bytes 12-15) */
309 * Get Alignment (Bytes 12-15) 291
310 */
311 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.alignment, buffer); 292 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.alignment, buffer);
312 buffer += 4; 293 buffer += 4;
313 294
314 /* 295 /* Get range_length (Bytes 16-19) */
315 * Get range_length (Bytes 16-19) 296
316 */
317 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.range_length, buffer); 297 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.range_length, buffer);
318 298
319 /* 299 /* Set the Length parameter */
320 * Set the Length parameter 300
321 */
322 output_struct->length = (u32) struct_size; 301 output_struct->length = (u32) struct_size;
323 302
324 /* 303 /* Return the final size of the structure */
325 * Return the final size of the structure 304
326 */
327 *structure_size = struct_size; 305 *structure_size = struct_size;
328 return_ACPI_STATUS (AE_OK); 306 return_ACPI_STATUS (AE_OK);
329} 307}
@@ -361,15 +339,15 @@ acpi_rs_fixed_memory32_resource (
361 struct acpi_resource *output_struct = (void *) *output_buffer; 339 struct acpi_resource *output_struct = (void *) *output_buffer;
362 u16 temp16 = 0; 340 u16 temp16 = 0;
363 u8 temp8 = 0; 341 u8 temp8 = 0;
364 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_mem32); 342 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
343 struct acpi_resource_fixed_mem32);
365 344
366 345
367 ACPI_FUNCTION_TRACE ("rs_fixed_memory32_resource"); 346 ACPI_FUNCTION_TRACE ("rs_fixed_memory32_resource");
368 347
369 348
370 /* 349 /* Point past the Descriptor to get the number of bytes consumed */
371 * Point past the Descriptor to get the number of bytes consumed 350
372 */
373 buffer += 1; 351 buffer += 1;
374 ACPI_MOVE_16_TO_16 (&temp16, buffer); 352 ACPI_MOVE_16_TO_16 (&temp16, buffer);
375 353
@@ -378,32 +356,28 @@ acpi_rs_fixed_memory32_resource (
378 356
379 output_struct->id = ACPI_RSTYPE_FIXED_MEM32; 357 output_struct->id = ACPI_RSTYPE_FIXED_MEM32;
380 358
381 /* 359 /* Check Byte 3 the Read/Write bit */
382 * Check Byte 3 the Read/Write bit 360
383 */
384 temp8 = *buffer; 361 temp8 = *buffer;
385 buffer += 1; 362 buffer += 1;
386 output_struct->data.fixed_memory32.read_write_attribute = temp8 & 0x01; 363 output_struct->data.fixed_memory32.read_write_attribute = temp8 & 0x01;
387 364
388 /* 365 /* Get range_base_address (Bytes 4-7) */
389 * Get range_base_address (Bytes 4-7) 366
390 */ 367 ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_base_address,
391 ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_base_address, buffer); 368 buffer);
392 buffer += 4; 369 buffer += 4;
393 370
394 /* 371 /* Get range_length (Bytes 8-11) */
395 * Get range_length (Bytes 8-11) 372
396 */
397 ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_length, buffer); 373 ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_length, buffer);
398 374
399 /* 375 /* Set the Length parameter */
400 * Set the Length parameter 376
401 */
402 output_struct->length = (u32) struct_size; 377 output_struct->length = (u32) struct_size;
403 378
404 /* 379 /* Return the final size of the structure */
405 * Return the final size of the structure 380
406 */
407 *structure_size = struct_size; 381 *structure_size = struct_size;
408 return_ACPI_STATUS (AE_OK); 382 return_ACPI_STATUS (AE_OK);
409} 383}
@@ -439,54 +413,46 @@ acpi_rs_memory32_range_stream (
439 ACPI_FUNCTION_TRACE ("rs_memory32_range_stream"); 413 ACPI_FUNCTION_TRACE ("rs_memory32_range_stream");
440 414
441 415
442 /* 416 /* The descriptor field is static */
443 * The descriptor field is static 417
444 */
445 *buffer = 0x85; 418 *buffer = 0x85;
446 buffer += 1; 419 buffer += 1;
447 420
448 /* 421 /* The length field is static */
449 * The length field is static 422
450 */
451 temp16 = 0x11; 423 temp16 = 0x11;
452 424
453 ACPI_MOVE_16_TO_16 (buffer, &temp16); 425 ACPI_MOVE_16_TO_16 (buffer, &temp16);
454 buffer += 2; 426 buffer += 2;
455 427
456 /* 428 /* Set the Information Byte */
457 * Set the Information Byte 429
458 */
459 temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01); 430 temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01);
460 *buffer = temp8; 431 *buffer = temp8;
461 buffer += 1; 432 buffer += 1;
462 433
463 /* 434 /* Set the Range minimum base address */
464 * Set the Range minimum base address 435
465 */
466 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.min_base_address); 436 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.min_base_address);
467 buffer += 4; 437 buffer += 4;
468 438
469 /* 439 /* Set the Range maximum base address */
470 * Set the Range maximum base address 440
471 */
472 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.max_base_address); 441 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.max_base_address);
473 buffer += 4; 442 buffer += 4;
474 443
475 /* 444 /* Set the base alignment */
476 * Set the base alignment 445
477 */
478 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.alignment); 446 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.alignment);
479 buffer += 4; 447 buffer += 4;
480 448
481 /* 449 /* Set the range length */
482 * Set the range length 450
483 */
484 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.range_length); 451 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.range_length);
485 buffer += 4; 452 buffer += 4;
486 453
487 /* 454 /* Return the number of bytes consumed in this operation */
488 * Return the number of bytes consumed in this operation 455
489 */
490 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 456 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
491 return_ACPI_STATUS (AE_OK); 457 return_ACPI_STATUS (AE_OK);
492} 458}
@@ -522,44 +488,38 @@ acpi_rs_fixed_memory32_stream (
522 ACPI_FUNCTION_TRACE ("rs_fixed_memory32_stream"); 488 ACPI_FUNCTION_TRACE ("rs_fixed_memory32_stream");
523 489
524 490
525 /* 491 /* The descriptor field is static */
526 * The descriptor field is static 492
527 */
528 *buffer = 0x86; 493 *buffer = 0x86;
529 buffer += 1; 494 buffer += 1;
530 495
531 /* 496 /* The length field is static */
532 * The length field is static 497
533 */
534 temp16 = 0x09; 498 temp16 = 0x09;
535 499
536 ACPI_MOVE_16_TO_16 (buffer, &temp16); 500 ACPI_MOVE_16_TO_16 (buffer, &temp16);
537 buffer += 2; 501 buffer += 2;
538 502
539 /* 503 /* Set the Information Byte */
540 * Set the Information Byte 504
541 */
542 temp8 = (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); 505 temp8 = (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01);
543 *buffer = temp8; 506 *buffer = temp8;
544 buffer += 1; 507 buffer += 1;
545 508
546 /* 509 /* Set the Range base address */
547 * Set the Range base address 510
548 */
549 ACPI_MOVE_32_TO_32 (buffer, 511 ACPI_MOVE_32_TO_32 (buffer,
550 &linked_list->data.fixed_memory32.range_base_address); 512 &linked_list->data.fixed_memory32.range_base_address);
551 buffer += 4; 513 buffer += 4;
552 514
553 /* 515 /* Set the range length */
554 * Set the range length 516
555 */
556 ACPI_MOVE_32_TO_32 (buffer, 517 ACPI_MOVE_32_TO_32 (buffer,
557 &linked_list->data.fixed_memory32.range_length); 518 &linked_list->data.fixed_memory32.range_length);
558 buffer += 4; 519 buffer += 4;
559 520
560 /* 521 /* Return the number of bytes consumed in this operation */
561 * Return the number of bytes consumed in this operation 522
562 */
563 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 523 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
564 return_ACPI_STATUS (AE_OK); 524 return_ACPI_STATUS (AE_OK);
565} 525}
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c
index d16be44b5df7..a1f1741f0d83 100644
--- a/drivers/acpi/resources/rsmisc.c
+++ b/drivers/acpi/resources/rsmisc.c
@@ -84,24 +84,20 @@ acpi_rs_end_tag_resource (
84 ACPI_FUNCTION_TRACE ("rs_end_tag_resource"); 84 ACPI_FUNCTION_TRACE ("rs_end_tag_resource");
85 85
86 86
87 /* 87 /* The number of bytes consumed is static */
88 * The number of bytes consumed is static 88
89 */
90 *bytes_consumed = 2; 89 *bytes_consumed = 2;
91 90
92 /* 91 /* Fill out the structure */
93 * Fill out the structure 92
94 */
95 output_struct->id = ACPI_RSTYPE_END_TAG; 93 output_struct->id = ACPI_RSTYPE_END_TAG;
96 94
97 /* 95 /* Set the Length parameter */
98 * Set the Length parameter 96
99 */
100 output_struct->length = 0; 97 output_struct->length = 0;
101 98
102 /* 99 /* Return the final size of the structure */
103 * Return the final size of the structure 100
104 */
105 *structure_size = struct_size; 101 *structure_size = struct_size;
106 return_ACPI_STATUS (AE_OK); 102 return_ACPI_STATUS (AE_OK);
107} 103}
@@ -136,9 +132,8 @@ acpi_rs_end_tag_stream (
136 ACPI_FUNCTION_TRACE ("rs_end_tag_stream"); 132 ACPI_FUNCTION_TRACE ("rs_end_tag_stream");
137 133
138 134
139 /* 135 /* The descriptor field is static */
140 * The descriptor field is static 136
141 */
142 *buffer = 0x79; 137 *buffer = 0x79;
143 buffer += 1; 138 buffer += 1;
144 139
@@ -151,9 +146,8 @@ acpi_rs_end_tag_stream (
151 *buffer = temp8; 146 *buffer = temp8;
152 buffer += 1; 147 buffer += 1;
153 148
154 /* 149 /* Return the number of bytes consumed in this operation */
155 * Return the number of bytes consumed in this operation 150
156 */
157 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 151 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
158 return_ACPI_STATUS (AE_OK); 152 return_ACPI_STATUS (AE_OK);
159} 153}
@@ -192,21 +186,20 @@ acpi_rs_vendor_resource (
192 u16 temp16 = 0; 186 u16 temp16 = 0;
193 u8 temp8 = 0; 187 u8 temp8 = 0;
194 u8 index; 188 u8 index;
195 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor); 189 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
190 struct acpi_resource_vendor);
196 191
197 192
198 ACPI_FUNCTION_TRACE ("rs_vendor_resource"); 193 ACPI_FUNCTION_TRACE ("rs_vendor_resource");
199 194
200 195
201 /* 196 /* Dereference the Descriptor to find if this is a large or small item. */
202 * Dereference the Descriptor to find if this is a large or small item. 197
203 */
204 temp8 = *buffer; 198 temp8 = *buffer;
205 199
206 if (temp8 & 0x80) { 200 if (temp8 & 0x80) {
207 /* 201 /* Large Item, point to the length field */
208 * Large Item, point to the length field 202
209 */
210 buffer += 1; 203 buffer += 1;
211 204
212 /* Dereference */ 205 /* Dereference */
@@ -222,9 +215,8 @@ acpi_rs_vendor_resource (
222 buffer += 2; 215 buffer += 2;
223 } 216 }
224 else { 217 else {
225 /* 218 /* Small Item, dereference the size */
226 * Small Item, dereference the size 219
227 */
228 temp16 = (u8)(*buffer & 0x07); 220 temp16 = (u8)(*buffer & 0x07);
229 221
230 /* Calculate bytes consumed */ 222 /* Calculate bytes consumed */
@@ -251,14 +243,12 @@ acpi_rs_vendor_resource (
251 */ 243 */
252 struct_size += ACPI_ROUND_UP_to_32_bITS (temp16); 244 struct_size += ACPI_ROUND_UP_to_32_bITS (temp16);
253 245
254 /* 246 /* Set the Length parameter */
255 * Set the Length parameter 247
256 */
257 output_struct->length = (u32) struct_size; 248 output_struct->length = (u32) struct_size;
258 249
259 /* 250 /* Return the final size of the structure */
260 * Return the final size of the structure 251
261 */
262 *structure_size = struct_size; 252 *structure_size = struct_size;
263 return_ACPI_STATUS (AE_OK); 253 return_ACPI_STATUS (AE_OK);
264} 254}
@@ -295,13 +285,11 @@ acpi_rs_vendor_stream (
295 ACPI_FUNCTION_TRACE ("rs_vendor_stream"); 285 ACPI_FUNCTION_TRACE ("rs_vendor_stream");
296 286
297 287
298 /* 288 /* Dereference the length to find if this is a large or small item. */
299 * Dereference the length to find if this is a large or small item. 289
300 */
301 if(linked_list->data.vendor_specific.length > 7) { 290 if(linked_list->data.vendor_specific.length > 7) {
302 /* 291 /* Large Item, Set the descriptor field and length bytes */
303 * Large Item, Set the descriptor field and length bytes 292
304 */
305 *buffer = 0x84; 293 *buffer = 0x84;
306 buffer += 1; 294 buffer += 1;
307 295
@@ -311,9 +299,8 @@ acpi_rs_vendor_stream (
311 buffer += 2; 299 buffer += 2;
312 } 300 }
313 else { 301 else {
314 /* 302 /* Small Item, Set the descriptor field */
315 * Small Item, Set the descriptor field 303
316 */
317 temp8 = 0x70; 304 temp8 = 0x70;
318 temp8 |= (u8) linked_list->data.vendor_specific.length; 305 temp8 |= (u8) linked_list->data.vendor_specific.length;
319 306
@@ -321,9 +308,8 @@ acpi_rs_vendor_stream (
321 buffer += 1; 308 buffer += 1;
322 } 309 }
323 310
324 /* 311 /* Loop through all of the Vendor Specific fields */
325 * Loop through all of the Vendor Specific fields 312
326 */
327 for (index = 0; index < linked_list->data.vendor_specific.length; index++) { 313 for (index = 0; index < linked_list->data.vendor_specific.length; index++) {
328 temp8 = linked_list->data.vendor_specific.reserved[index]; 314 temp8 = linked_list->data.vendor_specific.reserved[index];
329 315
@@ -331,9 +317,8 @@ acpi_rs_vendor_stream (
331 buffer += 1; 317 buffer += 1;
332 } 318 }
333 319
334 /* 320 /* Return the number of bytes consumed in this operation */
335 * Return the number of bytes consumed in this operation 321
336 */
337 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 322 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
338 return_ACPI_STATUS (AE_OK); 323 return_ACPI_STATUS (AE_OK);
339} 324}
@@ -370,40 +355,37 @@ acpi_rs_start_depend_fns_resource (
370 u8 *buffer = byte_stream_buffer; 355 u8 *buffer = byte_stream_buffer;
371 struct acpi_resource *output_struct = (void *) *output_buffer; 356 struct acpi_resource *output_struct = (void *) *output_buffer;
372 u8 temp8 = 0; 357 u8 temp8 = 0;
373 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_start_dpf); 358 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
359 struct acpi_resource_start_dpf);
374 360
375 361
376 ACPI_FUNCTION_TRACE ("rs_start_depend_fns_resource"); 362 ACPI_FUNCTION_TRACE ("rs_start_depend_fns_resource");
377 363
378 364
379 /* 365 /* The number of bytes consumed are found in the descriptor (Bits:0-1) */
380 * The number of bytes consumed are contained in the descriptor (Bits:0-1) 366
381 */
382 temp8 = *buffer; 367 temp8 = *buffer;
383 368
384 *bytes_consumed = (temp8 & 0x01) + 1; 369 *bytes_consumed = (temp8 & 0x01) + 1;
385 370
386 output_struct->id = ACPI_RSTYPE_START_DPF; 371 output_struct->id = ACPI_RSTYPE_START_DPF;
387 372
388 /* 373 /* Point to Byte 1 if it is used */
389 * Point to Byte 1 if it is used 374
390 */
391 if (2 == *bytes_consumed) { 375 if (2 == *bytes_consumed) {
392 buffer += 1; 376 buffer += 1;
393 temp8 = *buffer; 377 temp8 = *buffer;
394 378
395 /* 379 /* Check Compatibility priority */
396 * Check Compatibility priority 380
397 */
398 output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03; 381 output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03;
399 382
400 if (3 == output_struct->data.start_dpf.compatibility_priority) { 383 if (3 == output_struct->data.start_dpf.compatibility_priority) {
401 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); 384 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE);
402 } 385 }
403 386
404 /* 387 /* Check Performance/Robustness preference */
405 * Check Performance/Robustness preference 388
406 */
407 output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03; 389 output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03;
408 390
409 if (3 == output_struct->data.start_dpf.performance_robustness) { 391 if (3 == output_struct->data.start_dpf.performance_robustness) {
@@ -412,20 +394,18 @@ acpi_rs_start_depend_fns_resource (
412 } 394 }
413 else { 395 else {
414 output_struct->data.start_dpf.compatibility_priority = 396 output_struct->data.start_dpf.compatibility_priority =
415 ACPI_ACCEPTABLE_CONFIGURATION; 397 ACPI_ACCEPTABLE_CONFIGURATION;
416 398
417 output_struct->data.start_dpf.performance_robustness = 399 output_struct->data.start_dpf.performance_robustness =
418 ACPI_ACCEPTABLE_CONFIGURATION; 400 ACPI_ACCEPTABLE_CONFIGURATION;
419 } 401 }
420 402
421 /* 403 /* Set the Length parameter */
422 * Set the Length parameter 404
423 */
424 output_struct->length = (u32) struct_size; 405 output_struct->length = (u32) struct_size;
425 406
426 /* 407 /* Return the final size of the structure */
427 * Return the final size of the structure 408
428 */
429 *structure_size = struct_size; 409 *structure_size = struct_size;
430 return_ACPI_STATUS (AE_OK); 410 return_ACPI_STATUS (AE_OK);
431} 411}
@@ -466,24 +446,20 @@ acpi_rs_end_depend_fns_resource (
466 ACPI_FUNCTION_TRACE ("rs_end_depend_fns_resource"); 446 ACPI_FUNCTION_TRACE ("rs_end_depend_fns_resource");
467 447
468 448
469 /* 449 /* The number of bytes consumed is static */
470 * The number of bytes consumed is static 450
471 */
472 *bytes_consumed = 1; 451 *bytes_consumed = 1;
473 452
474 /* 453 /* Fill out the structure */
475 * Fill out the structure 454
476 */
477 output_struct->id = ACPI_RSTYPE_END_DPF; 455 output_struct->id = ACPI_RSTYPE_END_DPF;
478 456
479 /* 457 /* Set the Length parameter */
480 * Set the Length parameter 458
481 */
482 output_struct->length = (u32) struct_size; 459 output_struct->length = (u32) struct_size;
483 460
484 /* 461 /* Return the final size of the structure */
485 * Return the final size of the structure 462
486 */
487 *structure_size = struct_size; 463 *structure_size = struct_size;
488 return_ACPI_STATUS (AE_OK); 464 return_ACPI_STATUS (AE_OK);
489} 465}
@@ -533,9 +509,8 @@ acpi_rs_start_depend_fns_stream (
533 *buffer = 0x31; 509 *buffer = 0x31;
534 buffer += 1; 510 buffer += 1;
535 511
536 /* 512 /* Set the Priority Byte Definition */
537 * Set the Priority Byte Definition 513
538 */
539 temp8 = 0; 514 temp8 = 0;
540 temp8 = (u8) ((linked_list->data.start_dpf.performance_robustness & 515 temp8 = (u8) ((linked_list->data.start_dpf.performance_robustness &
541 0x03) << 2); 516 0x03) << 2);
@@ -546,9 +521,8 @@ acpi_rs_start_depend_fns_stream (
546 521
547 buffer += 1; 522 buffer += 1;
548 523
549 /* 524 /* Return the number of bytes consumed in this operation */
550 * Return the number of bytes consumed in this operation 525
551 */
552 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 526 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
553 return_ACPI_STATUS (AE_OK); 527 return_ACPI_STATUS (AE_OK);
554} 528}
@@ -582,15 +556,13 @@ acpi_rs_end_depend_fns_stream (
582 ACPI_FUNCTION_TRACE ("rs_end_depend_fns_stream"); 556 ACPI_FUNCTION_TRACE ("rs_end_depend_fns_stream");
583 557
584 558
585 /* 559 /* The descriptor field is static */
586 * The descriptor field is static 560
587 */
588 *buffer = 0x38; 561 *buffer = 0x38;
589 buffer += 1; 562 buffer += 1;
590 563
591 /* 564 /* Return the number of bytes consumed in this operation */
592 * Return the number of bytes consumed in this operation 565
593 */
594 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 566 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
595 return_ACPI_STATUS (AE_OK); 567 return_ACPI_STATUS (AE_OK);
596} 568}
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c
index ee9ce13c053d..700cf7d65d76 100644
--- a/drivers/acpi/resources/rsutils.c
+++ b/drivers/acpi/resources/rsutils.c
@@ -83,10 +83,10 @@ acpi_rs_get_prt_method_data (
83 83
84 /* Parameters guaranteed valid by caller */ 84 /* Parameters guaranteed valid by caller */
85 85
86 /* 86 /* Execute the method, no parameters */
87 * Execute the method, no parameters 87
88 */ 88 status = acpi_ut_evaluate_object (handle, METHOD_NAME__PRT,
89 status = acpi_ut_evaluate_object (handle, "_PRT", ACPI_BTYPE_PACKAGE, &obj_desc); 89 ACPI_BTYPE_PACKAGE, &obj_desc);
90 if (ACPI_FAILURE (status)) { 90 if (ACPI_FAILURE (status)) {
91 return_ACPI_STATUS (status); 91 return_ACPI_STATUS (status);
92 } 92 }
@@ -136,10 +136,10 @@ acpi_rs_get_crs_method_data (
136 136
137 /* Parameters guaranteed valid by caller */ 137 /* Parameters guaranteed valid by caller */
138 138
139 /* 139 /* Execute the method, no parameters */
140 * Execute the method, no parameters 140
141 */ 141 status = acpi_ut_evaluate_object (handle, METHOD_NAME__CRS,
142 status = acpi_ut_evaluate_object (handle, "_CRS", ACPI_BTYPE_BUFFER, &obj_desc); 142 ACPI_BTYPE_BUFFER, &obj_desc);
143 if (ACPI_FAILURE (status)) { 143 if (ACPI_FAILURE (status)) {
144 return_ACPI_STATUS (status); 144 return_ACPI_STATUS (status);
145 } 145 }
@@ -175,6 +175,7 @@ acpi_rs_get_crs_method_data (
175 * and the contents of the callers buffer is undefined. 175 * and the contents of the callers buffer is undefined.
176 * 176 *
177 ******************************************************************************/ 177 ******************************************************************************/
178
178#ifdef ACPI_FUTURE_USAGE 179#ifdef ACPI_FUTURE_USAGE
179acpi_status 180acpi_status
180acpi_rs_get_prs_method_data ( 181acpi_rs_get_prs_method_data (
@@ -190,10 +191,10 @@ acpi_rs_get_prs_method_data (
190 191
191 /* Parameters guaranteed valid by caller */ 192 /* Parameters guaranteed valid by caller */
192 193
193 /* 194 /* Execute the method, no parameters */
194 * Execute the method, no parameters 195
195 */ 196 status = acpi_ut_evaluate_object (handle, METHOD_NAME__PRS,
196 status = acpi_ut_evaluate_object (handle, "_PRS", ACPI_BTYPE_BUFFER, &obj_desc); 197 ACPI_BTYPE_BUFFER, &obj_desc);
197 if (ACPI_FAILURE (status)) { 198 if (ACPI_FAILURE (status)) {
198 return_ACPI_STATUS (status); 199 return_ACPI_STATUS (status);
199 } 200 }
@@ -218,6 +219,7 @@ acpi_rs_get_prs_method_data (
218 * FUNCTION: acpi_rs_get_method_data 219 * FUNCTION: acpi_rs_get_method_data
219 * 220 *
220 * PARAMETERS: Handle - a handle to the containing object 221 * PARAMETERS: Handle - a handle to the containing object
222 * Path - Path to method, relative to Handle
221 * ret_buffer - a pointer to a buffer structure for the 223 * ret_buffer - a pointer to a buffer structure for the
222 * results 224 * results
223 * 225 *
@@ -246,9 +248,8 @@ acpi_rs_get_method_data (
246 248
247 /* Parameters guaranteed valid by caller */ 249 /* Parameters guaranteed valid by caller */
248 250
249 /* 251 /* Execute the method, no parameters */
250 * Execute the method, no parameters 252
251 */
252 status = acpi_ut_evaluate_object (handle, path, ACPI_BTYPE_BUFFER, &obj_desc); 253 status = acpi_ut_evaluate_object (handle, path, ACPI_BTYPE_BUFFER, &obj_desc);
253 if (ACPI_FAILURE (status)) { 254 if (ACPI_FAILURE (status)) {
254 return_ACPI_STATUS (status); 255 return_ACPI_STATUS (status);
@@ -314,18 +315,16 @@ acpi_rs_set_srs_method_data (
314 return_ACPI_STATUS (status); 315 return_ACPI_STATUS (status);
315 } 316 }
316 317
317 /* 318 /* Init the param object */
318 * Init the param object 319
319 */
320 params[0] = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); 320 params[0] = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
321 if (!params[0]) { 321 if (!params[0]) {
322 acpi_os_free (buffer.pointer); 322 acpi_os_free (buffer.pointer);
323 return_ACPI_STATUS (AE_NO_MEMORY); 323 return_ACPI_STATUS (AE_NO_MEMORY);
324 } 324 }
325 325
326 /* 326 /* Set up the parameter object */
327 * Set up the parameter object 327
328 */
329 params[0]->buffer.length = (u32) buffer.length; 328 params[0]->buffer.length = (u32) buffer.length;
330 params[0]->buffer.pointer = buffer.pointer; 329 params[0]->buffer.pointer = buffer.pointer;
331 params[0]->common.flags = AOPOBJ_DATA_VALID; 330 params[0]->common.flags = AOPOBJ_DATA_VALID;
@@ -335,10 +334,9 @@ acpi_rs_set_srs_method_data (
335 info.parameters = params; 334 info.parameters = params;
336 info.parameter_type = ACPI_PARAM_ARGS; 335 info.parameter_type = ACPI_PARAM_ARGS;
337 336
338 /* 337 /* Execute the method, no return value */
339 * Execute the method, no return value 338
340 */ 339 status = acpi_ns_evaluate_relative (METHOD_NAME__SRS, &info);
341 status = acpi_ns_evaluate_relative ("_SRS", &info);
342 if (ACPI_SUCCESS (status)) { 340 if (ACPI_SUCCESS (status)) {
343 /* Delete any return object (especially if implicit_return is enabled) */ 341 /* Delete any return object (especially if implicit_return is enabled) */
344 342
@@ -347,9 +345,8 @@ acpi_rs_set_srs_method_data (
347 } 345 }
348 } 346 }
349 347
350 /* 348 /* Clean up and return the status from acpi_ns_evaluate_relative */
351 * Clean up and return the status from acpi_ns_evaluate_relative 349
352 */
353 acpi_ut_remove_reference (params[0]); 350 acpi_ut_remove_reference (params[0]);
354 return_ACPI_STATUS (status); 351 return_ACPI_STATUS (status);
355} 352}
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c
index a9cdcbeb3432..83c944b8b097 100644
--- a/drivers/acpi/resources/rsxface.c
+++ b/drivers/acpi/resources/rsxface.c
@@ -49,6 +49,23 @@
49#define _COMPONENT ACPI_RESOURCES 49#define _COMPONENT ACPI_RESOURCES
50 ACPI_MODULE_NAME ("rsxface") 50 ACPI_MODULE_NAME ("rsxface")
51 51
52/* Local macros for 16,32-bit to 64-bit conversion */
53
54#define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field)
55#define ACPI_COPY_ADDRESS(out, in) \
56 ACPI_COPY_FIELD(out, in, resource_type); \
57 ACPI_COPY_FIELD(out, in, producer_consumer); \
58 ACPI_COPY_FIELD(out, in, decode); \
59 ACPI_COPY_FIELD(out, in, min_address_fixed); \
60 ACPI_COPY_FIELD(out, in, max_address_fixed); \
61 ACPI_COPY_FIELD(out, in, attribute); \
62 ACPI_COPY_FIELD(out, in, granularity); \
63 ACPI_COPY_FIELD(out, in, min_address_range); \
64 ACPI_COPY_FIELD(out, in, max_address_range); \
65 ACPI_COPY_FIELD(out, in, address_translation_offset); \
66 ACPI_COPY_FIELD(out, in, address_length); \
67 ACPI_COPY_FIELD(out, in, resource_source);
68
52 69
53/******************************************************************************* 70/*******************************************************************************
54 * 71 *
@@ -180,6 +197,7 @@ EXPORT_SYMBOL(acpi_get_current_resources);
180 * and the value of ret_buffer is undefined. 197 * and the value of ret_buffer is undefined.
181 * 198 *
182 ******************************************************************************/ 199 ******************************************************************************/
200
183#ifdef ACPI_FUTURE_USAGE 201#ifdef ACPI_FUTURE_USAGE
184acpi_status 202acpi_status
185acpi_get_possible_resources ( 203acpi_get_possible_resources (
@@ -346,9 +364,8 @@ acpi_set_current_resources (
346 ACPI_FUNCTION_TRACE ("acpi_set_current_resources"); 364 ACPI_FUNCTION_TRACE ("acpi_set_current_resources");
347 365
348 366
349 /* 367 /* Must have a valid handle and buffer */
350 * Must have a valid handle and buffer 368
351 */
352 if ((!device_handle) || 369 if ((!device_handle) ||
353 (!in_buffer) || 370 (!in_buffer) ||
354 (!in_buffer->pointer) || 371 (!in_buffer->pointer) ||
@@ -362,21 +379,6 @@ acpi_set_current_resources (
362EXPORT_SYMBOL(acpi_set_current_resources); 379EXPORT_SYMBOL(acpi_set_current_resources);
363 380
364 381
365#define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field)
366#define ACPI_COPY_ADDRESS(out, in) \
367 ACPI_COPY_FIELD(out, in, resource_type); \
368 ACPI_COPY_FIELD(out, in, producer_consumer); \
369 ACPI_COPY_FIELD(out, in, decode); \
370 ACPI_COPY_FIELD(out, in, min_address_fixed); \
371 ACPI_COPY_FIELD(out, in, max_address_fixed); \
372 ACPI_COPY_FIELD(out, in, attribute); \
373 ACPI_COPY_FIELD(out, in, granularity); \
374 ACPI_COPY_FIELD(out, in, min_address_range); \
375 ACPI_COPY_FIELD(out, in, max_address_range); \
376 ACPI_COPY_FIELD(out, in, address_translation_offset); \
377 ACPI_COPY_FIELD(out, in, address_length); \
378 ACPI_COPY_FIELD(out, in, resource_source);
379
380/****************************************************************************** 382/******************************************************************************
381 * 383 *
382 * FUNCTION: acpi_resource_to_address64 384 * FUNCTION: acpi_resource_to_address64
@@ -408,14 +410,14 @@ acpi_resource_to_address64 (
408 case ACPI_RSTYPE_ADDRESS16: 410 case ACPI_RSTYPE_ADDRESS16:
409 411
410 address16 = (struct acpi_resource_address16 *) &resource->data; 412 address16 = (struct acpi_resource_address16 *) &resource->data;
411 ACPI_COPY_ADDRESS(out, address16); 413 ACPI_COPY_ADDRESS (out, address16);
412 break; 414 break;
413 415
414 416
415 case ACPI_RSTYPE_ADDRESS32: 417 case ACPI_RSTYPE_ADDRESS32:
416 418
417 address32 = (struct acpi_resource_address32 *) &resource->data; 419 address32 = (struct acpi_resource_address32 *) &resource->data;
418 ACPI_COPY_ADDRESS(out, address32); 420 ACPI_COPY_ADDRESS (out, address32);
419 break; 421 break;
420 422
421 423
@@ -434,4 +436,3 @@ acpi_resource_to_address64 (
434 return (AE_OK); 436 return (AE_OK);
435} 437}
436EXPORT_SYMBOL(acpi_resource_to_address64); 438EXPORT_SYMBOL(acpi_resource_to_address64);
437
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c
index 334327c1f66f..92e0c31539be 100644
--- a/drivers/acpi/tables/tbconvrt.c
+++ b/drivers/acpi/tables/tbconvrt.c
@@ -50,6 +50,24 @@
50#define _COMPONENT ACPI_TABLES 50#define _COMPONENT ACPI_TABLES
51 ACPI_MODULE_NAME ("tbconvrt") 51 ACPI_MODULE_NAME ("tbconvrt")
52 52
53/* Local prototypes */
54
55static void
56acpi_tb_init_generic_address (
57 struct acpi_generic_address *new_gas_struct,
58 u8 register_bit_width,
59 acpi_physical_address address);
60
61static void
62acpi_tb_convert_fadt1 (
63 struct fadt_descriptor_rev2 *local_fadt,
64 struct fadt_descriptor_rev1 *original_fadt);
65
66static void
67acpi_tb_convert_fadt2 (
68 struct fadt_descriptor_rev2 *local_fadt,
69 struct fadt_descriptor_rev2 *original_fadt);
70
53 71
54u8 acpi_fadt_is_v1; 72u8 acpi_fadt_is_v1;
55EXPORT_SYMBOL(acpi_fadt_is_v1); 73EXPORT_SYMBOL(acpi_fadt_is_v1);
@@ -142,11 +160,13 @@ acpi_tb_convert_to_xsdt (
142 for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { 160 for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
143 if (acpi_gbl_RSDP->revision < 2) { 161 if (acpi_gbl_RSDP->revision < 2) {
144 ACPI_STORE_ADDRESS (new_table->table_offset_entry[i], 162 ACPI_STORE_ADDRESS (new_table->table_offset_entry[i],
145 (ACPI_CAST_PTR (struct rsdt_descriptor_rev1, table_info->pointer))->table_offset_entry[i]); 163 (ACPI_CAST_PTR (struct rsdt_descriptor_rev1,
164 table_info->pointer))->table_offset_entry[i]);
146 } 165 }
147 else { 166 else {
148 new_table->table_offset_entry[i] = 167 new_table->table_offset_entry[i] =
149 (ACPI_CAST_PTR (XSDT_DESCRIPTOR, table_info->pointer))->table_offset_entry[i]; 168 (ACPI_CAST_PTR (XSDT_DESCRIPTOR,
169 table_info->pointer))->table_offset_entry[i];
150 } 170 }
151 } 171 }
152 172
@@ -164,7 +184,7 @@ acpi_tb_convert_to_xsdt (
164} 184}
165 185
166 186
167/****************************************************************************** 187/*******************************************************************************
168 * 188 *
169 * FUNCTION: acpi_tb_init_generic_address 189 * FUNCTION: acpi_tb_init_generic_address
170 * 190 *
@@ -201,7 +221,7 @@ acpi_tb_init_generic_address (
201 * PARAMETERS: local_fadt - Pointer to new FADT 221 * PARAMETERS: local_fadt - Pointer to new FADT
202 * original_fadt - Pointer to old FADT 222 * original_fadt - Pointer to old FADT
203 * 223 *
204 * RETURN: Populates local_fadt 224 * RETURN: None, populates local_fadt
205 * 225 *
206 * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format 226 * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format
207 * 227 *
@@ -213,7 +233,6 @@ acpi_tb_convert_fadt1 (
213 struct fadt_descriptor_rev1 *original_fadt) 233 struct fadt_descriptor_rev1 *original_fadt)
214{ 234{
215 235
216
217 /* ACPI 1.0 FACS */ 236 /* ACPI 1.0 FACS */
218 /* The BIOS stored FADT should agree with Revision 1.0 */ 237 /* The BIOS stored FADT should agree with Revision 1.0 */
219 acpi_fadt_is_v1 = 1; 238 acpi_fadt_is_v1 = 1;
@@ -232,7 +251,8 @@ acpi_tb_convert_fadt1 (
232 ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt); 251 ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt);
233 252
234 /* 253 /*
235 * System Interrupt Model isn't used in ACPI 2.0 (local_fadt->Reserved1 = 0;) 254 * System Interrupt Model isn't used in ACPI 2.0
255 * (local_fadt->Reserved1 = 0;)
236 */ 256 */
237 257
238 /* 258 /*
@@ -269,7 +289,8 @@ acpi_tb_convert_fadt1 (
269 * that immediately follows. 289 * that immediately follows.
270 */ 290 */
271 ACPI_MEMCPY (&local_fadt->reset_register, 291 ACPI_MEMCPY (&local_fadt->reset_register,
272 &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus, original_fadt))->reset_register, 292 &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus,
293 original_fadt))->reset_register,
273 sizeof (struct acpi_generic_address) + 1); 294 sizeof (struct acpi_generic_address) + 1);
274 } 295 }
275 else { 296 else {
@@ -304,7 +325,8 @@ acpi_tb_convert_fadt1 (
304 325
305 acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, 326 acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable,
306 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), 327 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
307 (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + 328 (acpi_physical_address)
329 (local_fadt->xpm1a_evt_blk.address +
308 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); 330 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
309 331
310 /* PM1B is optional; leave null if not present */ 332 /* PM1B is optional; leave null if not present */
@@ -312,7 +334,8 @@ acpi_tb_convert_fadt1 (
312 if (local_fadt->xpm1b_evt_blk.address) { 334 if (local_fadt->xpm1b_evt_blk.address) {
313 acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, 335 acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable,
314 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), 336 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
315 (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + 337 (acpi_physical_address)
338 (local_fadt->xpm1b_evt_blk.address +
316 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); 339 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
317 } 340 }
318} 341}
@@ -325,7 +348,7 @@ acpi_tb_convert_fadt1 (
325 * PARAMETERS: local_fadt - Pointer to new FADT 348 * PARAMETERS: local_fadt - Pointer to new FADT
326 * original_fadt - Pointer to old FADT 349 * original_fadt - Pointer to old FADT
327 * 350 *
328 * RETURN: Populates local_fadt 351 * RETURN: None, populates local_fadt
329 * 352 *
330 * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format. 353 * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format.
331 * Handles optional "X" fields. 354 * Handles optional "X" fields.
@@ -348,7 +371,8 @@ acpi_tb_convert_fadt2 (
348 * is zero. 371 * is zero.
349 */ 372 */
350 if (!(local_fadt->xfirmware_ctrl)) { 373 if (!(local_fadt->xfirmware_ctrl)) {
351 ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, local_fadt->V1_firmware_ctrl); 374 ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl,
375 local_fadt->V1_firmware_ctrl);
352 } 376 }
353 377
354 if (!(local_fadt->Xdsdt)) { 378 if (!(local_fadt->Xdsdt)) {
@@ -357,32 +381,38 @@ acpi_tb_convert_fadt2 (
357 381
358 if (!(local_fadt->xpm1a_evt_blk.address)) { 382 if (!(local_fadt->xpm1a_evt_blk.address)) {
359 acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, 383 acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk,
360 local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); 384 local_fadt->pm1_evt_len,
385 (acpi_physical_address) local_fadt->V1_pm1a_evt_blk);
361 } 386 }
362 387
363 if (!(local_fadt->xpm1b_evt_blk.address)) { 388 if (!(local_fadt->xpm1b_evt_blk.address)) {
364 acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, 389 acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk,
365 local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); 390 local_fadt->pm1_evt_len,
391 (acpi_physical_address) local_fadt->V1_pm1b_evt_blk);
366 } 392 }
367 393
368 if (!(local_fadt->xpm1a_cnt_blk.address)) { 394 if (!(local_fadt->xpm1a_cnt_blk.address)) {
369 acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, 395 acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk,
370 local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); 396 local_fadt->pm1_cnt_len,
397 (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk);
371 } 398 }
372 399
373 if (!(local_fadt->xpm1b_cnt_blk.address)) { 400 if (!(local_fadt->xpm1b_cnt_blk.address)) {
374 acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, 401 acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk,
375 local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); 402 local_fadt->pm1_cnt_len,
403 (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk);
376 } 404 }
377 405
378 if (!(local_fadt->xpm2_cnt_blk.address)) { 406 if (!(local_fadt->xpm2_cnt_blk.address)) {
379 acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, 407 acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk,
380 local_fadt->pm2_cnt_len, (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); 408 local_fadt->pm2_cnt_len,
409 (acpi_physical_address) local_fadt->V1_pm2_cnt_blk);
381 } 410 }
382 411
383 if (!(local_fadt->xpm_tmr_blk.address)) { 412 if (!(local_fadt->xpm_tmr_blk.address)) {
384 acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, 413 acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk,
385 local_fadt->pm_tm_len, (acpi_physical_address) local_fadt->V1_pm_tmr_blk); 414 local_fadt->pm_tm_len,
415 (acpi_physical_address) local_fadt->V1_pm_tmr_blk);
386 } 416 }
387 417
388 if (!(local_fadt->xgpe0_blk.address)) { 418 if (!(local_fadt->xgpe0_blk.address)) {
@@ -399,18 +429,24 @@ acpi_tb_convert_fadt2 (
399 429
400 acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, 430 acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable,
401 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), 431 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
402 (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + 432 (acpi_physical_address)
433 (local_fadt->xpm1a_evt_blk.address +
403 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); 434 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
404 acpi_gbl_xpm1a_enable.address_space_id = local_fadt->xpm1a_evt_blk.address_space_id; 435
436 acpi_gbl_xpm1a_enable.address_space_id =
437 local_fadt->xpm1a_evt_blk.address_space_id;
405 438
406 /* PM1B is optional; leave null if not present */ 439 /* PM1B is optional; leave null if not present */
407 440
408 if (local_fadt->xpm1b_evt_blk.address) { 441 if (local_fadt->xpm1b_evt_blk.address) {
409 acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, 442 acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable,
410 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), 443 (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
411 (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + 444 (acpi_physical_address)
445 (local_fadt->xpm1b_evt_blk.address +
412 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); 446 ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
413 acpi_gbl_xpm1b_enable.address_space_id = local_fadt->xpm1b_evt_blk.address_space_id; 447
448 acpi_gbl_xpm1b_enable.address_space_id =
449 local_fadt->xpm1b_evt_blk.address_space_id;
414 } 450 }
415} 451}
416 452
@@ -432,7 +468,8 @@ acpi_tb_convert_fadt2 (
432 ******************************************************************************/ 468 ******************************************************************************/
433 469
434acpi_status 470acpi_status
435acpi_tb_convert_table_fadt (void) 471acpi_tb_convert_table_fadt (
472 void)
436{ 473{
437 struct fadt_descriptor_rev2 *local_fadt; 474 struct fadt_descriptor_rev2 *local_fadt;
438 struct acpi_table_desc *table_desc; 475 struct acpi_table_desc *table_desc;
@@ -446,7 +483,8 @@ acpi_tb_convert_table_fadt (void)
446 * at least as long as the version 1.0 FADT 483 * at least as long as the version 1.0 FADT
447 */ 484 */
448 if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) { 485 if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) {
449 ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n", acpi_gbl_FADT->length)); 486 ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n",
487 acpi_gbl_FADT->length));
450 return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); 488 return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
451 } 489 }
452 490
@@ -461,8 +499,9 @@ acpi_tb_convert_table_fadt (void)
461 if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) { 499 if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) {
462 /* Length is too short to be a V2.0 table */ 500 /* Length is too short to be a V2.0 table */
463 501
464 ACPI_REPORT_WARNING (("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", 502 ACPI_REPORT_WARNING ((
465 acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); 503 "Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n",
504 acpi_gbl_FADT->length, acpi_gbl_FADT->revision));
466 505
467 acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); 506 acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT);
468 } 507 }
@@ -478,9 +517,8 @@ acpi_tb_convert_table_fadt (void)
478 acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); 517 acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT);
479 } 518 }
480 519
481 /* 520 /* Global FADT pointer will point to the new common V2.0 FADT */
482 * Global FADT pointer will point to the new common V2.0 FADT 521
483 */
484 acpi_gbl_FADT = local_fadt; 522 acpi_gbl_FADT = local_fadt;
485 acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR); 523 acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR);
486 524
@@ -508,7 +546,7 @@ acpi_tb_convert_table_fadt (void)
508 546
509/******************************************************************************* 547/*******************************************************************************
510 * 548 *
511 * FUNCTION: acpi_tb_convert_table_facs 549 * FUNCTION: acpi_tb_build_common_facs
512 * 550 *
513 * PARAMETERS: table_info - Info for currently installed FACS 551 * PARAMETERS: table_info - Info for currently installed FACS
514 * 552 *
@@ -530,12 +568,14 @@ acpi_tb_build_common_facs (
530 /* Absolute minimum length is 24, but the ACPI spec says 64 */ 568 /* Absolute minimum length is 24, but the ACPI spec says 64 */
531 569
532 if (acpi_gbl_FACS->length < 24) { 570 if (acpi_gbl_FACS->length < 24) {
533 ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", acpi_gbl_FACS->length)); 571 ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n",
572 acpi_gbl_FACS->length));
534 return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); 573 return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
535 } 574 }
536 575
537 if (acpi_gbl_FACS->length < 64) { 576 if (acpi_gbl_FACS->length < 64) {
538 ACPI_REPORT_WARNING (("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", 577 ACPI_REPORT_WARNING ((
578 "FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n",
539 acpi_gbl_FACS->length)); 579 acpi_gbl_FACS->length));
540 } 580 }
541 581
@@ -548,7 +588,8 @@ acpi_tb_build_common_facs (
548 (!(acpi_gbl_FACS->xfirmware_waking_vector))) { 588 (!(acpi_gbl_FACS->xfirmware_waking_vector))) {
549 /* ACPI 1.0 FACS or short table or optional X_ field is zero */ 589 /* ACPI 1.0 FACS or short table or optional X_ field is zero */
550 590
551 acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64, &(acpi_gbl_FACS->firmware_waking_vector)); 591 acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64,
592 &(acpi_gbl_FACS->firmware_waking_vector));
552 acpi_gbl_common_fACS.vector_width = 32; 593 acpi_gbl_common_fACS.vector_width = 32;
553 } 594 }
554 else { 595 else {
diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c
index 896f3ddda62e..4ab2aadc6133 100644
--- a/drivers/acpi/tables/tbget.c
+++ b/drivers/acpi/tables/tbget.c
@@ -49,6 +49,19 @@
49#define _COMPONENT ACPI_TABLES 49#define _COMPONENT ACPI_TABLES
50 ACPI_MODULE_NAME ("tbget") 50 ACPI_MODULE_NAME ("tbget")
51 51
52/* Local prototypes */
53
54static acpi_status
55acpi_tb_get_this_table (
56 struct acpi_pointer *address,
57 struct acpi_table_header *header,
58 struct acpi_table_desc *table_info);
59
60static acpi_status
61acpi_tb_table_override (
62 struct acpi_table_header *header,
63 struct acpi_table_desc *table_info);
64
52 65
53/******************************************************************************* 66/*******************************************************************************
54 * 67 *
@@ -76,9 +89,8 @@ acpi_tb_get_table (
76 ACPI_FUNCTION_TRACE ("tb_get_table"); 89 ACPI_FUNCTION_TRACE ("tb_get_table");
77 90
78 91
79 /* 92 /* Get the header in order to get signature and table size */
80 * Get the header in order to get signature and table size 93
81 */
82 status = acpi_tb_get_table_header (address, &header); 94 status = acpi_tb_get_table_header (address, &header);
83 if (ACPI_FAILURE (status)) { 95 if (ACPI_FAILURE (status)) {
84 return_ACPI_STATUS (status); 96 return_ACPI_STATUS (status);
@@ -127,8 +139,8 @@ acpi_tb_get_table_header (
127 139
128 140
129 /* 141 /*
130 * Flags contains the current processor mode (Virtual or Physical addressing) 142 * Flags contains the current processor mode (Virtual or Physical
131 * The pointer_type is either Logical or Physical 143 * addressing) The pointer_type is either Logical or Physical
132 */ 144 */
133 switch (address->pointer_type) { 145 switch (address->pointer_type) {
134 case ACPI_PHYSMODE_PHYSPTR: 146 case ACPI_PHYSMODE_PHYSPTR:
@@ -136,7 +148,8 @@ acpi_tb_get_table_header (
136 148
137 /* Pointer matches processor mode, copy the header */ 149 /* Pointer matches processor mode, copy the header */
138 150
139 ACPI_MEMCPY (return_header, address->pointer.logical, sizeof (struct acpi_table_header)); 151 ACPI_MEMCPY (return_header, address->pointer.logical,
152 sizeof (struct acpi_table_header));
140 break; 153 break;
141 154
142 155
@@ -144,10 +157,11 @@ acpi_tb_get_table_header (
144 157
145 /* Create a logical address for the physical pointer*/ 158 /* Create a logical address for the physical pointer*/
146 159
147 status = acpi_os_map_memory (address->pointer.physical, sizeof (struct acpi_table_header), 160 status = acpi_os_map_memory (address->pointer.physical,
148 (void *) &header); 161 sizeof (struct acpi_table_header), (void *) &header);
149 if (ACPI_FAILURE (status)) { 162 if (ACPI_FAILURE (status)) {
150 ACPI_REPORT_ERROR (("Could not map memory at %8.8X%8.8X for length %X\n", 163 ACPI_REPORT_ERROR ((
164 "Could not map memory at %8.8X%8.8X for length %X\n",
151 ACPI_FORMAT_UINT64 (address->pointer.physical), 165 ACPI_FORMAT_UINT64 (address->pointer.physical),
152 sizeof (struct acpi_table_header))); 166 sizeof (struct acpi_table_header)));
153 return_ACPI_STATUS (status); 167 return_ACPI_STATUS (status);
@@ -210,9 +224,8 @@ acpi_tb_get_table_body (
210 return_ACPI_STATUS (AE_BAD_PARAMETER); 224 return_ACPI_STATUS (AE_BAD_PARAMETER);
211 } 225 }
212 226
213 /* 227 /* Attempt table override. */
214 * Attempt table override. 228
215 */
216 status = acpi_tb_table_override (header, table_info); 229 status = acpi_tb_table_override (header, table_info);
217 if (ACPI_SUCCESS (status)) { 230 if (ACPI_SUCCESS (status)) {
218 /* Table was overridden by the host OS */ 231 /* Table was overridden by the host OS */
@@ -241,7 +254,7 @@ acpi_tb_get_table_body (
241 * 254 *
242 ******************************************************************************/ 255 ******************************************************************************/
243 256
244acpi_status 257static acpi_status
245acpi_tb_table_override ( 258acpi_tb_table_override (
246 struct acpi_table_header *header, 259 struct acpi_table_header *header,
247 struct acpi_table_desc *table_info) 260 struct acpi_table_desc *table_info)
@@ -315,7 +328,7 @@ acpi_tb_table_override (
315 * 328 *
316 ******************************************************************************/ 329 ******************************************************************************/
317 330
318acpi_status 331static acpi_status
319acpi_tb_get_this_table ( 332acpi_tb_get_this_table (
320 struct acpi_pointer *address, 333 struct acpi_pointer *address,
321 struct acpi_table_header *header, 334 struct acpi_table_header *header,
@@ -330,8 +343,8 @@ acpi_tb_get_this_table (
330 343
331 344
332 /* 345 /*
333 * Flags contains the current processor mode (Virtual or Physical addressing) 346 * Flags contains the current processor mode (Virtual or Physical
334 * The pointer_type is either Logical or Physical 347 * addressing) The pointer_type is either Logical or Physical
335 */ 348 */
336 switch (address->pointer_type) { 349 switch (address->pointer_type) {
337 case ACPI_PHYSMODE_PHYSPTR: 350 case ACPI_PHYSMODE_PHYSPTR:
@@ -341,7 +354,8 @@ acpi_tb_get_this_table (
341 354
342 full_table = ACPI_MEM_ALLOCATE (header->length); 355 full_table = ACPI_MEM_ALLOCATE (header->length);
343 if (!full_table) { 356 if (!full_table) {
344 ACPI_REPORT_ERROR (("Could not allocate table memory for [%4.4s] length %X\n", 357 ACPI_REPORT_ERROR ((
358 "Could not allocate table memory for [%4.4s] length %X\n",
345 header->signature, header->length)); 359 header->signature, header->length));
346 return_ACPI_STATUS (AE_NO_MEMORY); 360 return_ACPI_STATUS (AE_NO_MEMORY);
347 } 361 }
@@ -362,12 +376,14 @@ acpi_tb_get_this_table (
362 * Just map the table's physical memory 376 * Just map the table's physical memory
363 * into our address space. 377 * into our address space.
364 */ 378 */
365 status = acpi_os_map_memory (address->pointer.physical, (acpi_size) header->length, 379 status = acpi_os_map_memory (address->pointer.physical,
366 (void *) &full_table); 380 (acpi_size) header->length, (void *) &full_table);
367 if (ACPI_FAILURE (status)) { 381 if (ACPI_FAILURE (status)) {
368 ACPI_REPORT_ERROR (("Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", 382 ACPI_REPORT_ERROR ((
383 "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n",
369 header->signature, 384 header->signature,
370 ACPI_FORMAT_UINT64 (address->pointer.physical), header->length)); 385 ACPI_FORMAT_UINT64 (address->pointer.physical),
386 header->length));
371 return (status); 387 return (status);
372 } 388 }
373 389
@@ -465,9 +481,8 @@ acpi_tb_get_table_ptr (
465 return_ACPI_STATUS (AE_OK); 481 return_ACPI_STATUS (AE_OK);
466 } 482 }
467 483
468 /* 484 /* Check for instance out of range */
469 * Check for instance out of range 485
470 */
471 if (instance > acpi_gbl_table_lists[table_type].count) { 486 if (instance > acpi_gbl_table_lists[table_type].count) {
472 return_ACPI_STATUS (AE_NOT_EXIST); 487 return_ACPI_STATUS (AE_NOT_EXIST);
473 } 488 }
diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c
index adc4270988bc..eea5b8cb5ebb 100644
--- a/drivers/acpi/tables/tbgetall.c
+++ b/drivers/acpi/tables/tbgetall.c
@@ -49,6 +49,19 @@
49#define _COMPONENT ACPI_TABLES 49#define _COMPONENT ACPI_TABLES
50 ACPI_MODULE_NAME ("tbgetall") 50 ACPI_MODULE_NAME ("tbgetall")
51 51
52/* Local prototypes */
53
54static acpi_status
55acpi_tb_get_primary_table (
56 struct acpi_pointer *address,
57 struct acpi_table_desc *table_info);
58
59static acpi_status
60acpi_tb_get_secondary_table (
61 struct acpi_pointer *address,
62 acpi_string signature,
63 struct acpi_table_desc *table_info);
64
52 65
53/******************************************************************************* 66/*******************************************************************************
54 * 67 *
@@ -63,7 +76,7 @@
63 * 76 *
64 ******************************************************************************/ 77 ******************************************************************************/
65 78
66acpi_status 79static acpi_status
67acpi_tb_get_primary_table ( 80acpi_tb_get_primary_table (
68 struct acpi_pointer *address, 81 struct acpi_pointer *address,
69 struct acpi_table_desc *table_info) 82 struct acpi_table_desc *table_info)
@@ -81,9 +94,8 @@ acpi_tb_get_primary_table (
81 return_ACPI_STATUS (AE_OK); 94 return_ACPI_STATUS (AE_OK);
82 } 95 }
83 96
84 /* 97 /* Get the header in order to get signature and table size */
85 * Get the header in order to get signature and table size 98
86 */
87 status = acpi_tb_get_table_header (address, &header); 99 status = acpi_tb_get_table_header (address, &header);
88 if (ACPI_FAILURE (status)) { 100 if (ACPI_FAILURE (status)) {
89 return_ACPI_STATUS (status); 101 return_ACPI_STATUS (status);
@@ -130,7 +142,7 @@ acpi_tb_get_primary_table (
130 * 142 *
131 ******************************************************************************/ 143 ******************************************************************************/
132 144
133acpi_status 145static acpi_status
134acpi_tb_get_secondary_table ( 146acpi_tb_get_secondary_table (
135 struct acpi_pointer *address, 147 struct acpi_pointer *address,
136 acpi_string signature, 148 acpi_string signature,
@@ -153,7 +165,8 @@ acpi_tb_get_secondary_table (
153 /* Signature must match request */ 165 /* Signature must match request */
154 166
155 if (ACPI_STRNCMP (header.signature, signature, ACPI_NAME_SIZE)) { 167 if (ACPI_STRNCMP (header.signature, signature, ACPI_NAME_SIZE)) {
156 ACPI_REPORT_ERROR (("Incorrect table signature - wanted [%s] found [%4.4s]\n", 168 ACPI_REPORT_ERROR ((
169 "Incorrect table signature - wanted [%s] found [%4.4s]\n",
157 signature, header.signature)); 170 signature, header.signature));
158 return_ACPI_STATUS (AE_BAD_SIGNATURE); 171 return_ACPI_STATUS (AE_BAD_SIGNATURE);
159 } 172 }
@@ -230,7 +243,8 @@ acpi_tb_get_required_tables (
230 for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { 243 for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
231 /* Get the table address from the common internal XSDT */ 244 /* Get the table address from the common internal XSDT */
232 245
233 address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; 246 address.pointer.value =
247 acpi_gbl_XSDT->table_offset_entry[i];
234 248
235 /* 249 /*
236 * Get the tables needed by this subsystem (FADT and any SSDTs). 250 * Get the tables needed by this subsystem (FADT and any SSDTs).
@@ -252,18 +266,18 @@ acpi_tb_get_required_tables (
252 } 266 }
253 267
254 /* 268 /*
255 * Convert the FADT to a common format. This allows earlier revisions of the 269 * Convert the FADT to a common format. This allows earlier revisions of
256 * table to coexist with newer versions, using common access code. 270 * the table to coexist with newer versions, using common access code.
257 */ 271 */
258 status = acpi_tb_convert_table_fadt (); 272 status = acpi_tb_convert_table_fadt ();
259 if (ACPI_FAILURE (status)) { 273 if (ACPI_FAILURE (status)) {
260 ACPI_REPORT_ERROR (("Could not convert FADT to internal common format\n")); 274 ACPI_REPORT_ERROR ((
275 "Could not convert FADT to internal common format\n"));
261 return_ACPI_STATUS (status); 276 return_ACPI_STATUS (status);
262 } 277 }
263 278
264 /* 279 /* Get the FACS (Pointed to by the FADT) */
265 * Get the FACS (Pointed to by the FADT) 280
266 */
267 address.pointer.value = acpi_gbl_FADT->xfirmware_ctrl; 281 address.pointer.value = acpi_gbl_FADT->xfirmware_ctrl;
268 282
269 status = acpi_tb_get_secondary_table (&address, FACS_SIG, &table_info); 283 status = acpi_tb_get_secondary_table (&address, FACS_SIG, &table_info);
@@ -282,9 +296,8 @@ acpi_tb_get_required_tables (
282 return_ACPI_STATUS (status); 296 return_ACPI_STATUS (status);
283 } 297 }
284 298
285 /* 299 /* Get/install the DSDT (Pointed to by the FADT) */
286 * Get/install the DSDT (Pointed to by the FADT) 300
287 */
288 address.pointer.value = acpi_gbl_FADT->Xdsdt; 301 address.pointer.value = acpi_gbl_FADT->Xdsdt;
289 302
290 status = acpi_tb_get_secondary_table (&address, DSDT_SIG, &table_info); 303 status = acpi_tb_get_secondary_table (&address, DSDT_SIG, &table_info);
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
index 85d5bb01022c..629b64c8193d 100644
--- a/drivers/acpi/tables/tbinstal.c
+++ b/drivers/acpi/tables/tbinstal.c
@@ -49,6 +49,14 @@
49#define _COMPONENT ACPI_TABLES 49#define _COMPONENT ACPI_TABLES
50 ACPI_MODULE_NAME ("tbinstal") 50 ACPI_MODULE_NAME ("tbinstal")
51 51
52/* Local prototypes */
53
54static acpi_status
55acpi_tb_match_signature (
56 char *signature,
57 struct acpi_table_desc *table_info,
58 u8 search_type);
59
52 60
53/******************************************************************************* 61/*******************************************************************************
54 * 62 *
@@ -56,6 +64,7 @@
56 * 64 *
57 * PARAMETERS: Signature - Table signature to match 65 * PARAMETERS: Signature - Table signature to match
58 * table_info - Return data 66 * table_info - Return data
67 * search_type - Table type to match (primary/secondary)
59 * 68 *
60 * RETURN: Status 69 * RETURN: Status
61 * 70 *
@@ -64,7 +73,7 @@
64 * 73 *
65 ******************************************************************************/ 74 ******************************************************************************/
66 75
67acpi_status 76static acpi_status
68acpi_tb_match_signature ( 77acpi_tb_match_signature (
69 char *signature, 78 char *signature,
70 struct acpi_table_desc *table_info, 79 struct acpi_table_desc *table_info,
@@ -76,9 +85,8 @@ acpi_tb_match_signature (
76 ACPI_FUNCTION_TRACE ("tb_match_signature"); 85 ACPI_FUNCTION_TRACE ("tb_match_signature");
77 86
78 87
79 /* 88 /* Search for a signature match among the known table types */
80 * Search for a signature match among the known table types 89
81 */
82 for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { 90 for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) {
83 if (!(acpi_gbl_table_data[i].flags & search_type)) { 91 if (!(acpi_gbl_table_data[i].flags & search_type)) {
84 continue; 92 continue;
@@ -161,6 +169,7 @@ acpi_tb_install_table (
161 * FUNCTION: acpi_tb_recognize_table 169 * FUNCTION: acpi_tb_recognize_table
162 * 170 *
163 * PARAMETERS: table_info - Return value from acpi_tb_get_table_body 171 * PARAMETERS: table_info - Return value from acpi_tb_get_table_body
172 * search_type - Table type to match (primary/secondary)
164 * 173 *
165 * RETURN: Status 174 * RETURN: Status
166 * 175 *
@@ -203,7 +212,8 @@ acpi_tb_recognize_table (
203 * This can be any one of many valid ACPI tables, it just isn't one of 212 * This can be any one of many valid ACPI tables, it just isn't one of
204 * the tables that is consumed by the core subsystem 213 * the tables that is consumed by the core subsystem
205 */ 214 */
206 status = acpi_tb_match_signature (table_header->signature, table_info, search_type); 215 status = acpi_tb_match_signature (table_header->signature,
216 table_info, search_type);
207 if (ACPI_FAILURE (status)) { 217 if (ACPI_FAILURE (status)) {
208 return_ACPI_STATUS (status); 218 return_ACPI_STATUS (status);
209 } 219 }
@@ -253,9 +263,8 @@ acpi_tb_init_table_descriptor (
253 return_ACPI_STATUS (AE_NO_MEMORY); 263 return_ACPI_STATUS (AE_NO_MEMORY);
254 } 264 }
255 265
256 /* 266 /* Install the table into the global data structure */
257 * Install the table into the global data structure 267
258 */
259 list_head = &acpi_gbl_table_lists[table_type]; 268 list_head = &acpi_gbl_table_lists[table_type];
260 269
261 /* 270 /*
@@ -316,7 +325,8 @@ acpi_tb_init_table_descriptor (
316 table_desc->aml_start = (u8 *) (table_desc->pointer + 1), 325 table_desc->aml_start = (u8 *) (table_desc->pointer + 1),
317 table_desc->aml_length = (u32) (table_desc->length - 326 table_desc->aml_length = (u32) (table_desc->length -
318 (u32) sizeof (struct acpi_table_header)); 327 (u32) sizeof (struct acpi_table_header));
319 table_desc->table_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_TABLE); 328 table_desc->table_id = acpi_ut_allocate_owner_id (
329 ACPI_OWNER_TYPE_TABLE);
320 table_desc->loaded_into_namespace = FALSE; 330 table_desc->loaded_into_namespace = FALSE;
321 331
322 /* 332 /*
@@ -349,7 +359,8 @@ acpi_tb_init_table_descriptor (
349 ******************************************************************************/ 359 ******************************************************************************/
350 360
351void 361void
352acpi_tb_delete_all_tables (void) 362acpi_tb_delete_all_tables (
363 void)
353{ 364{
354 acpi_table_type type; 365 acpi_table_type type;
355 366
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c
index 9c6913238d52..b7ffe39c3626 100644
--- a/drivers/acpi/tables/tbrsdt.c
+++ b/drivers/acpi/tables/tbrsdt.c
@@ -84,8 +84,9 @@ acpi_tb_verify_rsdp (
84 /* 84 /*
85 * Obtain access to the RSDP structure 85 * Obtain access to the RSDP structure
86 */ 86 */
87 status = acpi_os_map_memory (address->pointer.physical, sizeof (struct rsdp_descriptor), 87 status = acpi_os_map_memory (address->pointer.physical,
88 (void *) &rsdp); 88 sizeof (struct rsdp_descriptor),
89 (void *) &rsdp);
89 if (ACPI_FAILURE (status)) { 90 if (ACPI_FAILURE (status)) {
90 return_ACPI_STATUS (status); 91 return_ACPI_STATUS (status);
91 } 92 }
@@ -154,9 +155,9 @@ cleanup:
154 * 155 *
155 * FUNCTION: acpi_tb_get_rsdt_address 156 * FUNCTION: acpi_tb_get_rsdt_address
156 * 157 *
157 * PARAMETERS: None 158 * PARAMETERS: out_address - Where the address is returned
158 * 159 *
159 * RETURN: RSDT physical address 160 * RETURN: None, Address
160 * 161 *
161 * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the 162 * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the
162 * version of the RSDP 163 * version of the RSDP
@@ -181,7 +182,8 @@ acpi_tb_get_rsdt_address (
181 out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address; 182 out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address;
182 } 183 }
183 else { 184 else {
184 out_address->pointer.value = acpi_gbl_RSDP->xsdt_physical_address; 185 out_address->pointer.value =
186 acpi_gbl_RSDP->xsdt_physical_address;
185 } 187 }
186} 188}
187 189
@@ -224,7 +226,8 @@ acpi_tb_validate_rsdt (
224 if (no_match) { 226 if (no_match) {
225 /* Invalid RSDT or XSDT signature */ 227 /* Invalid RSDT or XSDT signature */
226 228
227 ACPI_REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); 229 ACPI_REPORT_ERROR ((
230 "Invalid signature where RSDP indicates RSDT/XSDT should be located\n"));
228 231
229 ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20); 232 ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20);
230 233
@@ -282,6 +285,7 @@ acpi_tb_get_table_rsdt (
282 if (ACPI_FAILURE (status)) { 285 if (ACPI_FAILURE (status)) {
283 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n", 286 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n",
284 acpi_format_exception (status))); 287 acpi_format_exception (status)));
288
285 return_ACPI_STATUS (status); 289 return_ACPI_STATUS (status);
286 } 290 }
287 291
@@ -299,7 +303,8 @@ acpi_tb_get_table_rsdt (
299 303
300 /* Get the number of tables defined in the RSDT or XSDT */ 304 /* Get the number of tables defined in the RSDT or XSDT */
301 305
302 acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, table_info.pointer); 306 acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP,
307 table_info.pointer);
303 308
304 /* Convert and/or copy to an XSDT structure */ 309 /* Convert and/or copy to an XSDT structure */
305 310
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index fede5804c783..e69d01d443d2 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -49,48 +49,14 @@
49#define _COMPONENT ACPI_TABLES 49#define _COMPONENT ACPI_TABLES
50 ACPI_MODULE_NAME ("tbutils") 50 ACPI_MODULE_NAME ("tbutils")
51 51
52/* Local prototypes */
52 53
53/******************************************************************************* 54#ifdef ACPI_OBSOLETE_FUNCTIONS
54 *
55 * FUNCTION: acpi_tb_handle_to_object
56 *
57 * PARAMETERS: table_id - Id for which the function is searching
58 * table_desc - Pointer to return the matching table
59 * descriptor.
60 *
61 * RETURN: Search the tables to find one with a matching table_id and
62 * return a pointer to that table descriptor.
63 *
64 ******************************************************************************/
65#ifdef ACPI_FUTURE_USAGE
66acpi_status 55acpi_status
67acpi_tb_handle_to_object ( 56acpi_tb_handle_to_object (
68 u16 table_id, 57 u16 table_id,
69 struct acpi_table_desc **return_table_desc) 58 struct acpi_table_desc **table_desc);
70{ 59#endif
71 u32 i;
72 struct acpi_table_desc *table_desc;
73
74
75 ACPI_FUNCTION_NAME ("tb_handle_to_object");
76
77
78 for (i = 0; i < ACPI_TABLE_MAX; i++) {
79 table_desc = acpi_gbl_table_lists[i].next;
80 while (table_desc) {
81 if (table_desc->table_id == table_id) {
82 *return_table_desc = table_desc;
83 return (AE_OK);
84 }
85
86 table_desc = table_desc->next;
87 }
88 }
89
90 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id));
91 return (AE_BAD_PARAMETER);
92}
93#endif /* ACPI_FUTURE_USAGE */
94 60
95 61
96/******************************************************************************* 62/*******************************************************************************
@@ -128,6 +94,7 @@ acpi_tb_validate_table_header (
128 if (!acpi_os_readable (table_header, sizeof (struct acpi_table_header))) { 94 if (!acpi_os_readable (table_header, sizeof (struct acpi_table_header))) {
129 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 95 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
130 "Cannot read table header at %p\n", table_header)); 96 "Cannot read table header at %p\n", table_header));
97
131 return (AE_BAD_ADDRESS); 98 return (AE_BAD_ADDRESS);
132 } 99 }
133 100
@@ -141,6 +108,7 @@ acpi_tb_validate_table_header (
141 108
142 ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", 109 ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n",
143 (char *) &signature)); 110 (char *) &signature));
111
144 ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); 112 ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header));
145 return (AE_BAD_SIGNATURE); 113 return (AE_BAD_SIGNATURE);
146 } 114 }
@@ -154,6 +122,7 @@ acpi_tb_validate_table_header (
154 122
155 ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", 123 ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n",
156 (u32) table_header->length)); 124 (u32) table_header->length));
125
157 ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); 126 ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header));
158 return (AE_BAD_HEADER); 127 return (AE_BAD_HEADER);
159 } 128 }
@@ -193,8 +162,10 @@ acpi_tb_verify_table_checksum (
193 /* Return the appropriate exception */ 162 /* Return the appropriate exception */
194 163
195 if (checksum) { 164 if (checksum) {
196 ACPI_REPORT_WARNING (("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", 165 ACPI_REPORT_WARNING ((
197 table_header->signature, (u32) table_header->checksum, (u32) checksum)); 166 "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n",
167 table_header->signature, (u32) table_header->checksum,
168 (u32) checksum));
198 169
199 status = AE_BAD_CHECKSUM; 170 status = AE_BAD_CHECKSUM;
200 } 171 }
@@ -209,7 +180,7 @@ acpi_tb_verify_table_checksum (
209 * PARAMETERS: Buffer - Buffer to checksum 180 * PARAMETERS: Buffer - Buffer to checksum
210 * Length - Size of the buffer 181 * Length - Size of the buffer
211 * 182 *
212 * RETURNS 8 bit checksum of buffer 183 * RETURN: 8 bit checksum of buffer
213 * 184 *
214 * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it. 185 * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it.
215 * 186 *
@@ -238,3 +209,47 @@ acpi_tb_checksum (
238} 209}
239 210
240 211
212#ifdef ACPI_OBSOLETE_FUNCTIONS
213/*******************************************************************************
214 *
215 * FUNCTION: acpi_tb_handle_to_object
216 *
217 * PARAMETERS: table_id - Id for which the function is searching
218 * table_desc - Pointer to return the matching table
219 * descriptor.
220 *
221 * RETURN: Search the tables to find one with a matching table_id and
222 * return a pointer to that table descriptor.
223 *
224 ******************************************************************************/
225
226acpi_status
227acpi_tb_handle_to_object (
228 u16 table_id,
229 struct acpi_table_desc **return_table_desc)
230{
231 u32 i;
232 struct acpi_table_desc *table_desc;
233
234
235 ACPI_FUNCTION_NAME ("tb_handle_to_object");
236
237
238 for (i = 0; i < ACPI_TABLE_MAX; i++) {
239 table_desc = acpi_gbl_table_lists[i].next;
240 while (table_desc) {
241 if (table_desc->table_id == table_id) {
242 *return_table_desc = table_desc;
243 return (AE_OK);
244 }
245
246 table_desc = table_desc->next;
247 }
248 }
249
250 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id));
251 return (AE_BAD_PARAMETER);
252}
253#endif
254
255
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index 7715043461c4..0c0b9085dbeb 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -67,7 +67,8 @@
67 ******************************************************************************/ 67 ******************************************************************************/
68 68
69acpi_status 69acpi_status
70acpi_load_tables (void) 70acpi_load_tables (
71 void)
71{ 72{
72 struct acpi_pointer rsdp_address; 73 struct acpi_pointer rsdp_address;
73 acpi_status status; 74 acpi_status status;
@@ -82,7 +83,7 @@ acpi_load_tables (void)
82 &rsdp_address); 83 &rsdp_address);
83 if (ACPI_FAILURE (status)) { 84 if (ACPI_FAILURE (status)) {
84 ACPI_REPORT_ERROR (("acpi_load_tables: Could not get RSDP, %s\n", 85 ACPI_REPORT_ERROR (("acpi_load_tables: Could not get RSDP, %s\n",
85 acpi_format_exception (status))); 86 acpi_format_exception (status)));
86 goto error_exit; 87 goto error_exit;
87 } 88 }
88 89
@@ -93,7 +94,7 @@ acpi_load_tables (void)
93 status = acpi_tb_verify_rsdp (&rsdp_address); 94 status = acpi_tb_verify_rsdp (&rsdp_address);
94 if (ACPI_FAILURE (status)) { 95 if (ACPI_FAILURE (status)) {
95 ACPI_REPORT_ERROR (("acpi_load_tables: RSDP Failed validation: %s\n", 96 ACPI_REPORT_ERROR (("acpi_load_tables: RSDP Failed validation: %s\n",
96 acpi_format_exception (status))); 97 acpi_format_exception (status)));
97 goto error_exit; 98 goto error_exit;
98 } 99 }
99 100
@@ -102,7 +103,7 @@ acpi_load_tables (void)
102 status = acpi_tb_get_table_rsdt (); 103 status = acpi_tb_get_table_rsdt ();
103 if (ACPI_FAILURE (status)) { 104 if (ACPI_FAILURE (status)) {
104 ACPI_REPORT_ERROR (("acpi_load_tables: Could not load RSDT: %s\n", 105 ACPI_REPORT_ERROR (("acpi_load_tables: Could not load RSDT: %s\n",
105 acpi_format_exception (status))); 106 acpi_format_exception (status)));
106 goto error_exit; 107 goto error_exit;
107 } 108 }
108 109
@@ -110,20 +111,20 @@ acpi_load_tables (void)
110 111
111 status = acpi_tb_get_required_tables (); 112 status = acpi_tb_get_required_tables ();
112 if (ACPI_FAILURE (status)) { 113 if (ACPI_FAILURE (status)) {
113 ACPI_REPORT_ERROR (("acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", 114 ACPI_REPORT_ERROR ((
114 acpi_format_exception (status))); 115 "acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n",
116 acpi_format_exception (status)));
115 goto error_exit; 117 goto error_exit;
116 } 118 }
117 119
118 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); 120 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
119 121
120
121 /* Load the namespace from the tables */ 122 /* Load the namespace from the tables */
122 123
123 status = acpi_ns_load_namespace (); 124 status = acpi_ns_load_namespace ();
124 if (ACPI_FAILURE (status)) { 125 if (ACPI_FAILURE (status)) {
125 ACPI_REPORT_ERROR (("acpi_load_tables: Could not load namespace: %s\n", 126 ACPI_REPORT_ERROR (("acpi_load_tables: Could not load namespace: %s\n",
126 acpi_format_exception (status))); 127 acpi_format_exception (status)));
127 goto error_exit; 128 goto error_exit;
128 } 129 }
129 130
@@ -139,7 +140,6 @@ error_exit:
139 140
140 141
141#ifdef ACPI_FUTURE_USAGE 142#ifdef ACPI_FUTURE_USAGE
142
143/******************************************************************************* 143/*******************************************************************************
144 * 144 *
145 * FUNCTION: acpi_load_table 145 * FUNCTION: acpi_load_table
@@ -250,7 +250,6 @@ acpi_unload_table (
250 return_ACPI_STATUS (AE_BAD_PARAMETER); 250 return_ACPI_STATUS (AE_BAD_PARAMETER);
251 } 251 }
252 252
253
254 /* Find all tables of the requested type */ 253 /* Find all tables of the requested type */
255 254
256 table_desc = acpi_gbl_table_lists[table_type].next; 255 table_desc = acpi_gbl_table_lists[table_type].next;
@@ -321,7 +320,6 @@ acpi_get_table_header (
321 return_ACPI_STATUS (AE_BAD_PARAMETER); 320 return_ACPI_STATUS (AE_BAD_PARAMETER);
322 } 321 }
323 322
324
325 /* Get a pointer to the entire table */ 323 /* Get a pointer to the entire table */
326 324
327 status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); 325 status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr);
@@ -329,23 +327,20 @@ acpi_get_table_header (
329 return_ACPI_STATUS (status); 327 return_ACPI_STATUS (status);
330 } 328 }
331 329
332 /* 330 /* The function will return a NULL pointer if the table is not loaded */
333 * The function will return a NULL pointer if the table is not loaded 331
334 */
335 if (tbl_ptr == NULL) { 332 if (tbl_ptr == NULL) {
336 return_ACPI_STATUS (AE_NOT_EXIST); 333 return_ACPI_STATUS (AE_NOT_EXIST);
337 } 334 }
338 335
339 /* 336 /* Copy the header to the caller's buffer */
340 * Copy the header to the caller's buffer 337
341 */
342 ACPI_MEMCPY ((void *) out_table_header, (void *) tbl_ptr, 338 ACPI_MEMCPY ((void *) out_table_header, (void *) tbl_ptr,
343 sizeof (struct acpi_table_header)); 339 sizeof (struct acpi_table_header));
344 340
345 return_ACPI_STATUS (status); 341 return_ACPI_STATUS (status);
346} 342}
347 343
348
349#endif /* ACPI_FUTURE_USAGE */ 344#endif /* ACPI_FUTURE_USAGE */
350 345
351/******************************************************************************* 346/*******************************************************************************
@@ -404,7 +399,6 @@ acpi_get_table (
404 return_ACPI_STATUS (AE_BAD_PARAMETER); 399 return_ACPI_STATUS (AE_BAD_PARAMETER);
405 } 400 }
406 401
407
408 /* Get a pointer to the entire table */ 402 /* Get a pointer to the entire table */
409 403
410 status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); 404 status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr);
@@ -423,9 +417,8 @@ acpi_get_table (
423 /* Get the table length */ 417 /* Get the table length */
424 418
425 if (table_type == ACPI_TABLE_RSDP) { 419 if (table_type == ACPI_TABLE_RSDP) {
426 /* 420 /* RSD PTR is the only "table" without a header */
427 * RSD PTR is the only "table" without a header 421
428 */
429 table_length = sizeof (struct rsdp_descriptor); 422 table_length = sizeof (struct rsdp_descriptor);
430 } 423 }
431 else { 424 else {
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
index 6e8072ebbac6..dc3c3f6a9f62 100644
--- a/drivers/acpi/tables/tbxfroot.c
+++ b/drivers/acpi/tables/tbxfroot.c
@@ -50,6 +50,18 @@
50#define _COMPONENT ACPI_TABLES 50#define _COMPONENT ACPI_TABLES
51 ACPI_MODULE_NAME ("tbxfroot") 51 ACPI_MODULE_NAME ("tbxfroot")
52 52
53/* Local prototypes */
54
55static acpi_status
56acpi_tb_find_rsdp (
57 struct acpi_table_desc *table_info,
58 u32 flags);
59
60static u8 *
61acpi_tb_scan_memory_for_rsdp (
62 u8 *start_address,
63 u32 length);
64
53 65
54/******************************************************************************* 66/*******************************************************************************
55 * 67 *
@@ -57,7 +69,8 @@
57 * 69 *
58 * PARAMETERS: Signature - String with ACPI table signature 70 * PARAMETERS: Signature - String with ACPI table signature
59 * oem_id - String with the table OEM ID 71 * oem_id - String with the table OEM ID
60 * oem_table_id - String with the OEM Table ID. 72 * oem_table_id - String with the OEM Table ID
73 * table_ptr - Where the table pointer is returned
61 * 74 *
62 * RETURN: Status 75 * RETURN: Status
63 * 76 *
@@ -99,14 +112,13 @@ acpi_tb_find_table (
99 if (!acpi_gbl_DSDT) { 112 if (!acpi_gbl_DSDT) {
100 return_ACPI_STATUS (AE_NO_ACPI_TABLES); 113 return_ACPI_STATUS (AE_NO_ACPI_TABLES);
101 } 114 }
102
103 table = acpi_gbl_DSDT; 115 table = acpi_gbl_DSDT;
104 } 116 }
105 else { 117 else {
106 /* Find the table */ 118 /* Find the table */
107 119
108 status = acpi_get_firmware_table (signature, 1, 120 status = acpi_get_firmware_table (signature, 1,
109 ACPI_LOGICAL_ADDRESSING, &table); 121 ACPI_LOGICAL_ADDRESSING, &table);
110 if (ACPI_FAILURE (status)) { 122 if (ACPI_FAILURE (status)) {
111 return_ACPI_STATUS (status); 123 return_ACPI_STATUS (status);
112 } 124 }
@@ -114,14 +126,19 @@ acpi_tb_find_table (
114 126
115 /* Check oem_id and oem_table_id */ 127 /* Check oem_id and oem_table_id */
116 128
117 if ((oem_id[0] && ACPI_STRNCMP ( 129 if ((oem_id[0] && ACPI_STRNCMP (
118 oem_id, table->oem_id, sizeof (table->oem_id))) || 130 oem_id, table->oem_id,
131 sizeof (table->oem_id))) ||
132
119 (oem_table_id[0] && ACPI_STRNCMP ( 133 (oem_table_id[0] && ACPI_STRNCMP (
120 oem_table_id, table->oem_table_id, sizeof (table->oem_table_id)))) { 134 oem_table_id, table->oem_table_id,
135 sizeof (table->oem_table_id)))) {
121 return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND); 136 return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND);
122 } 137 }
123 138
124 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", table->signature)); 139 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n",
140 table->signature));
141
125 *table_ptr = table; 142 *table_ptr = table;
126 return_ACPI_STATUS (AE_OK); 143 return_ACPI_STATUS (AE_OK);
127} 144}
@@ -191,8 +208,8 @@ acpi_get_firmware_table (
191 /* Map and validate the RSDP */ 208 /* Map and validate the RSDP */
192 209
193 if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { 210 if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
194 status = acpi_os_map_memory (address.pointer.physical, sizeof (struct rsdp_descriptor), 211 status = acpi_os_map_memory (address.pointer.physical,
195 (void *) &acpi_gbl_RSDP); 212 sizeof (struct rsdp_descriptor), (void *) &acpi_gbl_RSDP);
196 if (ACPI_FAILURE (status)) { 213 if (ACPI_FAILURE (status)) {
197 return_ACPI_STATUS (status); 214 return_ACPI_STATUS (status);
198 } 215 }
@@ -203,7 +220,8 @@ acpi_get_firmware_table (
203 220
204 /* The signature and checksum must both be correct */ 221 /* The signature and checksum must both be correct */
205 222
206 if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { 223 if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG,
224 sizeof (RSDP_SIG)-1) != 0) {
207 /* Nope, BAD Signature */ 225 /* Nope, BAD Signature */
208 226
209 return_ACPI_STATUS (AE_BAD_SIGNATURE); 227 return_ACPI_STATUS (AE_BAD_SIGNATURE);
@@ -313,7 +331,8 @@ acpi_get_firmware_table (
313 331
314 332
315cleanup: 333cleanup:
316 acpi_os_unmap_memory (rsdt_info->pointer, (acpi_size) rsdt_info->pointer->length); 334 acpi_os_unmap_memory (rsdt_info->pointer,
335 (acpi_size) rsdt_info->pointer->length);
317 ACPI_MEM_FREE (rsdt_info); 336 ACPI_MEM_FREE (rsdt_info);
318 337
319 if (header) { 338 if (header) {
@@ -335,8 +354,8 @@ EXPORT_SYMBOL(acpi_get_firmware_table);
335 * 354 *
336 * FUNCTION: acpi_find_root_pointer 355 * FUNCTION: acpi_find_root_pointer
337 * 356 *
338 * PARAMETERS: **rsdp_address - Where to place the RSDP address 357 * PARAMETERS: Flags - Logical/Physical addressing
339 * Flags - Logical/Physical addressing 358 * rsdp_address - Where to place the RSDP address
340 * 359 *
341 * RETURN: Status, Physical address of the RSDP 360 * RETURN: Status, Physical address of the RSDP
342 * 361 *
@@ -363,6 +382,7 @@ acpi_find_root_pointer (
363 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 382 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
364 "RSDP structure not found, %s Flags=%X\n", 383 "RSDP structure not found, %s Flags=%X\n",
365 acpi_format_exception (status), flags)); 384 acpi_format_exception (status), flags));
385
366 return_ACPI_STATUS (AE_NO_ACPI_TABLES); 386 return_ACPI_STATUS (AE_NO_ACPI_TABLES);
367 } 387 }
368 388
@@ -385,7 +405,7 @@ acpi_find_root_pointer (
385 * 405 *
386 ******************************************************************************/ 406 ******************************************************************************/
387 407
388u8 * 408static u8 *
389acpi_tb_scan_memory_for_rsdp ( 409acpi_tb_scan_memory_for_rsdp (
390 u8 *start_address, 410 u8 *start_address,
391 u32 length) 411 u32 length)
@@ -406,7 +426,8 @@ acpi_tb_scan_memory_for_rsdp (
406 mem_rover += ACPI_RSDP_SCAN_STEP) { 426 mem_rover += ACPI_RSDP_SCAN_STEP) {
407 /* The signature and checksum must both be correct */ 427 /* The signature and checksum must both be correct */
408 428
409 if (ACPI_STRNCMP ((char *) mem_rover, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { 429 if (ACPI_STRNCMP ((char *) mem_rover,
430 RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0) {
410 /* No signature match, keep looking */ 431 /* No signature match, keep looking */
411 432
412 continue; 433 continue;
@@ -450,7 +471,7 @@ acpi_tb_scan_memory_for_rsdp (
450 * 471 *
451 * FUNCTION: acpi_tb_find_rsdp 472 * FUNCTION: acpi_tb_find_rsdp
452 * 473 *
453 * PARAMETERS: *table_info - Where the table info is returned 474 * PARAMETERS: table_info - Where the table info is returned
454 * Flags - Current memory mode (logical vs. 475 * Flags - Current memory mode (logical vs.
455 * physical addressing) 476 * physical addressing)
456 * 477 *
@@ -468,7 +489,7 @@ acpi_tb_scan_memory_for_rsdp (
468 * 489 *
469 ******************************************************************************/ 490 ******************************************************************************/
470 491
471acpi_status 492static acpi_status
472acpi_tb_find_rsdp ( 493acpi_tb_find_rsdp (
473 struct acpi_table_desc *table_info, 494 struct acpi_table_desc *table_info,
474 u32 flags) 495 u32 flags)
@@ -483,43 +504,49 @@ acpi_tb_find_rsdp (
483 504
484 505
485 /* 506 /*
486 * Scan supports either 1) Logical addressing or 2) Physical addressing 507 * Scan supports either logical addressing or physical addressing
487 */ 508 */
488 if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { 509 if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
489 /* 510 /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */
490 * 1a) Get the location of the EBDA 511
491 */ 512 status = acpi_os_map_memory (
492 status = acpi_os_map_memory ((acpi_physical_address) ACPI_EBDA_PTR_LOCATION, 513 (acpi_physical_address) ACPI_EBDA_PTR_LOCATION,
493 ACPI_EBDA_PTR_LENGTH, 514 ACPI_EBDA_PTR_LENGTH, (void *) &table_ptr);
494 (void *) &table_ptr);
495 if (ACPI_FAILURE (status)) { 515 if (ACPI_FAILURE (status)) {
496 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 516 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
497 "Could not map memory at %8.8X for length %X\n", 517 "Could not map memory at %8.8X for length %X\n",
498 ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); 518 ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH));
519
499 return_ACPI_STATUS (status); 520 return_ACPI_STATUS (status);
500 } 521 }
501 522
502 ACPI_MOVE_16_TO_32 (&physical_address, table_ptr); 523 ACPI_MOVE_16_TO_32 (&physical_address, table_ptr);
503 physical_address <<= 4; /* Convert segment to physical address */ 524
525 /* Convert segment part to physical address */
526
527 physical_address <<= 4;
504 acpi_os_unmap_memory (table_ptr, ACPI_EBDA_PTR_LENGTH); 528 acpi_os_unmap_memory (table_ptr, ACPI_EBDA_PTR_LENGTH);
505 529
506 /* EBDA present? */ 530 /* EBDA present? */
507 531
508 if (physical_address > 0x400) { 532 if (physical_address > 0x400) {
509 /* 533 /*
510 * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of 1_k length) 534 * 1b) Search EBDA paragraphs (EBDa is required to be a
535 * minimum of 1_k length)
511 */ 536 */
512 status = acpi_os_map_memory ((acpi_physical_address) physical_address, 537 status = acpi_os_map_memory (
513 ACPI_EBDA_WINDOW_SIZE, 538 (acpi_physical_address) physical_address,
514 (void *) &table_ptr); 539 ACPI_EBDA_WINDOW_SIZE, (void *) &table_ptr);
515 if (ACPI_FAILURE (status)) { 540 if (ACPI_FAILURE (status)) {
516 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 541 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
517 "Could not map memory at %8.8X for length %X\n", 542 "Could not map memory at %8.8X for length %X\n",
518 physical_address, ACPI_EBDA_WINDOW_SIZE)); 543 physical_address, ACPI_EBDA_WINDOW_SIZE));
544
519 return_ACPI_STATUS (status); 545 return_ACPI_STATUS (status);
520 } 546 }
521 547
522 mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, ACPI_EBDA_WINDOW_SIZE); 548 mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr,
549 ACPI_EBDA_WINDOW_SIZE);
523 acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE); 550 acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE);
524 551
525 if (mem_rover) { 552 if (mem_rover) {
@@ -527,7 +554,8 @@ acpi_tb_find_rsdp (
527 554
528 physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr); 555 physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr);
529 556
530 table_info->physical_address = (acpi_physical_address) physical_address; 557 table_info->physical_address =
558 (acpi_physical_address) physical_address;
531 return_ACPI_STATUS (AE_OK); 559 return_ACPI_STATUS (AE_OK);
532 } 560 }
533 } 561 }
@@ -535,13 +563,15 @@ acpi_tb_find_rsdp (
535 /* 563 /*
536 * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh 564 * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
537 */ 565 */
538 status = acpi_os_map_memory ((acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE, 566 status = acpi_os_map_memory (
539 ACPI_HI_RSDP_WINDOW_SIZE, 567 (acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE,
540 (void *) &table_ptr); 568 ACPI_HI_RSDP_WINDOW_SIZE, (void *) &table_ptr);
569
541 if (ACPI_FAILURE (status)) { 570 if (ACPI_FAILURE (status)) {
542 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 571 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
543 "Could not map memory at %8.8X for length %X\n", 572 "Could not map memory at %8.8X for length %X\n",
544 ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); 573 ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
574
545 return_ACPI_STATUS (status); 575 return_ACPI_STATUS (status);
546 } 576 }
547 577
@@ -551,9 +581,11 @@ acpi_tb_find_rsdp (
551 if (mem_rover) { 581 if (mem_rover) {
552 /* Found it, return the physical address */ 582 /* Found it, return the physical address */
553 583
554 physical_address = ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr); 584 physical_address =
585 ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr);
555 586
556 table_info->physical_address = (acpi_physical_address) physical_address; 587 table_info->physical_address =
588 (acpi_physical_address) physical_address;
557 return_ACPI_STATUS (AE_OK); 589 return_ACPI_STATUS (AE_OK);
558 } 590 }
559 } 591 }
@@ -562,9 +594,8 @@ acpi_tb_find_rsdp (
562 * Physical addressing 594 * Physical addressing
563 */ 595 */
564 else { 596 else {
565 /* 597 /* 1a) Get the location of the EBDA */
566 * 1a) Get the location of the EBDA 598
567 */
568 ACPI_MOVE_16_TO_32 (&physical_address, ACPI_EBDA_PTR_LOCATION); 599 ACPI_MOVE_16_TO_32 (&physical_address, ACPI_EBDA_PTR_LOCATION);
569 physical_address <<= 4; /* Convert segment to physical address */ 600 physical_address <<= 4; /* Convert segment to physical address */
570 601
@@ -572,9 +603,11 @@ acpi_tb_find_rsdp (
572 603
573 if (physical_address > 0x400) { 604 if (physical_address > 0x400) {
574 /* 605 /*
575 * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of 1_k length) 606 * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of
607 * 1_k length)
576 */ 608 */
577 mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (physical_address), 609 mem_rover = acpi_tb_scan_memory_for_rsdp (
610 ACPI_PHYSADDR_TO_PTR (physical_address),
578 ACPI_EBDA_WINDOW_SIZE); 611 ACPI_EBDA_WINDOW_SIZE);
579 if (mem_rover) { 612 if (mem_rover) {
580 /* Found it, return the physical address */ 613 /* Found it, return the physical address */
@@ -584,10 +617,10 @@ acpi_tb_find_rsdp (
584 } 617 }
585 } 618 }
586 619
587 /* 620 /* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */
588 * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh 621
589 */ 622 mem_rover = acpi_tb_scan_memory_for_rsdp (
590 mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE), 623 ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE),
591 ACPI_HI_RSDP_WINDOW_SIZE); 624 ACPI_HI_RSDP_WINDOW_SIZE);
592 if (mem_rover) { 625 if (mem_rover) {
593 /* Found it, return the physical address */ 626 /* Found it, return the physical address */
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index 3313439c4bc7..c4e7f989a2bd 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -47,8 +47,35 @@
47#define _COMPONENT ACPI_UTILITIES 47#define _COMPONENT ACPI_UTILITIES
48 ACPI_MODULE_NAME ("utalloc") 48 ACPI_MODULE_NAME ("utalloc")
49 49
50/* Local prototypes */
50 51
51/****************************************************************************** 52#ifdef ACPI_DBG_TRACK_ALLOCATIONS
53static struct acpi_debug_mem_block *
54acpi_ut_find_allocation (
55 u32 list_id,
56 void *allocation);
57
58static acpi_status
59acpi_ut_track_allocation (
60 u32 list_id,
61 struct acpi_debug_mem_block *address,
62 acpi_size size,
63 u8 alloc_type,
64 u32 component,
65 char *module,
66 u32 line);
67
68static acpi_status
69acpi_ut_remove_allocation (
70 u32 list_id,
71 struct acpi_debug_mem_block *address,
72 u32 component,
73 char *module,
74 u32 line);
75#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
76
77
78/*******************************************************************************
52 * 79 *
53 * FUNCTION: acpi_ut_release_to_cache 80 * FUNCTION: acpi_ut_release_to_cache
54 * 81 *
@@ -98,7 +125,8 @@ acpi_ut_release_to_cache (
98 125
99 /* Put the object at the head of the cache list */ 126 /* Put the object at the head of the cache list */
100 127
101 * (ACPI_CAST_INDIRECT_PTR (char, &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head; 128 * (ACPI_CAST_INDIRECT_PTR (char,
129 &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head;
102 cache_info->list_head = object; 130 cache_info->list_head = object;
103 cache_info->cache_depth++; 131 cache_info->cache_depth++;
104 132
@@ -115,7 +143,7 @@ acpi_ut_release_to_cache (
115} 143}
116 144
117 145
118/****************************************************************************** 146/*******************************************************************************
119 * 147 *
120 * FUNCTION: acpi_ut_acquire_from_cache 148 * FUNCTION: acpi_ut_acquire_from_cache
121 * 149 *
@@ -156,7 +184,8 @@ acpi_ut_acquire_from_cache (
156 /* There is an object available, use it */ 184 /* There is an object available, use it */
157 185
158 object = cache_info->list_head; 186 object = cache_info->list_head;
159 cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) object)[cache_info->link_offset]))); 187 cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char,
188 &(((char *) object)[cache_info->link_offset])));
160 189
161 ACPI_MEM_TRACKING (cache_info->cache_hits++); 190 ACPI_MEM_TRACKING (cache_info->cache_hits++);
162 cache_info->cache_depth--; 191 cache_info->cache_depth--;
@@ -201,7 +230,7 @@ acpi_ut_acquire_from_cache (
201 230
202 231
203#ifdef ACPI_ENABLE_OBJECT_CACHE 232#ifdef ACPI_ENABLE_OBJECT_CACHE
204/****************************************************************************** 233/*******************************************************************************
205 * 234 *
206 * FUNCTION: acpi_ut_delete_generic_cache 235 * FUNCTION: acpi_ut_delete_generic_cache
207 * 236 *
@@ -228,7 +257,8 @@ acpi_ut_delete_generic_cache (
228 while (cache_info->list_head) { 257 while (cache_info->list_head) {
229 /* Delete one cached state object */ 258 /* Delete one cached state object */
230 259
231 next = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) cache_info->list_head)[cache_info->link_offset]))); 260 next = *(ACPI_CAST_INDIRECT_PTR (char,
261 &(((char *) cache_info->list_head)[cache_info->link_offset])));
232 ACPI_MEM_FREE (cache_info->list_head); 262 ACPI_MEM_FREE (cache_info->list_head);
233 263
234 cache_info->list_head = next; 264 cache_info->list_head = next;
@@ -497,8 +527,8 @@ acpi_ut_allocate_and_track (
497 acpi_status status; 527 acpi_status status;
498 528
499 529
500 allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_header), component, 530 allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_header),
501 module, line); 531 component, module, line);
502 if (!allocation) { 532 if (!allocation) {
503 return (NULL); 533 return (NULL);
504 } 534 }
@@ -543,8 +573,8 @@ acpi_ut_callocate_and_track (
543 acpi_status status; 573 acpi_status status;
544 574
545 575
546 allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_header), component, 576 allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_header),
547 module, line); 577 component, module, line);
548 if (!allocation) { 578 if (!allocation) {
549 /* Report allocation error */ 579 /* Report allocation error */
550 580
@@ -637,7 +667,7 @@ acpi_ut_free_and_track (
637 * 667 *
638 ******************************************************************************/ 668 ******************************************************************************/
639 669
640struct acpi_debug_mem_block * 670static struct acpi_debug_mem_block *
641acpi_ut_find_allocation ( 671acpi_ut_find_allocation (
642 u32 list_id, 672 u32 list_id,
643 void *allocation) 673 void *allocation)
@@ -686,7 +716,7 @@ acpi_ut_find_allocation (
686 * 716 *
687 ******************************************************************************/ 717 ******************************************************************************/
688 718
689acpi_status 719static acpi_status
690acpi_ut_track_allocation ( 720acpi_ut_track_allocation (
691 u32 list_id, 721 u32 list_id,
692 struct acpi_debug_mem_block *allocation, 722 struct acpi_debug_mem_block *allocation,
@@ -721,10 +751,12 @@ acpi_ut_track_allocation (
721 751
722 element = acpi_ut_find_allocation (list_id, allocation); 752 element = acpi_ut_find_allocation (list_id, allocation);
723 if (element) { 753 if (element) {
724 ACPI_REPORT_ERROR (("ut_track_allocation: Allocation already present in list! (%p)\n", 754 ACPI_REPORT_ERROR ((
755 "ut_track_allocation: Allocation already present in list! (%p)\n",
725 allocation)); 756 allocation));
726 757
727 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", element, allocation)); 758 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n",
759 element, allocation));
728 760
729 goto unlock_and_exit; 761 goto unlock_and_exit;
730 } 762 }
@@ -773,7 +805,7 @@ unlock_and_exit:
773 * 805 *
774 ******************************************************************************/ 806 ******************************************************************************/
775 807
776acpi_status 808static acpi_status
777acpi_ut_remove_allocation ( 809acpi_ut_remove_allocation (
778 u32 list_id, 810 u32 list_id,
779 struct acpi_debug_mem_block *allocation, 811 struct acpi_debug_mem_block *allocation,
@@ -797,7 +829,7 @@ acpi_ut_remove_allocation (
797 /* No allocations! */ 829 /* No allocations! */
798 830
799 _ACPI_REPORT_ERROR (module, line, component, 831 _ACPI_REPORT_ERROR (module, line, component,
800 ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); 832 ("ut_remove_allocation: Empty allocation list, nothing to free!\n"));
801 833
802 return_ACPI_STATUS (AE_OK); 834 return_ACPI_STATUS (AE_OK);
803 } 835 }
@@ -824,7 +856,8 @@ acpi_ut_remove_allocation (
824 856
825 ACPI_MEMSET (&allocation->user_space, 0xEA, allocation->size); 857 ACPI_MEMSET (&allocation->user_space, 0xEA, allocation->size);
826 858
827 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", allocation->size)); 859 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n",
860 allocation->size));
828 861
829 status = acpi_ut_release_mutex (ACPI_MTX_MEMORY); 862 status = acpi_ut_release_mutex (ACPI_MTX_MEMORY);
830 return_ACPI_STATUS (status); 863 return_ACPI_STATUS (status);
@@ -842,6 +875,7 @@ acpi_ut_remove_allocation (
842 * DESCRIPTION: Print some info about the outstanding allocations. 875 * DESCRIPTION: Print some info about the outstanding allocations.
843 * 876 *
844 ******************************************************************************/ 877 ******************************************************************************/
878
845#ifdef ACPI_FUTURE_USAGE 879#ifdef ACPI_FUTURE_USAGE
846void 880void
847acpi_ut_dump_allocation_info ( 881acpi_ut_dump_allocation_info (
@@ -884,7 +918,8 @@ acpi_ut_dump_allocation_info (
884 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, 918 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
885 ("%30s: %4d (%3d Kb)\n", "Max Nodes", 919 ("%30s: %4d (%3d Kb)\n", "Max Nodes",
886 acpi_gbl_max_concurrent_node_count, 920 acpi_gbl_max_concurrent_node_count,
887 ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * sizeof (struct acpi_namespace_node))))); 921 ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count *
922 sizeof (struct acpi_namespace_node)))));
888*/ 923*/
889 return_VOID; 924 return_VOID;
890} 925}
@@ -933,26 +968,26 @@ acpi_ut_dump_allocations (
933 descriptor = ACPI_CAST_PTR (union acpi_descriptor, &element->user_space); 968 descriptor = ACPI_CAST_PTR (union acpi_descriptor, &element->user_space);
934 if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) { 969 if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) {
935 acpi_os_printf ("%p Len %04X %9.9s-%d [%s] ", 970 acpi_os_printf ("%p Len %04X %9.9s-%d [%s] ",
936 descriptor, element->size, element->module, 971 descriptor, element->size, element->module,
937 element->line, acpi_ut_get_descriptor_name (descriptor)); 972 element->line, acpi_ut_get_descriptor_name (descriptor));
938 973
939 /* Most of the elements will be Operand objects. */ 974 /* Most of the elements will be Operand objects. */
940 975
941 switch (ACPI_GET_DESCRIPTOR_TYPE (descriptor)) { 976 switch (ACPI_GET_DESCRIPTOR_TYPE (descriptor)) {
942 case ACPI_DESC_TYPE_OPERAND: 977 case ACPI_DESC_TYPE_OPERAND:
943 acpi_os_printf ("%12.12s R%hd", 978 acpi_os_printf ("%12.12s R%hd",
944 acpi_ut_get_type_name (descriptor->object.common.type), 979 acpi_ut_get_type_name (descriptor->object.common.type),
945 descriptor->object.common.reference_count); 980 descriptor->object.common.reference_count);
946 break; 981 break;
947 982
948 case ACPI_DESC_TYPE_PARSER: 983 case ACPI_DESC_TYPE_PARSER:
949 acpi_os_printf ("aml_opcode %04hX", 984 acpi_os_printf ("aml_opcode %04hX",
950 descriptor->op.asl.aml_opcode); 985 descriptor->op.asl.aml_opcode);
951 break; 986 break;
952 987
953 case ACPI_DESC_TYPE_NAMED: 988 case ACPI_DESC_TYPE_NAMED:
954 acpi_os_printf ("%4.4s", 989 acpi_os_printf ("%4.4s",
955 acpi_ut_get_node_name (&descriptor->node)); 990 acpi_ut_get_node_name (&descriptor->node));
956 break; 991 break;
957 992
958 default: 993 default:
@@ -983,6 +1018,5 @@ acpi_ut_dump_allocations (
983 return_VOID; 1018 return_VOID;
984} 1019}
985 1020
986
987#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ 1021#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */
988 1022
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
index 0fcd98bde0d1..11e884957162 100644
--- a/drivers/acpi/utilities/utcopy.c
+++ b/drivers/acpi/utilities/utcopy.c
@@ -49,21 +49,69 @@
49#define _COMPONENT ACPI_UTILITIES 49#define _COMPONENT ACPI_UTILITIES
50 ACPI_MODULE_NAME ("utcopy") 50 ACPI_MODULE_NAME ("utcopy")
51 51
52/* Local prototypes */
53
54static acpi_status
55acpi_ut_copy_isimple_to_esimple (
56 union acpi_operand_object *internal_object,
57 union acpi_object *external_object,
58 u8 *data_space,
59 acpi_size *buffer_space_used);
60
61static acpi_status
62acpi_ut_copy_ielement_to_ielement (
63 u8 object_type,
64 union acpi_operand_object *source_object,
65 union acpi_generic_state *state,
66 void *context);
67
68static acpi_status
69acpi_ut_copy_ipackage_to_epackage (
70 union acpi_operand_object *internal_object,
71 u8 *buffer,
72 acpi_size *space_used);
73
74static acpi_status
75acpi_ut_copy_esimple_to_isimple(
76 union acpi_object *user_obj,
77 union acpi_operand_object **return_obj);
78
79static acpi_status
80acpi_ut_copy_simple_object (
81 union acpi_operand_object *source_desc,
82 union acpi_operand_object *dest_desc);
83
84static acpi_status
85acpi_ut_copy_ielement_to_eelement (
86 u8 object_type,
87 union acpi_operand_object *source_object,
88 union acpi_generic_state *state,
89 void *context);
90
91static acpi_status
92acpi_ut_copy_ipackage_to_ipackage (
93 union acpi_operand_object *source_obj,
94 union acpi_operand_object *dest_obj,
95 struct acpi_walk_state *walk_state);
96
52 97
53/******************************************************************************* 98/*******************************************************************************
54 * 99 *
55 * FUNCTION: acpi_ut_copy_isimple_to_esimple 100 * FUNCTION: acpi_ut_copy_isimple_to_esimple
56 * 101 *
57 * PARAMETERS: *internal_object - Pointer to the object we are examining 102 * PARAMETERS: internal_object - Source object to be copied
58 * *Buffer - Where the object is returned 103 * external_object - Where to return the copied object
59 * *space_used - Where the data length is returned 104 * data_space - Where object data is returned (such as
105 * buffer and string data)
106 * buffer_space_used - Length of data_space that was used
60 * 107 *
61 * RETURN: Status 108 * RETURN: Status
62 * 109 *
63 * DESCRIPTION: This function is called to place a simple object in a user 110 * DESCRIPTION: This function is called to copy a simple internal object to
64 * buffer. 111 * an external object.
65 * 112 *
66 * The buffer is assumed to have sufficient space for the object. 113 * The data_space buffer is assumed to have sufficient space for
114 * the object.
67 * 115 *
68 ******************************************************************************/ 116 ******************************************************************************/
69 117
@@ -107,10 +155,12 @@ acpi_ut_copy_isimple_to_esimple (
107 155
108 external_object->string.pointer = (char *) data_space; 156 external_object->string.pointer = (char *) data_space;
109 external_object->string.length = internal_object->string.length; 157 external_object->string.length = internal_object->string.length;
110 *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD ((acpi_size) internal_object->string.length + 1); 158 *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (
159 (acpi_size) internal_object->string.length + 1);
111 160
112 ACPI_MEMCPY ((void *) data_space, (void *) internal_object->string.pointer, 161 ACPI_MEMCPY ((void *) data_space,
113 (acpi_size) internal_object->string.length + 1); 162 (void *) internal_object->string.pointer,
163 (acpi_size) internal_object->string.length + 1);
114 break; 164 break;
115 165
116 166
@@ -118,10 +168,12 @@ acpi_ut_copy_isimple_to_esimple (
118 168
119 external_object->buffer.pointer = data_space; 169 external_object->buffer.pointer = data_space;
120 external_object->buffer.length = internal_object->buffer.length; 170 external_object->buffer.length = internal_object->buffer.length;
121 *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (internal_object->string.length); 171 *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (
172 internal_object->string.length);
122 173
123 ACPI_MEMCPY ((void *) data_space, (void *) internal_object->buffer.pointer, 174 ACPI_MEMCPY ((void *) data_space,
124 internal_object->buffer.length); 175 (void *) internal_object->buffer.pointer,
176 internal_object->buffer.length);
125 break; 177 break;
126 178
127 179
@@ -194,7 +246,7 @@ acpi_ut_copy_isimple_to_esimple (
194 * 246 *
195 ******************************************************************************/ 247 ******************************************************************************/
196 248
197acpi_status 249static acpi_status
198acpi_ut_copy_ielement_to_eelement ( 250acpi_ut_copy_ielement_to_eelement (
199 u8 object_type, 251 u8 object_type,
200 union acpi_operand_object *source_object, 252 union acpi_operand_object *source_object,
@@ -213,7 +265,7 @@ acpi_ut_copy_ielement_to_eelement (
213 265
214 this_index = state->pkg.index; 266 this_index = state->pkg.index;
215 target_object = (union acpi_object *) 267 target_object = (union acpi_object *)
216 &((union acpi_object *)(state->pkg.dest_object))->package.elements[this_index]; 268 &((union acpi_object *)(state->pkg.dest_object))->package.elements[this_index];
217 269
218 switch (object_type) { 270 switch (object_type) {
219 case ACPI_COPY_TYPE_SIMPLE: 271 case ACPI_COPY_TYPE_SIMPLE:
@@ -236,7 +288,8 @@ acpi_ut_copy_ielement_to_eelement (
236 */ 288 */
237 target_object->type = ACPI_TYPE_PACKAGE; 289 target_object->type = ACPI_TYPE_PACKAGE;
238 target_object->package.count = source_object->package.count; 290 target_object->package.count = source_object->package.count;
239 target_object->package.elements = ACPI_CAST_PTR (union acpi_object, info->free_space); 291 target_object->package.elements =
292 ACPI_CAST_PTR (union acpi_object, info->free_space);
240 293
241 /* 294 /*
242 * Pass the new package object back to the package walk routine 295 * Pass the new package object back to the package walk routine
@@ -248,7 +301,8 @@ acpi_ut_copy_ielement_to_eelement (
248 * update the buffer length counter 301 * update the buffer length counter
249 */ 302 */
250 object_space = ACPI_ROUND_UP_TO_NATIVE_WORD ( 303 object_space = ACPI_ROUND_UP_TO_NATIVE_WORD (
251 (acpi_size) target_object->package.count * sizeof (union acpi_object)); 304 (acpi_size) target_object->package.count *
305 sizeof (union acpi_object));
252 break; 306 break;
253 307
254 308
@@ -266,9 +320,9 @@ acpi_ut_copy_ielement_to_eelement (
266 * 320 *
267 * FUNCTION: acpi_ut_copy_ipackage_to_epackage 321 * FUNCTION: acpi_ut_copy_ipackage_to_epackage
268 * 322 *
269 * PARAMETERS: *internal_object - Pointer to the object we are returning 323 * PARAMETERS: internal_object - Pointer to the object we are returning
270 * *Buffer - Where the object is returned 324 * Buffer - Where the object is returned
271 * *space_used - Where the object length is returned 325 * space_used - Where the object length is returned
272 * 326 *
273 * RETURN: Status 327 * RETURN: Status
274 * 328 *
@@ -304,13 +358,15 @@ acpi_ut_copy_ipackage_to_epackage (
304 * Free space begins right after the first package 358 * Free space begins right after the first package
305 */ 359 */
306 info.length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)); 360 info.length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object));
307 info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)); 361 info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (
362 sizeof (union acpi_object));
308 info.object_space = 0; 363 info.object_space = 0;
309 info.num_packages = 1; 364 info.num_packages = 1;
310 365
311 external_object->type = ACPI_GET_OBJECT_TYPE (internal_object); 366 external_object->type = ACPI_GET_OBJECT_TYPE (internal_object);
312 external_object->package.count = internal_object->package.count; 367 external_object->package.count = internal_object->package.count;
313 external_object->package.elements = ACPI_CAST_PTR (union acpi_object, info.free_space); 368 external_object->package.elements = ACPI_CAST_PTR (union acpi_object,
369 info.free_space);
314 370
315 /* 371 /*
316 * Leave room for an array of ACPI_OBJECTS in the buffer 372 * Leave room for an array of ACPI_OBJECTS in the buffer
@@ -333,8 +389,8 @@ acpi_ut_copy_ipackage_to_epackage (
333 * 389 *
334 * FUNCTION: acpi_ut_copy_iobject_to_eobject 390 * FUNCTION: acpi_ut_copy_iobject_to_eobject
335 * 391 *
336 * PARAMETERS: *internal_object - The internal object to be converted 392 * PARAMETERS: internal_object - The internal object to be converted
337 * *buffer_ptr - Where the object is returned 393 * buffer_ptr - Where the object is returned
338 * 394 *
339 * RETURN: Status 395 * RETURN: Status
340 * 396 *
@@ -367,10 +423,10 @@ acpi_ut_copy_iobject_to_eobject (
367 * Build a simple object (no nested objects) 423 * Build a simple object (no nested objects)
368 */ 424 */
369 status = acpi_ut_copy_isimple_to_esimple (internal_object, 425 status = acpi_ut_copy_isimple_to_esimple (internal_object,
370 (union acpi_object *) ret_buffer->pointer, 426 (union acpi_object *) ret_buffer->pointer,
371 ((u8 *) ret_buffer->pointer + 427 ((u8 *) ret_buffer->pointer +
372 ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object))), 428 ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object))),
373 &ret_buffer->length); 429 &ret_buffer->length);
374 /* 430 /*
375 * build simple does not include the object size in the length 431 * build simple does not include the object size in the length
376 * so we add it in here 432 * so we add it in here
@@ -386,8 +442,8 @@ acpi_ut_copy_iobject_to_eobject (
386 * 442 *
387 * FUNCTION: acpi_ut_copy_esimple_to_isimple 443 * FUNCTION: acpi_ut_copy_esimple_to_isimple
388 * 444 *
389 * PARAMETERS: *external_object - The external object to be converted 445 * PARAMETERS: external_object - The external object to be converted
390 * *internal_object - Where the internal object is returned 446 * ret_internal_object - Where the internal object is returned
391 * 447 *
392 * RETURN: Status 448 * RETURN: Status
393 * 449 *
@@ -398,7 +454,7 @@ acpi_ut_copy_iobject_to_eobject (
398 * 454 *
399 ******************************************************************************/ 455 ******************************************************************************/
400 456
401acpi_status 457static acpi_status
402acpi_ut_copy_esimple_to_isimple ( 458acpi_ut_copy_esimple_to_isimple (
403 union acpi_object *external_object, 459 union acpi_object *external_object,
404 union acpi_operand_object **ret_internal_object) 460 union acpi_operand_object **ret_internal_object)
@@ -417,7 +473,8 @@ acpi_ut_copy_esimple_to_isimple (
417 case ACPI_TYPE_BUFFER: 473 case ACPI_TYPE_BUFFER:
418 case ACPI_TYPE_INTEGER: 474 case ACPI_TYPE_INTEGER:
419 475
420 internal_object = acpi_ut_create_internal_object ((u8) external_object->type); 476 internal_object = acpi_ut_create_internal_object (
477 (u8) external_object->type);
421 if (!internal_object) { 478 if (!internal_object) {
422 return_ACPI_STATUS (AE_NO_MEMORY); 479 return_ACPI_STATUS (AE_NO_MEMORY);
423 } 480 }
@@ -486,7 +543,6 @@ error_exit:
486 543
487 544
488#ifdef ACPI_FUTURE_IMPLEMENTATION 545#ifdef ACPI_FUTURE_IMPLEMENTATION
489
490/* Code to convert packages that are parameters to control methods */ 546/* Code to convert packages that are parameters to control methods */
491 547
492/******************************************************************************* 548/*******************************************************************************
@@ -614,7 +670,7 @@ acpi_ut_copy_eobject_to_iobject (
614 * 670 *
615 ******************************************************************************/ 671 ******************************************************************************/
616 672
617acpi_status 673static acpi_status
618acpi_ut_copy_simple_object ( 674acpi_ut_copy_simple_object (
619 union acpi_operand_object *source_desc, 675 union acpi_operand_object *source_desc,
620 union acpi_operand_object *dest_desc) 676 union acpi_operand_object *dest_desc)
@@ -724,7 +780,7 @@ acpi_ut_copy_simple_object (
724 * 780 *
725 ******************************************************************************/ 781 ******************************************************************************/
726 782
727acpi_status 783static acpi_status
728acpi_ut_copy_ielement_to_ielement ( 784acpi_ut_copy_ielement_to_ielement (
729 u8 object_type, 785 u8 object_type,
730 union acpi_operand_object *source_object, 786 union acpi_operand_object *source_object,
@@ -837,7 +893,7 @@ error_exit:
837 * 893 *
838 ******************************************************************************/ 894 ******************************************************************************/
839 895
840acpi_status 896static acpi_status
841acpi_ut_copy_ipackage_to_ipackage ( 897acpi_ut_copy_ipackage_to_ipackage (
842 union acpi_operand_object *source_obj, 898 union acpi_operand_object *source_obj,
843 union acpi_operand_object *dest_obj, 899 union acpi_operand_object *dest_obj,
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
index 985c5d045b78..794c7df3f2ad 100644
--- a/drivers/acpi/utilities/utdebug.c
+++ b/drivers/acpi/utilities/utdebug.c
@@ -56,7 +56,7 @@ static char *acpi_gbl_fn_entry_str = "----Entry";
56static char *acpi_gbl_fn_exit_str = "----Exit-"; 56static char *acpi_gbl_fn_exit_str = "----Exit-";
57 57
58 58
59/***************************************************************************** 59/*******************************************************************************
60 * 60 *
61 * FUNCTION: acpi_ut_init_stack_ptr_trace 61 * FUNCTION: acpi_ut_init_stack_ptr_trace
62 * 62 *
@@ -64,9 +64,9 @@ static char *acpi_gbl_fn_exit_str = "----Exit-";
64 * 64 *
65 * RETURN: None 65 * RETURN: None
66 * 66 *
67 * DESCRIPTION: Save the current stack pointer 67 * DESCRIPTION: Save the current CPU stack pointer at subsystem startup
68 * 68 *
69 ****************************************************************************/ 69 ******************************************************************************/
70 70
71void 71void
72acpi_ut_init_stack_ptr_trace ( 72acpi_ut_init_stack_ptr_trace (
@@ -79,7 +79,7 @@ acpi_ut_init_stack_ptr_trace (
79} 79}
80 80
81 81
82/***************************************************************************** 82/*******************************************************************************
83 * 83 *
84 * FUNCTION: acpi_ut_track_stack_ptr 84 * FUNCTION: acpi_ut_track_stack_ptr
85 * 85 *
@@ -87,9 +87,9 @@ acpi_ut_init_stack_ptr_trace (
87 * 87 *
88 * RETURN: None 88 * RETURN: None
89 * 89 *
90 * DESCRIPTION: Save the current stack pointer 90 * DESCRIPTION: Save the current CPU stack pointer
91 * 91 *
92 ****************************************************************************/ 92 ******************************************************************************/
93 93
94void 94void
95acpi_ut_track_stack_ptr ( 95acpi_ut_track_stack_ptr (
@@ -110,16 +110,16 @@ acpi_ut_track_stack_ptr (
110} 110}
111 111
112 112
113/***************************************************************************** 113/*******************************************************************************
114 * 114 *
115 * FUNCTION: acpi_ut_debug_print 115 * FUNCTION: acpi_ut_debug_print
116 * 116 *
117 * PARAMETERS: debug_level - Requested debug print level 117 * PARAMETERS: requested_debug_level - Requested debug print level
118 * proc_name - Caller's procedure name
119 * module_name - Caller's module name (for error output)
120 * line_number - Caller's line number (for error output) 118 * line_number - Caller's line number (for error output)
121 * component_id - Caller's component ID (for error output) 119 * dbg_info - Contains:
122 * 120 * proc_name - Caller's procedure name
121 * module_name - Caller's module name
122 * component_id - Caller's component ID
123 * Format - Printf format field 123 * Format - Printf format field
124 * ... - Optional printf arguments 124 * ... - Optional printf arguments
125 * 125 *
@@ -128,7 +128,7 @@ acpi_ut_track_stack_ptr (
128 * DESCRIPTION: Print error message with prefix consisting of the module name, 128 * DESCRIPTION: Print error message with prefix consisting of the module name,
129 * line number, and component ID. 129 * line number, and component ID.
130 * 130 *
131 ****************************************************************************/ 131 ******************************************************************************/
132 132
133void ACPI_INTERNAL_VAR_XFACE 133void ACPI_INTERNAL_VAR_XFACE
134acpi_ut_debug_print ( 134acpi_ut_debug_print (
@@ -157,7 +157,8 @@ acpi_ut_debug_print (
157 157
158 if (thread_id != acpi_gbl_prev_thread_id) { 158 if (thread_id != acpi_gbl_prev_thread_id) {
159 if (ACPI_LV_THREADS & acpi_dbg_level) { 159 if (ACPI_LV_THREADS & acpi_dbg_level) {
160 acpi_os_printf ("\n**** Context Switch from TID %X to TID %X ****\n\n", 160 acpi_os_printf (
161 "\n**** Context Switch from TID %X to TID %X ****\n\n",
161 acpi_gbl_prev_thread_id, thread_id); 162 acpi_gbl_prev_thread_id, thread_id);
162 } 163 }
163 164
@@ -174,15 +175,16 @@ acpi_ut_debug_print (
174 acpi_os_printf ("[%04lX] ", thread_id); 175 acpi_os_printf ("[%04lX] ", thread_id);
175 } 176 }
176 177
177 acpi_os_printf ("[%02ld] %-22.22s: ", acpi_gbl_nesting_level, dbg_info->proc_name); 178 acpi_os_printf ("[%02ld] %-22.22s: ",
179 acpi_gbl_nesting_level, dbg_info->proc_name);
178 180
179 va_start (args, format); 181 va_start (args, format);
180 acpi_os_vprintf (format, args); 182 acpi_os_vprintf (format, args);
181} 183}
182EXPORT_SYMBOL(acpi_ut_debug_print);
183 184
185EXPORT_SYMBOL(acpi_ut_debug_print);
184 186
185/***************************************************************************** 187/*******************************************************************************
186 * 188 *
187 * FUNCTION: acpi_ut_debug_print_raw 189 * FUNCTION: acpi_ut_debug_print_raw
188 * 190 *
@@ -200,7 +202,7 @@ EXPORT_SYMBOL(acpi_ut_debug_print);
200 * DESCRIPTION: Print message with no headers. Has same interface as 202 * DESCRIPTION: Print message with no headers. Has same interface as
201 * debug_print so that the same macros can be used. 203 * debug_print so that the same macros can be used.
202 * 204 *
203 ****************************************************************************/ 205 ******************************************************************************/
204 206
205void ACPI_INTERNAL_VAR_XFACE 207void ACPI_INTERNAL_VAR_XFACE
206acpi_ut_debug_print_raw ( 208acpi_ut_debug_print_raw (
@@ -224,7 +226,7 @@ acpi_ut_debug_print_raw (
224EXPORT_SYMBOL(acpi_ut_debug_print_raw); 226EXPORT_SYMBOL(acpi_ut_debug_print_raw);
225 227
226 228
227/***************************************************************************** 229/*******************************************************************************
228 * 230 *
229 * FUNCTION: acpi_ut_trace 231 * FUNCTION: acpi_ut_trace
230 * 232 *
@@ -239,7 +241,7 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw);
239 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 241 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
240 * set in debug_level 242 * set in debug_level
241 * 243 *
242 ****************************************************************************/ 244 ******************************************************************************/
243 245
244void 246void
245acpi_ut_trace ( 247acpi_ut_trace (
@@ -256,7 +258,7 @@ acpi_ut_trace (
256EXPORT_SYMBOL(acpi_ut_trace); 258EXPORT_SYMBOL(acpi_ut_trace);
257 259
258 260
259/***************************************************************************** 261/*******************************************************************************
260 * 262 *
261 * FUNCTION: acpi_ut_trace_ptr 263 * FUNCTION: acpi_ut_trace_ptr
262 * 264 *
@@ -272,7 +274,7 @@ EXPORT_SYMBOL(acpi_ut_trace);
272 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 274 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
273 * set in debug_level 275 * set in debug_level
274 * 276 *
275 ****************************************************************************/ 277 ******************************************************************************/
276 278
277void 279void
278acpi_ut_trace_ptr ( 280acpi_ut_trace_ptr (
@@ -288,7 +290,7 @@ acpi_ut_trace_ptr (
288} 290}
289 291
290 292
291/***************************************************************************** 293/*******************************************************************************
292 * 294 *
293 * FUNCTION: acpi_ut_trace_str 295 * FUNCTION: acpi_ut_trace_str
294 * 296 *
@@ -304,7 +306,7 @@ acpi_ut_trace_ptr (
304 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 306 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
305 * set in debug_level 307 * set in debug_level
306 * 308 *
307 ****************************************************************************/ 309 ******************************************************************************/
308 310
309void 311void
310acpi_ut_trace_str ( 312acpi_ut_trace_str (
@@ -321,7 +323,7 @@ acpi_ut_trace_str (
321} 323}
322 324
323 325
324/***************************************************************************** 326/*******************************************************************************
325 * 327 *
326 * FUNCTION: acpi_ut_trace_u32 328 * FUNCTION: acpi_ut_trace_u32
327 * 329 *
@@ -337,7 +339,7 @@ acpi_ut_trace_str (
337 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 339 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
338 * set in debug_level 340 * set in debug_level
339 * 341 *
340 ****************************************************************************/ 342 ******************************************************************************/
341 343
342void 344void
343acpi_ut_trace_u32 ( 345acpi_ut_trace_u32 (
@@ -354,7 +356,7 @@ acpi_ut_trace_u32 (
354} 356}
355 357
356 358
357/***************************************************************************** 359/*******************************************************************************
358 * 360 *
359 * FUNCTION: acpi_ut_exit 361 * FUNCTION: acpi_ut_exit
360 * 362 *
@@ -369,7 +371,7 @@ acpi_ut_trace_u32 (
369 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 371 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
370 * set in debug_level 372 * set in debug_level
371 * 373 *
372 ****************************************************************************/ 374 ******************************************************************************/
373 375
374void 376void
375acpi_ut_exit ( 377acpi_ut_exit (
@@ -385,7 +387,7 @@ acpi_ut_exit (
385EXPORT_SYMBOL(acpi_ut_exit); 387EXPORT_SYMBOL(acpi_ut_exit);
386 388
387 389
388/***************************************************************************** 390/*******************************************************************************
389 * 391 *
390 * FUNCTION: acpi_ut_status_exit 392 * FUNCTION: acpi_ut_status_exit
391 * 393 *
@@ -401,7 +403,7 @@ EXPORT_SYMBOL(acpi_ut_exit);
401 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 403 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
402 * set in debug_level. Prints exit status also. 404 * set in debug_level. Prints exit status also.
403 * 405 *
404 ****************************************************************************/ 406 ******************************************************************************/
405 407
406void 408void
407acpi_ut_status_exit ( 409acpi_ut_status_exit (
@@ -426,7 +428,7 @@ acpi_ut_status_exit (
426EXPORT_SYMBOL(acpi_ut_status_exit); 428EXPORT_SYMBOL(acpi_ut_status_exit);
427 429
428 430
429/***************************************************************************** 431/*******************************************************************************
430 * 432 *
431 * FUNCTION: acpi_ut_value_exit 433 * FUNCTION: acpi_ut_value_exit
432 * 434 *
@@ -442,7 +444,7 @@ EXPORT_SYMBOL(acpi_ut_status_exit);
442 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 444 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
443 * set in debug_level. Prints exit value also. 445 * set in debug_level. Prints exit value also.
444 * 446 *
445 ****************************************************************************/ 447 ******************************************************************************/
446 448
447void 449void
448acpi_ut_value_exit ( 450acpi_ut_value_exit (
@@ -460,7 +462,7 @@ acpi_ut_value_exit (
460EXPORT_SYMBOL(acpi_ut_value_exit); 462EXPORT_SYMBOL(acpi_ut_value_exit);
461 463
462 464
463/***************************************************************************** 465/*******************************************************************************
464 * 466 *
465 * FUNCTION: acpi_ut_ptr_exit 467 * FUNCTION: acpi_ut_ptr_exit
466 * 468 *
@@ -469,14 +471,14 @@ EXPORT_SYMBOL(acpi_ut_value_exit);
469 * proc_name - Caller's procedure name 471 * proc_name - Caller's procedure name
470 * module_name - Caller's module name 472 * module_name - Caller's module name
471 * component_id - Caller's component ID 473 * component_id - Caller's component ID
472 * Value - Value to be printed with exit msg 474 * Ptr - Pointer to display
473 * 475 *
474 * RETURN: None 476 * RETURN: None
475 * 477 *
476 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 478 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
477 * set in debug_level. Prints exit value also. 479 * set in debug_level. Prints exit value also.
478 * 480 *
479 ****************************************************************************/ 481 ******************************************************************************/
480 482
481void 483void
482acpi_ut_ptr_exit ( 484acpi_ut_ptr_exit (
@@ -494,7 +496,7 @@ acpi_ut_ptr_exit (
494#endif 496#endif
495 497
496 498
497/***************************************************************************** 499/*******************************************************************************
498 * 500 *
499 * FUNCTION: acpi_ut_dump_buffer 501 * FUNCTION: acpi_ut_dump_buffer
500 * 502 *
@@ -507,7 +509,7 @@ acpi_ut_ptr_exit (
507 * 509 *
508 * DESCRIPTION: Generic dump buffer in both hex and ascii. 510 * DESCRIPTION: Generic dump buffer in both hex and ascii.
509 * 511 *
510 ****************************************************************************/ 512 ******************************************************************************/
511 513
512void 514void
513acpi_ut_dump_buffer ( 515acpi_ut_dump_buffer (
@@ -533,34 +535,28 @@ acpi_ut_dump_buffer (
533 display = DB_BYTE_DISPLAY; 535 display = DB_BYTE_DISPLAY;
534 } 536 }
535 537
536 acpi_os_printf ("\nOffset Value\n"); 538 /* Nasty little dump buffer routine! */
537 539
538 /*
539 * Nasty little dump buffer routine!
540 */
541 while (i < count) { 540 while (i < count) {
542 /* Print current offset */ 541 /* Print current offset */
543 542
544 acpi_os_printf ("%05X ", (u32) i); 543 acpi_os_printf ("%6.4X: ", (u32) i);
545 544
546 /* Print 16 hex chars */ 545 /* Print 16 hex chars */
547 546
548 for (j = 0; j < 16;) { 547 for (j = 0; j < 16;) {
549 if (i + j >= count) { 548 if (i + j >= count) {
550 acpi_os_printf ("\n"); 549 /* Dump fill spaces */
551 return;
552 }
553 550
554 /* Make sure that the s8 doesn't get sign-extended! */ 551 acpi_os_printf ("%*s", ((display * 2) + 1), " ");
552 j += display;
553 continue;
554 }
555 555
556 switch (display) { 556 switch (display) {
557 /* Default is BYTE display */ 557 default: /* Default is BYTE display */
558 558
559 default: 559 acpi_os_printf ("%02X ", buffer[i + j]);
560
561 acpi_os_printf ("%02X ",
562 *((u8 *) &buffer[i + j]));
563 j += 1;
564 break; 560 break;
565 561
566 562
@@ -568,7 +564,6 @@ acpi_ut_dump_buffer (
568 564
569 ACPI_MOVE_16_TO_32 (&temp32, &buffer[i + j]); 565 ACPI_MOVE_16_TO_32 (&temp32, &buffer[i + j]);
570 acpi_os_printf ("%04X ", temp32); 566 acpi_os_printf ("%04X ", temp32);
571 j += 2;
572 break; 567 break;
573 568
574 569
@@ -576,7 +571,6 @@ acpi_ut_dump_buffer (
576 571
577 ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j]); 572 ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j]);
578 acpi_os_printf ("%08X ", temp32); 573 acpi_os_printf ("%08X ", temp32);
579 j += 4;
580 break; 574 break;
581 575
582 576
@@ -587,15 +581,17 @@ acpi_ut_dump_buffer (
587 581
588 ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j + 4]); 582 ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j + 4]);
589 acpi_os_printf ("%08X ", temp32); 583 acpi_os_printf ("%08X ", temp32);
590 j += 8;
591 break; 584 break;
592 } 585 }
586
587 j += display;
593 } 588 }
594 589
595 /* 590 /*
596 * Print the ASCII equivalent characters 591 * Print the ASCII equivalent characters
597 * But watch out for the bad unprintable ones... 592 * But watch out for the bad unprintable ones...
598 */ 593 */
594 acpi_os_printf (" ");
599 for (j = 0; j < 16; j++) { 595 for (j = 0; j < 16; j++) {
600 if (i + j >= count) { 596 if (i + j >= count) {
601 acpi_os_printf ("\n"); 597 acpi_os_printf ("\n");
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index 9a52ad52a23a..bc5403022681 100644
--- a/drivers/acpi/utilities/utdelete.c
+++ b/drivers/acpi/utilities/utdelete.c
@@ -51,12 +51,23 @@
51#define _COMPONENT ACPI_UTILITIES 51#define _COMPONENT ACPI_UTILITIES
52 ACPI_MODULE_NAME ("utdelete") 52 ACPI_MODULE_NAME ("utdelete")
53 53
54/* Local prototypes */
55
56static void
57acpi_ut_delete_internal_obj (
58 union acpi_operand_object *object);
59
60static void
61acpi_ut_update_ref_count (
62 union acpi_operand_object *object,
63 u32 action);
64
54 65
55/******************************************************************************* 66/*******************************************************************************
56 * 67 *
57 * FUNCTION: acpi_ut_delete_internal_obj 68 * FUNCTION: acpi_ut_delete_internal_obj
58 * 69 *
59 * PARAMETERS: *Object - Pointer to the list to be deleted 70 * PARAMETERS: Object - Object to be deleted
60 * 71 *
61 * RETURN: None 72 * RETURN: None
62 * 73 *
@@ -65,7 +76,7 @@
65 * 76 *
66 ******************************************************************************/ 77 ******************************************************************************/
67 78
68void 79static void
69acpi_ut_delete_internal_obj ( 80acpi_ut_delete_internal_obj (
70 union acpi_operand_object *object) 81 union acpi_operand_object *object)
71{ 82{
@@ -152,7 +163,8 @@ acpi_ut_delete_internal_obj (
152 163
153 case ACPI_TYPE_MUTEX: 164 case ACPI_TYPE_MUTEX:
154 165
155 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Mutex %p, Semaphore %p\n", 166 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
167 "***** Mutex %p, Semaphore %p\n",
156 object, object->mutex.semaphore)); 168 object, object->mutex.semaphore));
157 169
158 acpi_ex_unlink_mutex (object); 170 acpi_ex_unlink_mutex (object);
@@ -162,7 +174,8 @@ acpi_ut_delete_internal_obj (
162 174
163 case ACPI_TYPE_EVENT: 175 case ACPI_TYPE_EVENT:
164 176
165 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Event %p, Semaphore %p\n", 177 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
178 "***** Event %p, Semaphore %p\n",
166 object, object->event.semaphore)); 179 object, object->event.semaphore));
167 180
168 (void) acpi_os_delete_semaphore (object->event.semaphore); 181 (void) acpi_os_delete_semaphore (object->event.semaphore);
@@ -172,7 +185,8 @@ acpi_ut_delete_internal_obj (
172 185
173 case ACPI_TYPE_METHOD: 186 case ACPI_TYPE_METHOD:
174 187
175 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Method %p\n", object)); 188 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
189 "***** Method %p\n", object));
176 190
177 /* Delete the method semaphore if it exists */ 191 /* Delete the method semaphore if it exists */
178 192
@@ -185,7 +199,8 @@ acpi_ut_delete_internal_obj (
185 199
186 case ACPI_TYPE_REGION: 200 case ACPI_TYPE_REGION:
187 201
188 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Region %p\n", object)); 202 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
203 "***** Region %p\n", object));
189 204
190 second_desc = acpi_ns_get_secondary_object (object); 205 second_desc = acpi_ns_get_secondary_object (object);
191 if (second_desc) { 206 if (second_desc) {
@@ -212,7 +227,8 @@ acpi_ut_delete_internal_obj (
212 227
213 case ACPI_TYPE_BUFFER_FIELD: 228 case ACPI_TYPE_BUFFER_FIELD:
214 229
215 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Buffer Field %p\n", object)); 230 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
231 "***** Buffer Field %p\n", object));
216 232
217 second_desc = acpi_ns_get_secondary_object (object); 233 second_desc = acpi_ns_get_secondary_object (object);
218 if (second_desc) { 234 if (second_desc) {
@@ -247,7 +263,7 @@ acpi_ut_delete_internal_obj (
247 * 263 *
248 * FUNCTION: acpi_ut_delete_internal_object_list 264 * FUNCTION: acpi_ut_delete_internal_object_list
249 * 265 *
250 * PARAMETERS: *obj_list - Pointer to the list to be deleted 266 * PARAMETERS: obj_list - Pointer to the list to be deleted
251 * 267 *
252 * RETURN: None 268 * RETURN: None
253 * 269 *
@@ -283,7 +299,7 @@ acpi_ut_delete_internal_object_list (
283 * 299 *
284 * FUNCTION: acpi_ut_update_ref_count 300 * FUNCTION: acpi_ut_update_ref_count
285 * 301 *
286 * PARAMETERS: *Object - Object whose ref count is to be updated 302 * PARAMETERS: Object - Object whose ref count is to be updated
287 * Action - What to do 303 * Action - What to do
288 * 304 *
289 * RETURN: New ref count 305 * RETURN: New ref count
@@ -312,7 +328,8 @@ acpi_ut_update_ref_count (
312 new_count = count; 328 new_count = count;
313 329
314 /* 330 /*
315 * Perform the reference count action (increment, decrement, or force delete) 331 * Perform the reference count action
332 * (increment, decrement, or force delete)
316 */ 333 */
317 switch (action) { 334 switch (action) {
318 335
@@ -321,7 +338,8 @@ acpi_ut_update_ref_count (
321 new_count++; 338 new_count++;
322 object->common.reference_count = new_count; 339 object->common.reference_count = new_count;
323 340
324 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Incremented]\n", 341 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
342 "Obj %p Refs=%X, [Incremented]\n",
325 object, new_count)); 343 object, new_count));
326 break; 344 break;
327 345
@@ -329,7 +347,8 @@ acpi_ut_update_ref_count (
329 case REF_DECREMENT: 347 case REF_DECREMENT:
330 348
331 if (count < 1) { 349 if (count < 1) {
332 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, can't decrement! (Set to 0)\n", 350 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
351 "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
333 object, new_count)); 352 object, new_count));
334 353
335 new_count = 0; 354 new_count = 0;
@@ -337,12 +356,14 @@ acpi_ut_update_ref_count (
337 else { 356 else {
338 new_count--; 357 new_count--;
339 358
340 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Decremented]\n", 359 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
360 "Obj %p Refs=%X, [Decremented]\n",
341 object, new_count)); 361 object, new_count));
342 } 362 }
343 363
344 if (ACPI_GET_OBJECT_TYPE (object) == ACPI_TYPE_METHOD) { 364 if (ACPI_GET_OBJECT_TYPE (object) == ACPI_TYPE_METHOD) {
345 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Method Obj %p Refs=%X, [Decremented]\n", 365 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
366 "Method Obj %p Refs=%X, [Decremented]\n",
346 object, new_count)); 367 object, new_count));
347 } 368 }
348 369
@@ -356,7 +377,8 @@ acpi_ut_update_ref_count (
356 377
357 case REF_FORCE_DELETE: 378 case REF_FORCE_DELETE:
358 379
359 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, Force delete! (Set to 0)\n", 380 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
381 "Obj %p Refs=%X, Force delete! (Set to 0)\n",
360 object, count)); 382 object, count));
361 383
362 new_count = 0; 384 new_count = 0;
@@ -390,7 +412,7 @@ acpi_ut_update_ref_count (
390 * 412 *
391 * FUNCTION: acpi_ut_update_object_reference 413 * FUNCTION: acpi_ut_update_object_reference
392 * 414 *
393 * PARAMETERS: *Object - Increment ref count for this object 415 * PARAMETERS: Object - Increment ref count for this object
394 * and all sub-objects 416 * and all sub-objects
395 * Action - Either REF_INCREMENT or REF_DECREMENT or 417 * Action - Either REF_INCREMENT or REF_DECREMENT or
396 * REF_FORCE_DELETE 418 * REF_FORCE_DELETE
@@ -431,7 +453,8 @@ acpi_ut_update_object_reference (
431 /* Make sure that this isn't a namespace handle */ 453 /* Make sure that this isn't a namespace handle */
432 454
433 if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) { 455 if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) {
434 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p is NS handle\n", object)); 456 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
457 "Object %p is NS handle\n", object));
435 return_ACPI_STATUS (AE_OK); 458 return_ACPI_STATUS (AE_OK);
436 } 459 }
437 460
@@ -614,8 +637,8 @@ error_exit:
614 * 637 *
615 * FUNCTION: acpi_ut_add_reference 638 * FUNCTION: acpi_ut_add_reference
616 * 639 *
617 * PARAMETERS: *Object - Object whose reference count is to be 640 * PARAMETERS: Object - Object whose reference count is to be
618 * incremented 641 * incremented
619 * 642 *
620 * RETURN: None 643 * RETURN: None
621 * 644 *
@@ -652,7 +675,7 @@ acpi_ut_add_reference (
652 * 675 *
653 * FUNCTION: acpi_ut_remove_reference 676 * FUNCTION: acpi_ut_remove_reference
654 * 677 *
655 * PARAMETERS: *Object - Object whose ref count will be decremented 678 * PARAMETERS: Object - Object whose ref count will be decremented
656 * 679 *
657 * RETURN: None 680 * RETURN: None
658 * 681 *
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c
index ead27d2c4d18..00046dd5d925 100644
--- a/drivers/acpi/utilities/uteval.c
+++ b/drivers/acpi/utilities/uteval.c
@@ -50,6 +50,19 @@
50#define _COMPONENT ACPI_UTILITIES 50#define _COMPONENT ACPI_UTILITIES
51 ACPI_MODULE_NAME ("uteval") 51 ACPI_MODULE_NAME ("uteval")
52 52
53/* Local prototypes */
54
55static void
56acpi_ut_copy_id_string (
57 char *destination,
58 char *source,
59 acpi_size max_length);
60
61static acpi_status
62acpi_ut_translate_one_cid (
63 union acpi_operand_object *obj_desc,
64 struct acpi_compatible_id *one_cid);
65
53 66
54/******************************************************************************* 67/*******************************************************************************
55 * 68 *
@@ -237,9 +250,9 @@ acpi_ut_evaluate_object (
237 * 250 *
238 * FUNCTION: acpi_ut_evaluate_numeric_object 251 * FUNCTION: acpi_ut_evaluate_numeric_object
239 * 252 *
240 * PARAMETERS: *object_name - Object name to be evaluated 253 * PARAMETERS: object_name - Object name to be evaluated
241 * device_node - Node for the device 254 * device_node - Node for the device
242 * *Address - Where the value is returned 255 * Address - Where the value is returned
243 * 256 *
244 * RETURN: Status 257 * RETURN: Status
245 * 258 *
@@ -303,7 +316,6 @@ acpi_ut_copy_id_string (
303 acpi_size max_length) 316 acpi_size max_length)
304{ 317{
305 318
306
307 /* 319 /*
308 * Workaround for ID strings that have a leading asterisk. This construct 320 * Workaround for ID strings that have a leading asterisk. This construct
309 * is not allowed by the ACPI specification (ID strings must be 321 * is not allowed by the ACPI specification (ID strings must be
@@ -325,7 +337,7 @@ acpi_ut_copy_id_string (
325 * FUNCTION: acpi_ut_execute_HID 337 * FUNCTION: acpi_ut_execute_HID
326 * 338 *
327 * PARAMETERS: device_node - Node for the device 339 * PARAMETERS: device_node - Node for the device
328 * *Hid - Where the HID is returned 340 * Hid - Where the HID is returned
329 * 341 *
330 * RETURN: Status 342 * RETURN: Status
331 * 343 *
@@ -429,7 +441,7 @@ acpi_ut_translate_one_cid (
429 * FUNCTION: acpi_ut_execute_CID 441 * FUNCTION: acpi_ut_execute_CID
430 * 442 *
431 * PARAMETERS: device_node - Node for the device 443 * PARAMETERS: device_node - Node for the device
432 * *Cid - Where the CID is returned 444 * return_cid_list - Where the CID list is returned
433 * 445 *
434 * RETURN: Status 446 * RETURN: Status
435 * 447 *
@@ -488,10 +500,10 @@ acpi_ut_execute_CID (
488 cid_list->size = size; 500 cid_list->size = size;
489 501
490 /* 502 /*
491 * A _CID can return either a single compatible ID or a package of compatible 503 * A _CID can return either a single compatible ID or a package of
492 * IDs. Each compatible ID can be one of the following: 504 * compatible IDs. Each compatible ID can be one of the following:
493 * -- Number (32 bit compressed EISA ID) or 505 * 1) Integer (32 bit compressed EISA ID) or
494 * -- String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss"). 506 * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss")
495 */ 507 */
496 508
497 /* The _CID object can be either a single CID or a package (list) of CIDs */ 509 /* The _CID object can be either a single CID or a package (list) of CIDs */
@@ -534,7 +546,7 @@ acpi_ut_execute_CID (
534 * FUNCTION: acpi_ut_execute_UID 546 * FUNCTION: acpi_ut_execute_UID
535 * 547 *
536 * PARAMETERS: device_node - Node for the device 548 * PARAMETERS: device_node - Node for the device
537 * *Uid - Where the UID is returned 549 * Uid - Where the UID is returned
538 * 550 *
539 * RETURN: Status 551 * RETURN: Status
540 * 552 *
@@ -587,7 +599,7 @@ acpi_ut_execute_UID (
587 * FUNCTION: acpi_ut_execute_STA 599 * FUNCTION: acpi_ut_execute_STA
588 * 600 *
589 * PARAMETERS: device_node - Node for the device 601 * PARAMETERS: device_node - Node for the device
590 * *Flags - Where the status flags are returned 602 * Flags - Where the status flags are returned
591 * 603 *
592 * RETURN: Status 604 * RETURN: Status
593 * 605 *
@@ -641,7 +653,7 @@ acpi_ut_execute_STA (
641 * FUNCTION: acpi_ut_execute_Sxds 653 * FUNCTION: acpi_ut_execute_Sxds
642 * 654 *
643 * PARAMETERS: device_node - Node for the device 655 * PARAMETERS: device_node - Node for the device
644 * *Flags - Where the status flags are returned 656 * Flags - Where the status flags are returned
645 * 657 *
646 * RETURN: Status 658 * RETURN: Status
647 * 659 *
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 25b0f8ae1bc6..4146019b543f 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -44,7 +44,6 @@
44#define DEFINE_ACPI_GLOBALS 44#define DEFINE_ACPI_GLOBALS
45 45
46#include <linux/module.h> 46#include <linux/module.h>
47
48#include <acpi/acpi.h> 47#include <acpi/acpi.h>
49#include <acpi/acnamesp.h> 48#include <acpi/acnamesp.h>
50 49
@@ -52,13 +51,14 @@
52 ACPI_MODULE_NAME ("utglobal") 51 ACPI_MODULE_NAME ("utglobal")
53 52
54 53
55/****************************************************************************** 54/*******************************************************************************
56 * 55 *
57 * FUNCTION: acpi_format_exception 56 * FUNCTION: acpi_format_exception
58 * 57 *
59 * PARAMETERS: Status - The acpi_status code to be formatted 58 * PARAMETERS: Status - The acpi_status code to be formatted
60 * 59 *
61 * RETURN: A string containing the exception text 60 * RETURN: A string containing the exception text. A valid pointer is
61 * always returned.
62 * 62 *
63 * DESCRIPTION: This function translates an ACPI exception into an ASCII string. 63 * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
64 * 64 *
@@ -68,8 +68,8 @@ const char *
68acpi_format_exception ( 68acpi_format_exception (
69 acpi_status status) 69 acpi_status status)
70{ 70{
71 const char *exception = "UNKNOWN_STATUS_CODE";
72 acpi_status sub_status; 71 acpi_status sub_status;
72 const char *exception = NULL;
73 73
74 74
75 ACPI_FUNCTION_NAME ("format_exception"); 75 ACPI_FUNCTION_NAME ("format_exception");
@@ -82,57 +82,55 @@ acpi_format_exception (
82 82
83 if (sub_status <= AE_CODE_ENV_MAX) { 83 if (sub_status <= AE_CODE_ENV_MAX) {
84 exception = acpi_gbl_exception_names_env [sub_status]; 84 exception = acpi_gbl_exception_names_env [sub_status];
85 break;
86 } 85 }
87 goto unknown; 86 break;
88 87
89 case AE_CODE_PROGRAMMER: 88 case AE_CODE_PROGRAMMER:
90 89
91 if (sub_status <= AE_CODE_PGM_MAX) { 90 if (sub_status <= AE_CODE_PGM_MAX) {
92 exception = acpi_gbl_exception_names_pgm [sub_status -1]; 91 exception = acpi_gbl_exception_names_pgm [sub_status -1];
93 break;
94 } 92 }
95 goto unknown; 93 break;
96 94
97 case AE_CODE_ACPI_TABLES: 95 case AE_CODE_ACPI_TABLES:
98 96
99 if (sub_status <= AE_CODE_TBL_MAX) { 97 if (sub_status <= AE_CODE_TBL_MAX) {
100 exception = acpi_gbl_exception_names_tbl [sub_status -1]; 98 exception = acpi_gbl_exception_names_tbl [sub_status -1];
101 break;
102 } 99 }
103 goto unknown; 100 break;
104 101
105 case AE_CODE_AML: 102 case AE_CODE_AML:
106 103
107 if (sub_status <= AE_CODE_AML_MAX) { 104 if (sub_status <= AE_CODE_AML_MAX) {
108 exception = acpi_gbl_exception_names_aml [sub_status -1]; 105 exception = acpi_gbl_exception_names_aml [sub_status -1];
109 break;
110 } 106 }
111 goto unknown; 107 break;
112 108
113 case AE_CODE_CONTROL: 109 case AE_CODE_CONTROL:
114 110
115 if (sub_status <= AE_CODE_CTRL_MAX) { 111 if (sub_status <= AE_CODE_CTRL_MAX) {
116 exception = acpi_gbl_exception_names_ctrl [sub_status -1]; 112 exception = acpi_gbl_exception_names_ctrl [sub_status -1];
117 break;
118 } 113 }
119 goto unknown; 114 break;
120 115
121 default: 116 default:
122 goto unknown; 117 break;
123 } 118 }
124 119
120 if (!exception) {
121 /* Exception code was not recognized */
125 122
126 return ((const char *) exception); 123 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
124 "Unknown exception code: 0x%8.8X\n", status));
127 125
128unknown: 126 return ((const char *) "UNKNOWN_STATUS_CODE");
127 }
129 128
130 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown exception code: 0x%8.8X\n", status));
131 return ((const char *) exception); 129 return ((const char *) exception);
132} 130}
133 131
134 132
135/****************************************************************************** 133/*******************************************************************************
136 * 134 *
137 * Static global variable initialization. 135 * Static global variable initialization.
138 * 136 *
@@ -212,13 +210,12 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STR
212}; 210};
213 211
214 212
215/****************************************************************************** 213/*******************************************************************************
216 * 214 *
217 * Namespace globals 215 * Namespace globals
218 * 216 *
219 ******************************************************************************/ 217 ******************************************************************************/
220 218
221
222/* 219/*
223 * Predefined ACPI Names (Built-in to the Interpreter) 220 * Predefined ACPI Names (Built-in to the Interpreter)
224 * 221 *
@@ -241,9 +238,11 @@ const struct acpi_predefined_names acpi_gbl_pre_defined_names[] =
241#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) 238#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
242 {"_OSI", ACPI_TYPE_METHOD, (char *) 1}, 239 {"_OSI", ACPI_TYPE_METHOD, (char *) 1},
243#endif 240#endif
244 {NULL, ACPI_TYPE_ANY, NULL} /* Table terminator */
245};
246 241
242 /* Table terminator */
243
244 {NULL, ACPI_TYPE_ANY, NULL}
245};
247 246
248/* 247/*
249 * Properties of the ACPI Object Types, both internal and external. 248 * Properties of the ACPI Object Types, both internal and external.
@@ -288,22 +287,25 @@ const u8 acpi_gbl_ns_properties[] =
288/* Hex to ASCII conversion table */ 287/* Hex to ASCII conversion table */
289 288
290static const char acpi_gbl_hex_to_ascii[] = 289static const char acpi_gbl_hex_to_ascii[] =
291 {'0','1','2','3','4','5','6','7', 290{
292 '8','9','A','B','C','D','E','F'}; 291 '0','1','2','3','4','5','6','7',
292 '8','9','A','B','C','D','E','F'
293};
294
293 295
294/***************************************************************************** 296/*******************************************************************************
295 * 297 *
296 * FUNCTION: acpi_ut_hex_to_ascii_char 298 * FUNCTION: acpi_ut_hex_to_ascii_char
297 * 299 *
298 * PARAMETERS: Integer - Contains the hex digit 300 * PARAMETERS: Integer - Contains the hex digit
299 * Position - bit position of the digit within the 301 * Position - bit position of the digit within the
300 * integer 302 * integer (multiple of 4)
301 * 303 *
302 * RETURN: Ascii character 304 * RETURN: The converted Ascii character
303 * 305 *
304 * DESCRIPTION: Convert a hex digit to an ascii character 306 * DESCRIPTION: Convert a hex digit to an Ascii character
305 * 307 *
306 ****************************************************************************/ 308 ******************************************************************************/
307 309
308char 310char
309acpi_ut_hex_to_ascii_char ( 311acpi_ut_hex_to_ascii_char (
@@ -315,7 +317,7 @@ acpi_ut_hex_to_ascii_char (
315} 317}
316 318
317 319
318/****************************************************************************** 320/*******************************************************************************
319 * 321 *
320 * Table name globals 322 * Table name globals
321 * 323 *
@@ -324,7 +326,7 @@ acpi_ut_hex_to_ascii_char (
324 * that are not used by the subsystem are simply ignored. 326 * that are not used by the subsystem are simply ignored.
325 * 327 *
326 * Do NOT add any table to this list that is not consumed directly by this 328 * Do NOT add any table to this list that is not consumed directly by this
327 * subsystem. 329 * subsystem (No MADT, ECDT, SBST, etc.)
328 * 330 *
329 ******************************************************************************/ 331 ******************************************************************************/
330 332
@@ -391,7 +393,7 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVE
391 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE}, 393 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE},
392}; 394};
393 395
394/***************************************************************************** 396/*******************************************************************************
395 * 397 *
396 * FUNCTION: acpi_ut_get_region_name 398 * FUNCTION: acpi_ut_get_region_name
397 * 399 *
@@ -401,7 +403,7 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVE
401 * 403 *
402 * DESCRIPTION: Translate a Space ID into a name string (Debug only) 404 * DESCRIPTION: Translate a Space ID into a name string (Debug only)
403 * 405 *
404 ****************************************************************************/ 406 ******************************************************************************/
405 407
406/* Region type decoding */ 408/* Region type decoding */
407 409
@@ -429,7 +431,6 @@ acpi_ut_get_region_name (
429 { 431 {
430 return ("user_defined_region"); 432 return ("user_defined_region");
431 } 433 }
432
433 else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) 434 else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS)
434 { 435 {
435 return ("invalid_space_id"); 436 return ("invalid_space_id");
@@ -439,7 +440,7 @@ acpi_ut_get_region_name (
439} 440}
440 441
441 442
442/***************************************************************************** 443/*******************************************************************************
443 * 444 *
444 * FUNCTION: acpi_ut_get_event_name 445 * FUNCTION: acpi_ut_get_event_name
445 * 446 *
@@ -449,7 +450,7 @@ acpi_ut_get_region_name (
449 * 450 *
450 * DESCRIPTION: Translate a Event ID into a name string (Debug only) 451 * DESCRIPTION: Translate a Event ID into a name string (Debug only)
451 * 452 *
452 ****************************************************************************/ 453 ******************************************************************************/
453 454
454/* Event type decoding */ 455/* Event type decoding */
455 456
@@ -477,7 +478,7 @@ acpi_ut_get_event_name (
477} 478}
478 479
479 480
480/***************************************************************************** 481/*******************************************************************************
481 * 482 *
482 * FUNCTION: acpi_ut_get_type_name 483 * FUNCTION: acpi_ut_get_type_name
483 * 484 *
@@ -487,20 +488,21 @@ acpi_ut_get_event_name (
487 * 488 *
488 * DESCRIPTION: Translate a Type ID into a name string (Debug only) 489 * DESCRIPTION: Translate a Type ID into a name string (Debug only)
489 * 490 *
490 ****************************************************************************/ 491 ******************************************************************************/
491 492
492/* 493/*
493 * Elements of acpi_gbl_ns_type_names below must match 494 * Elements of acpi_gbl_ns_type_names below must match
494 * one-to-one with values of acpi_object_type 495 * one-to-one with values of acpi_object_type
495 * 496 *
496 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when 497 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
497 * stored in a table it really means that we have thus far seen no evidence to 498 * when stored in a table it really means that we have thus far seen no
498 * indicate what type is actually going to be stored for this entry. 499 * evidence to indicate what type is actually going to be stored for this entry.
499 */ 500 */
500static const char acpi_gbl_bad_type[] = "UNDEFINED"; 501static const char acpi_gbl_bad_type[] = "UNDEFINED";
501#define TYPE_NAME_LENGTH 12 /* Maximum length of each string */
502 502
503static const char *acpi_gbl_ns_type_names[] = /* printable names of ACPI types */ 503/* Printable names of the ACPI object types */
504
505static const char *acpi_gbl_ns_type_names[] =
504{ 506{
505 /* 00 */ "Untyped", 507 /* 00 */ "Untyped",
506 /* 01 */ "Integer", 508 /* 01 */ "Integer",
@@ -564,7 +566,7 @@ acpi_ut_get_object_type_name (
564} 566}
565 567
566 568
567/***************************************************************************** 569/*******************************************************************************
568 * 570 *
569 * FUNCTION: acpi_ut_get_node_name 571 * FUNCTION: acpi_ut_get_node_name
570 * 572 *
@@ -574,7 +576,7 @@ acpi_ut_get_object_type_name (
574 * 576 *
575 * DESCRIPTION: Validate the node and return the node's ACPI name. 577 * DESCRIPTION: Validate the node and return the node's ACPI name.
576 * 578 *
577 ****************************************************************************/ 579 ******************************************************************************/
578 580
579char * 581char *
580acpi_ut_get_node_name ( 582acpi_ut_get_node_name (
@@ -618,7 +620,7 @@ acpi_ut_get_node_name (
618} 620}
619 621
620 622
621/***************************************************************************** 623/*******************************************************************************
622 * 624 *
623 * FUNCTION: acpi_ut_get_descriptor_name 625 * FUNCTION: acpi_ut_get_descriptor_name
624 * 626 *
@@ -628,9 +630,11 @@ acpi_ut_get_node_name (
628 * 630 *
629 * DESCRIPTION: Validate object and return the descriptor type 631 * DESCRIPTION: Validate object and return the descriptor type
630 * 632 *
631 ****************************************************************************/ 633 ******************************************************************************/
634
635/* Printable names of object descriptor types */
632 636
633static const char *acpi_gbl_desc_type_names[] = /* printable names of descriptor types */ 637static const char *acpi_gbl_desc_type_names[] =
634{ 638{
635 /* 00 */ "Invalid", 639 /* 00 */ "Invalid",
636 /* 01 */ "Cached", 640 /* 01 */ "Cached",
@@ -676,17 +680,18 @@ acpi_ut_get_descriptor_name (
676 * Strings and procedures used for debug only 680 * Strings and procedures used for debug only
677 */ 681 */
678 682
679/***************************************************************************** 683/*******************************************************************************
680 * 684 *
681 * FUNCTION: acpi_ut_get_mutex_name 685 * FUNCTION: acpi_ut_get_mutex_name
682 * 686 *
683 * PARAMETERS: None. 687 * PARAMETERS: mutex_id - The predefined ID for this mutex.
684 * 688 *
685 * RETURN: Status 689 * RETURN: String containing the name of the mutex. Always returns a valid
690 * pointer.
686 * 691 *
687 * DESCRIPTION: Translate a mutex ID into a name string (Debug only) 692 * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
688 * 693 *
689 ****************************************************************************/ 694 ******************************************************************************/
690 695
691char * 696char *
692acpi_ut_get_mutex_name ( 697acpi_ut_get_mutex_name (
@@ -700,21 +705,20 @@ acpi_ut_get_mutex_name (
700 705
701 return (acpi_gbl_mutex_names[mutex_id]); 706 return (acpi_gbl_mutex_names[mutex_id]);
702} 707}
703
704#endif 708#endif
705 709
706 710
707/***************************************************************************** 711/*******************************************************************************
708 * 712 *
709 * FUNCTION: acpi_ut_valid_object_type 713 * FUNCTION: acpi_ut_valid_object_type
710 * 714 *
711 * PARAMETERS: Type - Object type to be validated 715 * PARAMETERS: Type - Object type to be validated
712 * 716 *
713 * RETURN: TRUE if valid object type 717 * RETURN: TRUE if valid object type, FALSE otherwise
714 * 718 *
715 * DESCRIPTION: Validate an object type 719 * DESCRIPTION: Validate an object type
716 * 720 *
717 ****************************************************************************/ 721 ******************************************************************************/
718 722
719u8 723u8
720acpi_ut_valid_object_type ( 724acpi_ut_valid_object_type (
@@ -732,7 +736,7 @@ acpi_ut_valid_object_type (
732} 736}
733 737
734 738
735/**************************************************************************** 739/*******************************************************************************
736 * 740 *
737 * FUNCTION: acpi_ut_allocate_owner_id 741 * FUNCTION: acpi_ut_allocate_owner_id
738 * 742 *
@@ -740,7 +744,10 @@ acpi_ut_valid_object_type (
740 * 744 *
741 * DESCRIPTION: Allocate a table or method owner id 745 * DESCRIPTION: Allocate a table or method owner id
742 * 746 *
743 ***************************************************************************/ 747 * NOTE: this algorithm has a wraparound problem at 64_k method invocations, and
748 * should be revisited (TBD)
749 *
750 ******************************************************************************/
744 751
745acpi_owner_id 752acpi_owner_id
746acpi_ut_allocate_owner_id ( 753acpi_ut_allocate_owner_id (
@@ -796,16 +803,18 @@ acpi_ut_allocate_owner_id (
796} 803}
797 804
798 805
799/**************************************************************************** 806/*******************************************************************************
800 * 807 *
801 * FUNCTION: acpi_ut_init_globals 808 * FUNCTION: acpi_ut_init_globals
802 * 809 *
803 * PARAMETERS: none 810 * PARAMETERS: None
811 *
812 * RETURN: None
804 * 813 *
805 * DESCRIPTION: Init library globals. All globals that require specific 814 * DESCRIPTION: Init library globals. All globals that require specific
806 * initialization should be initialized here! 815 * initialization should be initialized here!
807 * 816 *
808 ***************************************************************************/ 817 ******************************************************************************/
809 818
810void 819void
811acpi_ut_init_globals ( 820acpi_ut_init_globals (
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c
index bdbadaf48d29..7f3713889ff0 100644
--- a/drivers/acpi/utilities/utinit.c
+++ b/drivers/acpi/utilities/utinit.c
@@ -49,19 +49,29 @@
49#define _COMPONENT ACPI_UTILITIES 49#define _COMPONENT ACPI_UTILITIES
50 ACPI_MODULE_NAME ("utinit") 50 ACPI_MODULE_NAME ("utinit")
51 51
52/* Local prototypes */
53
54static void
55acpi_ut_fadt_register_error (
56 char *register_name,
57 u32 value,
58 acpi_size offset);
59
60static void acpi_ut_terminate (
61 void);
62
52 63
53/******************************************************************************* 64/*******************************************************************************
54 * 65 *
55 * FUNCTION: acpi_ut_fadt_register_error 66 * FUNCTION: acpi_ut_fadt_register_error
56 * 67 *
57 * PARAMETERS: *register_name - Pointer to string identifying register 68 * PARAMETERS: register_name - Pointer to string identifying register
58 * Value - Actual register contents value 69 * Value - Actual register contents value
59 * acpi_test_spec_section - TDS section containing assertion 70 * Offset - Byte offset in the FADT
60 * acpi_assertion - Assertion number being tested
61 * 71 *
62 * RETURN: AE_BAD_VALUE 72 * RETURN: AE_BAD_VALUE
63 * 73 *
64 * DESCRIPTION: Display failure message and link failure to TDS assertion 74 * DESCRIPTION: Display failure message
65 * 75 *
66 ******************************************************************************/ 76 ******************************************************************************/
67 77
@@ -166,12 +176,13 @@ acpi_ut_validate_fadt (
166 * 176 *
167 * RETURN: none 177 * RETURN: none
168 * 178 *
169 * DESCRIPTION: free global memory 179 * DESCRIPTION: Free global memory
170 * 180 *
171 ******************************************************************************/ 181 ******************************************************************************/
172 182
173void 183static void
174acpi_ut_terminate (void) 184acpi_ut_terminate (
185 void)
175{ 186{
176 struct acpi_gpe_block_info *gpe_block; 187 struct acpi_gpe_block_info *gpe_block;
177 struct acpi_gpe_block_info *next_gpe_block; 188 struct acpi_gpe_block_info *next_gpe_block;
@@ -183,8 +194,6 @@ acpi_ut_terminate (void)
183 194
184 195
185 /* Free global tables, etc. */ 196 /* Free global tables, etc. */
186
187
188 /* Free global GPE blocks and related info structures */ 197 /* Free global GPE blocks and related info structures */
189 198
190 gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; 199 gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
@@ -221,7 +230,8 @@ acpi_ut_terminate (void)
221 ******************************************************************************/ 230 ******************************************************************************/
222 231
223void 232void
224acpi_ut_subsystem_shutdown (void) 233acpi_ut_subsystem_shutdown (
234 void)
225{ 235{
226 236
227 ACPI_FUNCTION_TRACE ("ut_subsystem_shutdown"); 237 ACPI_FUNCTION_TRACE ("ut_subsystem_shutdown");
@@ -229,14 +239,16 @@ acpi_ut_subsystem_shutdown (void)
229 /* Just exit if subsystem is already shutdown */ 239 /* Just exit if subsystem is already shutdown */
230 240
231 if (acpi_gbl_shutdown) { 241 if (acpi_gbl_shutdown) {
232 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "ACPI Subsystem is already terminated\n")); 242 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
243 "ACPI Subsystem is already terminated\n"));
233 return_VOID; 244 return_VOID;
234 } 245 }
235 246
236 /* Subsystem appears active, go ahead and shut it down */ 247 /* Subsystem appears active, go ahead and shut it down */
237 248
238 acpi_gbl_shutdown = TRUE; 249 acpi_gbl_shutdown = TRUE;
239 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n")); 250 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
251 "Shutting down ACPI Subsystem...\n"));
240 252
241 /* Close the acpi_event Handling */ 253 /* Close the acpi_event Handling */
242 254
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c
index 2525c1a93547..0d527c91543c 100644
--- a/drivers/acpi/utilities/utmath.c
+++ b/drivers/acpi/utilities/utmath.c
@@ -259,6 +259,8 @@ acpi_ut_divide (
259 * 259 *
260 * FUNCTION: acpi_ut_short_divide, acpi_ut_divide 260 * FUNCTION: acpi_ut_short_divide, acpi_ut_divide
261 * 261 *
262 * PARAMETERS: See function headers above
263 *
262 * DESCRIPTION: Native versions of the ut_divide functions. Use these if either 264 * DESCRIPTION: Native versions of the ut_divide functions. Use these if either
263 * 1) The target is a 64-bit platform and therefore 64-bit 265 * 1) The target is a 64-bit platform and therefore 64-bit
264 * integer math is supported directly by the machine. 266 * integer math is supported directly by the machine.
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index f6598547389b..f6de4ed3d527 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -49,12 +49,57 @@
49#define _COMPONENT ACPI_UTILITIES 49#define _COMPONENT ACPI_UTILITIES
50 ACPI_MODULE_NAME ("utmisc") 50 ACPI_MODULE_NAME ("utmisc")
51 51
52/* Local prototypes */
53
54static acpi_status
55acpi_ut_create_mutex (
56 acpi_mutex_handle mutex_id);
57
58static acpi_status
59acpi_ut_delete_mutex (
60 acpi_mutex_handle mutex_id);
61
62
63/*******************************************************************************
64 *
65 * FUNCTION: acpi_ut_strupr (strupr)
66 *
67 * PARAMETERS: src_string - The source string to convert
68 *
69 * RETURN: Converted src_string (same as input pointer)
70 *
71 * DESCRIPTION: Convert string to uppercase
72 *
73 * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
74 *
75 ******************************************************************************/
76
77char *
78acpi_ut_strupr (
79 char *src_string)
80{
81 char *string;
82
83
84 ACPI_FUNCTION_ENTRY ();
85
86
87 /* Walk entire string, uppercasing the letters */
88
89 for (string = src_string; *string; string++) {
90 *string = (char) ACPI_TOUPPER (*string);
91 }
92
93 return (src_string);
94}
95
52 96
53/******************************************************************************* 97/*******************************************************************************
54 * 98 *
55 * FUNCTION: acpi_ut_print_string 99 * FUNCTION: acpi_ut_print_string
56 * 100 *
57 * PARAMETERS: String - Null terminated ASCII string 101 * PARAMETERS: String - Null terminated ASCII string
102 * max_length - Maximum output length
58 * 103 *
59 * RETURN: None 104 * RETURN: None
60 * 105 *
@@ -148,6 +193,8 @@ acpi_ut_print_string (
148 * 193 *
149 * PARAMETERS: Value - Value to be converted 194 * PARAMETERS: Value - Value to be converted
150 * 195 *
196 * RETURN: u32 integer with bytes swapped
197 *
151 * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes) 198 * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
152 * 199 *
153 ******************************************************************************/ 200 ******************************************************************************/
@@ -160,7 +207,6 @@ acpi_ut_dword_byte_swap (
160 u32 value; 207 u32 value;
161 u8 bytes[4]; 208 u8 bytes[4];
162 } out; 209 } out;
163
164 union { 210 union {
165 u32 value; 211 u32 value;
166 u8 bytes[4]; 212 u8 bytes[4];
@@ -219,7 +265,8 @@ acpi_ut_set_integer_width (
219 * 265 *
220 * FUNCTION: acpi_ut_display_init_pathname 266 * FUNCTION: acpi_ut_display_init_pathname
221 * 267 *
222 * PARAMETERS: obj_handle - Handle whose pathname will be displayed 268 * PARAMETERS: Type - Object type of the node
269 * obj_handle - Handle whose pathname will be displayed
223 * Path - Additional path string to be appended. 270 * Path - Additional path string to be appended.
224 * (NULL if no extra path) 271 * (NULL if no extra path)
225 * 272 *
@@ -270,7 +317,8 @@ acpi_ut_display_init_pathname (
270 317
271 /* Print the object type and pathname */ 318 /* Print the object type and pathname */
272 319
273 acpi_os_printf ("%-12s %s", acpi_ut_get_type_name (type), (char *) buffer.pointer); 320 acpi_os_printf ("%-12s %s",
321 acpi_ut_get_type_name (type), (char *) buffer.pointer);
274 322
275 /* Extra path is used to append names like _STA, _INI, etc. */ 323 /* Extra path is used to append names like _STA, _INI, etc. */
276 324
@@ -288,9 +336,9 @@ acpi_ut_display_init_pathname (
288 * 336 *
289 * FUNCTION: acpi_ut_valid_acpi_name 337 * FUNCTION: acpi_ut_valid_acpi_name
290 * 338 *
291 * PARAMETERS: Character - The character to be examined 339 * PARAMETERS: Name - The name to be examined
292 * 340 *
293 * RETURN: 1 if Character may appear in a name, else 0 341 * RETURN: TRUE if the name is valid, FALSE otherwise
294 * 342 *
295 * DESCRIPTION: Check for a valid ACPI name. Each character must be one of: 343 * DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
296 * 1) Upper case alpha 344 * 1) Upper case alpha
@@ -495,40 +543,6 @@ error_exit:
495 543
496/******************************************************************************* 544/*******************************************************************************
497 * 545 *
498 * FUNCTION: acpi_ut_strupr
499 *
500 * PARAMETERS: src_string - The source string to convert to
501 *
502 * RETURN: src_string
503 *
504 * DESCRIPTION: Convert string to uppercase
505 *
506 ******************************************************************************/
507#ifdef ACPI_FUTURE_USAGE
508char *
509acpi_ut_strupr (
510 char *src_string)
511{
512 char *string;
513
514
515 ACPI_FUNCTION_ENTRY ();
516
517
518 /* Walk entire string, uppercasing the letters */
519
520 for (string = src_string; *string; ) {
521 *string = (char) ACPI_TOUPPER (*string);
522 string++;
523 }
524
525 return (src_string);
526}
527#endif /* ACPI_FUTURE_USAGE */
528
529
530/*******************************************************************************
531 *
532 * FUNCTION: acpi_ut_mutex_initialize 546 * FUNCTION: acpi_ut_mutex_initialize
533 * 547 *
534 * PARAMETERS: None. 548 * PARAMETERS: None.
@@ -611,7 +625,7 @@ acpi_ut_mutex_terminate (
611 * 625 *
612 ******************************************************************************/ 626 ******************************************************************************/
613 627
614acpi_status 628static acpi_status
615acpi_ut_create_mutex ( 629acpi_ut_create_mutex (
616 acpi_mutex_handle mutex_id) 630 acpi_mutex_handle mutex_id)
617{ 631{
@@ -648,7 +662,7 @@ acpi_ut_create_mutex (
648 * 662 *
649 ******************************************************************************/ 663 ******************************************************************************/
650 664
651acpi_status 665static acpi_status
652acpi_ut_delete_mutex ( 666acpi_ut_delete_mutex (
653 acpi_mutex_handle mutex_id) 667 acpi_mutex_handle mutex_id)
654{ 668{
@@ -715,16 +729,16 @@ acpi_ut_acquire_mutex (
715 if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { 729 if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
716 if (i == mutex_id) { 730 if (i == mutex_id) {
717 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 731 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
718 "Mutex [%s] already acquired by this thread [%X]\n", 732 "Mutex [%s] already acquired by this thread [%X]\n",
719 acpi_ut_get_mutex_name (mutex_id), this_thread_id)); 733 acpi_ut_get_mutex_name (mutex_id), this_thread_id));
720 734
721 return (AE_ALREADY_ACQUIRED); 735 return (AE_ALREADY_ACQUIRED);
722 } 736 }
723 737
724 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 738 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
725 "Invalid acquire order: Thread %X owns [%s], wants [%s]\n", 739 "Invalid acquire order: Thread %X owns [%s], wants [%s]\n",
726 this_thread_id, acpi_ut_get_mutex_name (i), 740 this_thread_id, acpi_ut_get_mutex_name (i),
727 acpi_ut_get_mutex_name (mutex_id))); 741 acpi_ut_get_mutex_name (mutex_id)));
728 742
729 return (AE_ACQUIRE_DEADLOCK); 743 return (AE_ACQUIRE_DEADLOCK);
730 } 744 }
@@ -733,22 +747,23 @@ acpi_ut_acquire_mutex (
733#endif 747#endif
734 748
735 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, 749 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
736 "Thread %X attempting to acquire Mutex [%s]\n", 750 "Thread %X attempting to acquire Mutex [%s]\n",
737 this_thread_id, acpi_ut_get_mutex_name (mutex_id))); 751 this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
738 752
739 status = acpi_os_wait_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 753 status = acpi_os_wait_semaphore (acpi_gbl_mutex_info[mutex_id].mutex,
740 1, ACPI_WAIT_FOREVER); 754 1, ACPI_WAIT_FOREVER);
741 if (ACPI_SUCCESS (status)) { 755 if (ACPI_SUCCESS (status)) {
742 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n", 756 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
743 this_thread_id, acpi_ut_get_mutex_name (mutex_id))); 757 this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
744 758
745 acpi_gbl_mutex_info[mutex_id].use_count++; 759 acpi_gbl_mutex_info[mutex_id].use_count++;
746 acpi_gbl_mutex_info[mutex_id].owner_id = this_thread_id; 760 acpi_gbl_mutex_info[mutex_id].owner_id = this_thread_id;
747 } 761 }
748 else { 762 else {
749 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not acquire Mutex [%s] %s\n", 763 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
750 this_thread_id, acpi_ut_get_mutex_name (mutex_id), 764 "Thread %X could not acquire Mutex [%s] %s\n",
751 acpi_format_exception (status))); 765 this_thread_id, acpi_ut_get_mutex_name (mutex_id),
766 acpi_format_exception (status)));
752 } 767 }
753 768
754 return (status); 769 return (status);
@@ -793,8 +808,8 @@ acpi_ut_release_mutex (
793 */ 808 */
794 if (acpi_gbl_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) { 809 if (acpi_gbl_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) {
795 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 810 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
796 "Mutex [%s] is not acquired, cannot release\n", 811 "Mutex [%s] is not acquired, cannot release\n",
797 acpi_ut_get_mutex_name (mutex_id))); 812 acpi_ut_get_mutex_name (mutex_id)));
798 813
799 return (AE_NOT_ACQUIRED); 814 return (AE_NOT_ACQUIRED);
800 } 815 }
@@ -812,8 +827,8 @@ acpi_ut_release_mutex (
812 } 827 }
813 828
814 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 829 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
815 "Invalid release order: owns [%s], releasing [%s]\n", 830 "Invalid release order: owns [%s], releasing [%s]\n",
816 acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id))); 831 acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id)));
817 832
818 return (AE_RELEASE_DEADLOCK); 833 return (AE_RELEASE_DEADLOCK);
819 } 834 }
@@ -826,13 +841,14 @@ acpi_ut_release_mutex (
826 status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1); 841 status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1);
827 842
828 if (ACPI_FAILURE (status)) { 843 if (ACPI_FAILURE (status)) {
829 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not release Mutex [%s] %s\n", 844 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
830 this_thread_id, acpi_ut_get_mutex_name (mutex_id), 845 "Thread %X could not release Mutex [%s] %s\n",
831 acpi_format_exception (status))); 846 this_thread_id, acpi_ut_get_mutex_name (mutex_id),
847 acpi_format_exception (status)));
832 } 848 }
833 else { 849 else {
834 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n", 850 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n",
835 this_thread_id, acpi_ut_get_mutex_name (mutex_id))); 851 this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
836 } 852 }
837 853
838 return (status); 854 return (status);
@@ -843,11 +859,11 @@ acpi_ut_release_mutex (
843 * 859 *
844 * FUNCTION: acpi_ut_create_update_state_and_push 860 * FUNCTION: acpi_ut_create_update_state_and_push
845 * 861 *
846 * PARAMETERS: *Object - Object to be added to the new state 862 * PARAMETERS: Object - Object to be added to the new state
847 * Action - Increment/Decrement 863 * Action - Increment/Decrement
848 * state_list - List the state will be added to 864 * state_list - List the state will be added to
849 * 865 *
850 * RETURN: None 866 * RETURN: Status
851 * 867 *
852 * DESCRIPTION: Create a new state and push it 868 * DESCRIPTION: Create a new state and push it
853 * 869 *
@@ -885,15 +901,16 @@ acpi_ut_create_update_state_and_push (
885 * 901 *
886 * FUNCTION: acpi_ut_create_pkg_state_and_push 902 * FUNCTION: acpi_ut_create_pkg_state_and_push
887 * 903 *
888 * PARAMETERS: *Object - Object to be added to the new state 904 * PARAMETERS: Object - Object to be added to the new state
889 * Action - Increment/Decrement 905 * Action - Increment/Decrement
890 * state_list - List the state will be added to 906 * state_list - List the state will be added to
891 * 907 *
892 * RETURN: None 908 * RETURN: Status
893 * 909 *
894 * DESCRIPTION: Create a new state and push it 910 * DESCRIPTION: Create a new state and push it
895 * 911 *
896 ******************************************************************************/ 912 ******************************************************************************/
913
897#ifdef ACPI_FUTURE_USAGE 914#ifdef ACPI_FUTURE_USAGE
898acpi_status 915acpi_status
899acpi_ut_create_pkg_state_and_push ( 916acpi_ut_create_pkg_state_and_push (
@@ -925,7 +942,7 @@ acpi_ut_create_pkg_state_and_push (
925 * PARAMETERS: list_head - Head of the state stack 942 * PARAMETERS: list_head - Head of the state stack
926 * State - State object to push 943 * State - State object to push
927 * 944 *
928 * RETURN: Status 945 * RETURN: None
929 * 946 *
930 * DESCRIPTION: Push a state object onto a state stack 947 * DESCRIPTION: Push a state object onto a state stack
931 * 948 *
@@ -954,7 +971,7 @@ acpi_ut_push_generic_state (
954 * 971 *
955 * PARAMETERS: list_head - Head of the state stack 972 * PARAMETERS: list_head - Head of the state stack
956 * 973 *
957 * RETURN: Status 974 * RETURN: The popped state object
958 * 975 *
959 * DESCRIPTION: Pop a state object from a state stack 976 * DESCRIPTION: Pop a state object from a state stack
960 * 977 *
@@ -989,7 +1006,7 @@ acpi_ut_pop_generic_state (
989 * 1006 *
990 * PARAMETERS: None 1007 * PARAMETERS: None
991 * 1008 *
992 * RETURN: Status 1009 * RETURN: The new state object. NULL on failure.
993 * 1010 *
994 * DESCRIPTION: Create a generic state object. Attempt to obtain one from 1011 * DESCRIPTION: Create a generic state object. Attempt to obtain one from
995 * the global state cache; If none available, create a new one. 1012 * the global state cache; If none available, create a new one.
@@ -997,7 +1014,8 @@ acpi_ut_pop_generic_state (
997 ******************************************************************************/ 1014 ******************************************************************************/
998 1015
999union acpi_generic_state * 1016union acpi_generic_state *
1000acpi_ut_create_generic_state (void) 1017acpi_ut_create_generic_state (
1018 void)
1001{ 1019{
1002 union acpi_generic_state *state; 1020 union acpi_generic_state *state;
1003 1021
@@ -1023,7 +1041,7 @@ acpi_ut_create_generic_state (void)
1023 * 1041 *
1024 * PARAMETERS: None 1042 * PARAMETERS: None
1025 * 1043 *
1026 * RETURN: Thread State 1044 * RETURN: New Thread State. NULL on failure
1027 * 1045 *
1028 * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used 1046 * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used
1029 * to track per-thread info during method execution 1047 * to track per-thread info during method execution
@@ -1060,11 +1078,10 @@ acpi_ut_create_thread_state (
1060 * 1078 *
1061 * FUNCTION: acpi_ut_create_update_state 1079 * FUNCTION: acpi_ut_create_update_state
1062 * 1080 *
1063 * PARAMETERS: Object - Initial Object to be installed in the 1081 * PARAMETERS: Object - Initial Object to be installed in the state
1064 * state 1082 * Action - Update action to be performed
1065 * Action - Update action to be performed
1066 * 1083 *
1067 * RETURN: Status 1084 * RETURN: New state object, null on failure
1068 * 1085 *
1069 * DESCRIPTION: Create an "Update State" - a flavor of the generic state used 1086 * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
1070 * to update reference counts and delete complex objects such 1087 * to update reference counts and delete complex objects such
@@ -1104,11 +1121,10 @@ acpi_ut_create_update_state (
1104 * 1121 *
1105 * FUNCTION: acpi_ut_create_pkg_state 1122 * FUNCTION: acpi_ut_create_pkg_state
1106 * 1123 *
1107 * PARAMETERS: Object - Initial Object to be installed in the 1124 * PARAMETERS: Object - Initial Object to be installed in the state
1108 * state 1125 * Action - Update action to be performed
1109 * Action - Update action to be performed
1110 * 1126 *
1111 * RETURN: Status 1127 * RETURN: New state object, null on failure
1112 * 1128 *
1113 * DESCRIPTION: Create a "Package State" 1129 * DESCRIPTION: Create a "Package State"
1114 * 1130 *
@@ -1151,7 +1167,7 @@ acpi_ut_create_pkg_state (
1151 * 1167 *
1152 * PARAMETERS: None 1168 * PARAMETERS: None
1153 * 1169 *
1154 * RETURN: Status 1170 * RETURN: New state object, null on failure
1155 * 1171 *
1156 * DESCRIPTION: Create a "Control State" - a flavor of the generic state used 1172 * DESCRIPTION: Create a "Control State" - a flavor of the generic state used
1157 * to support nested IF/WHILE constructs in the AML. 1173 * to support nested IF/WHILE constructs in the AML.
@@ -1190,7 +1206,7 @@ acpi_ut_create_control_state (
1190 * 1206 *
1191 * PARAMETERS: State - The state object to be deleted 1207 * PARAMETERS: State - The state object to be deleted
1192 * 1208 *
1193 * RETURN: Status 1209 * RETURN: None
1194 * 1210 *
1195 * DESCRIPTION: Put a state object back into the global state cache. The object 1211 * DESCRIPTION: Put a state object back into the global state cache. The object
1196 * is not actually freed at this time. 1212 * is not actually freed at this time.
@@ -1216,7 +1232,7 @@ acpi_ut_delete_generic_state (
1216 * 1232 *
1217 * PARAMETERS: None 1233 * PARAMETERS: None
1218 * 1234 *
1219 * RETURN: Status 1235 * RETURN: None
1220 * 1236 *
1221 * DESCRIPTION: Purge the global state object cache. Used during subsystem 1237 * DESCRIPTION: Purge the global state object cache. Used during subsystem
1222 * termination. 1238 * termination.
@@ -1240,7 +1256,10 @@ acpi_ut_delete_generic_state_cache (
1240 * 1256 *
1241 * FUNCTION: acpi_ut_walk_package_tree 1257 * FUNCTION: acpi_ut_walk_package_tree
1242 * 1258 *
1243 * PARAMETERS: obj_desc - The Package object on which to resolve refs 1259 * PARAMETERS: source_object - The package to walk
1260 * target_object - Target object (if package is being copied)
1261 * walk_callback - Called once for each package element
1262 * Context - Passed to the callback function
1244 * 1263 *
1245 * RETURN: Status 1264 * RETURN: Status
1246 * 1265 *
@@ -1359,7 +1378,7 @@ acpi_ut_walk_package_tree (
1359 * PARAMETERS: Buffer - Buffer to be scanned 1378 * PARAMETERS: Buffer - Buffer to be scanned
1360 * Length - number of bytes to examine 1379 * Length - number of bytes to examine
1361 * 1380 *
1362 * RETURN: checksum 1381 * RETURN: The generated checksum
1363 * 1382 *
1364 * DESCRIPTION: Generate a checksum on a raw buffer 1383 * DESCRIPTION: Generate a checksum on a raw buffer
1365 * 1384 *
@@ -1442,7 +1461,6 @@ acpi_ut_get_resource_end_tag (
1442 * PARAMETERS: module_name - Caller's module name (for error output) 1461 * PARAMETERS: module_name - Caller's module name (for error output)
1443 * line_number - Caller's line number (for error output) 1462 * line_number - Caller's line number (for error output)
1444 * component_id - Caller's component ID (for error output) 1463 * component_id - Caller's component ID (for error output)
1445 * Message - Error message to use on failure
1446 * 1464 *
1447 * RETURN: None 1465 * RETURN: None
1448 * 1466 *
@@ -1457,7 +1475,6 @@ acpi_ut_report_error (
1457 u32 component_id) 1475 u32 component_id)
1458{ 1476{
1459 1477
1460
1461 acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number); 1478 acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number);
1462} 1479}
1463 1480
@@ -1469,7 +1486,6 @@ acpi_ut_report_error (
1469 * PARAMETERS: module_name - Caller's module name (for error output) 1486 * PARAMETERS: module_name - Caller's module name (for error output)
1470 * line_number - Caller's line number (for error output) 1487 * line_number - Caller's line number (for error output)
1471 * component_id - Caller's component ID (for error output) 1488 * component_id - Caller's component ID (for error output)
1472 * Message - Error message to use on failure
1473 * 1489 *
1474 * RETURN: None 1490 * RETURN: None
1475 * 1491 *
@@ -1495,7 +1511,6 @@ acpi_ut_report_warning (
1495 * PARAMETERS: module_name - Caller's module name (for error output) 1511 * PARAMETERS: module_name - Caller's module name (for error output)
1496 * line_number - Caller's line number (for error output) 1512 * line_number - Caller's line number (for error output)
1497 * component_id - Caller's component ID (for error output) 1513 * component_id - Caller's component ID (for error output)
1498 * Message - Error message to use on failure
1499 * 1514 *
1500 * RETURN: None 1515 * RETURN: None
1501 * 1516 *
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
index 9ee40a484e07..cd3899b9cc5a 100644
--- a/drivers/acpi/utilities/utobject.c
+++ b/drivers/acpi/utilities/utobject.c
@@ -50,6 +50,25 @@
50#define _COMPONENT ACPI_UTILITIES 50#define _COMPONENT ACPI_UTILITIES
51 ACPI_MODULE_NAME ("utobject") 51 ACPI_MODULE_NAME ("utobject")
52 52
53/* Local prototypes */
54
55static acpi_status
56acpi_ut_get_simple_object_size (
57 union acpi_operand_object *obj,
58 acpi_size *obj_length);
59
60static acpi_status
61acpi_ut_get_package_object_size (
62 union acpi_operand_object *obj,
63 acpi_size *obj_length);
64
65static acpi_status
66acpi_ut_get_element_length (
67 u8 object_type,
68 union acpi_operand_object *source_object,
69 union acpi_generic_state *state,
70 void *context);
71
53 72
54/******************************************************************************* 73/*******************************************************************************
55 * 74 *
@@ -60,7 +79,7 @@
60 * component_id - Component type of caller 79 * component_id - Component type of caller
61 * Type - ACPI Type of the new object 80 * Type - ACPI Type of the new object
62 * 81 *
63 * RETURN: Object - The new object. Null on failure 82 * RETURN: A new internal object, null on failure
64 * 83 *
65 * DESCRIPTION: Create and initialize a new internal object. 84 * DESCRIPTION: Create and initialize a new internal object.
66 * 85 *
@@ -83,7 +102,8 @@ acpi_ut_create_internal_object_dbg (
83 union acpi_operand_object *second_object; 102 union acpi_operand_object *second_object;
84 103
85 104
86 ACPI_FUNCTION_TRACE_STR ("ut_create_internal_object_dbg", acpi_ut_get_type_name (type)); 105 ACPI_FUNCTION_TRACE_STR ("ut_create_internal_object_dbg",
106 acpi_ut_get_type_name (type));
87 107
88 108
89 /* Allocate the raw object descriptor */ 109 /* Allocate the raw object descriptor */
@@ -99,7 +119,8 @@ acpi_ut_create_internal_object_dbg (
99 119
100 /* These types require a secondary object */ 120 /* These types require a secondary object */
101 121
102 second_object = acpi_ut_allocate_object_desc_dbg (module_name, line_number, component_id); 122 second_object = acpi_ut_allocate_object_desc_dbg (module_name,
123 line_number, component_id);
103 if (!second_object) { 124 if (!second_object) {
104 acpi_ut_delete_object_desc (object); 125 acpi_ut_delete_object_desc (object);
105 return_PTR (NULL); 126 return_PTR (NULL);
@@ -138,7 +159,7 @@ acpi_ut_create_internal_object_dbg (
138 * 159 *
139 * PARAMETERS: buffer_size - Size of buffer to be created 160 * PARAMETERS: buffer_size - Size of buffer to be created
140 * 161 *
141 * RETURN: Pointer to a new Buffer object 162 * RETURN: Pointer to a new Buffer object, null on failure
142 * 163 *
143 * DESCRIPTION: Create a fully initialized buffer object 164 * DESCRIPTION: Create a fully initialized buffer object
144 * 165 *
@@ -192,9 +213,9 @@ acpi_ut_create_buffer_object (
192 * 213 *
193 * FUNCTION: acpi_ut_create_string_object 214 * FUNCTION: acpi_ut_create_string_object
194 * 215 *
195 * PARAMETERS: string_size - Size of string to be created. Does not 216 * PARAMETERS: string_size - Size of string to be created. Does not
196 * include NULL terminator, this is added 217 * include NULL terminator, this is added
197 * automatically. 218 * automatically.
198 * 219 *
199 * RETURN: Pointer to a new String object 220 * RETURN: Pointer to a new String object
200 * 221 *
@@ -249,7 +270,9 @@ acpi_ut_create_string_object (
249 * 270 *
250 * PARAMETERS: Object - Object to be validated 271 * PARAMETERS: Object - Object to be validated
251 * 272 *
252 * RETURN: Validate a pointer to be an union acpi_operand_object 273 * RETURN: TRUE if object is valid, FALSE otherwise
274 *
275 * DESCRIPTION: Validate a pointer to be an union acpi_operand_object
253 * 276 *
254 ******************************************************************************/ 277 ******************************************************************************/
255 278
@@ -399,8 +422,8 @@ acpi_ut_delete_object_cache (
399 * 422 *
400 * FUNCTION: acpi_ut_get_simple_object_size 423 * FUNCTION: acpi_ut_get_simple_object_size
401 * 424 *
402 * PARAMETERS: *internal_object - Pointer to the object we are examining 425 * PARAMETERS: internal_object - An ACPI operand object
403 * *obj_length - Where the length is returned 426 * obj_length - Where the length is returned
404 * 427 *
405 * RETURN: Status 428 * RETURN: Status
406 * 429 *
@@ -412,7 +435,7 @@ acpi_ut_delete_object_cache (
412 * 435 *
413 ******************************************************************************/ 436 ******************************************************************************/
414 437
415acpi_status 438static acpi_status
416acpi_ut_get_simple_object_size ( 439acpi_ut_get_simple_object_size (
417 union acpi_operand_object *internal_object, 440 union acpi_operand_object *internal_object,
418 acpi_size *obj_length) 441 acpi_size *obj_length)
@@ -424,8 +447,10 @@ acpi_ut_get_simple_object_size (
424 ACPI_FUNCTION_TRACE_PTR ("ut_get_simple_object_size", internal_object); 447 ACPI_FUNCTION_TRACE_PTR ("ut_get_simple_object_size", internal_object);
425 448
426 449
427 /* Handle a null object (Could be a uninitialized package element -- which is legal) */ 450 /*
428 451 * Handle a null object (Could be a uninitialized package
452 * element -- which is legal)
453 */
429 if (!internal_object) { 454 if (!internal_object) {
430 *obj_length = 0; 455 *obj_length = 0;
431 return_ACPI_STATUS (AE_OK); 456 return_ACPI_STATUS (AE_OK);
@@ -480,7 +505,8 @@ acpi_ut_get_simple_object_size (
480 * Get the actual length of the full pathname to this object. 505 * Get the actual length of the full pathname to this object.
481 * The reference will be converted to the pathname to the object 506 * The reference will be converted to the pathname to the object
482 */ 507 */
483 length += ACPI_ROUND_UP_TO_NATIVE_WORD (acpi_ns_get_pathname_length (internal_object->reference.node)); 508 length += ACPI_ROUND_UP_TO_NATIVE_WORD (
509 acpi_ns_get_pathname_length (internal_object->reference.node));
484 break; 510 break;
485 511
486 default: 512 default:
@@ -530,7 +556,7 @@ acpi_ut_get_simple_object_size (
530 * 556 *
531 ******************************************************************************/ 557 ******************************************************************************/
532 558
533acpi_status 559static acpi_status
534acpi_ut_get_element_length ( 560acpi_ut_get_element_length (
535 u8 object_type, 561 u8 object_type,
536 union acpi_operand_object *source_object, 562 union acpi_operand_object *source_object,
@@ -582,8 +608,8 @@ acpi_ut_get_element_length (
582 * 608 *
583 * FUNCTION: acpi_ut_get_package_object_size 609 * FUNCTION: acpi_ut_get_package_object_size
584 * 610 *
585 * PARAMETERS: *internal_object - Pointer to the object we are examining 611 * PARAMETERS: internal_object - An ACPI internal object
586 * *obj_length - Where the length is returned 612 * obj_length - Where the length is returned
587 * 613 *
588 * RETURN: Status 614 * RETURN: Status
589 * 615 *
@@ -595,7 +621,7 @@ acpi_ut_get_element_length (
595 * 621 *
596 ******************************************************************************/ 622 ******************************************************************************/
597 623
598acpi_status 624static acpi_status
599acpi_ut_get_package_object_size ( 625acpi_ut_get_package_object_size (
600 union acpi_operand_object *internal_object, 626 union acpi_operand_object *internal_object,
601 acpi_size *obj_length) 627 acpi_size *obj_length)
@@ -636,8 +662,8 @@ acpi_ut_get_package_object_size (
636 * 662 *
637 * FUNCTION: acpi_ut_get_object_size 663 * FUNCTION: acpi_ut_get_object_size
638 * 664 *
639 * PARAMETERS: *internal_object - Pointer to the object we are examining 665 * PARAMETERS: internal_object - An ACPI internal object
640 * *obj_length - Where the length will be returned 666 * obj_length - Where the length will be returned
641 * 667 *
642 * RETURN: Status 668 * RETURN: Status
643 * 669 *
@@ -647,7 +673,7 @@ acpi_ut_get_package_object_size (
647 ******************************************************************************/ 673 ******************************************************************************/
648 674
649acpi_status 675acpi_status
650acpi_ut_get_object_size( 676acpi_ut_get_object_size (
651 union acpi_operand_object *internal_object, 677 union acpi_operand_object *internal_object,
652 acpi_size *obj_length) 678 acpi_size *obj_length)
653{ 679{
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c
index 97a91f3f06f0..e8803d810656 100644
--- a/drivers/acpi/utilities/utxface.c
+++ b/drivers/acpi/utilities/utxface.c
@@ -73,6 +73,7 @@ acpi_initialize_subsystem (
73{ 73{
74 acpi_status status; 74 acpi_status status;
75 75
76
76 ACPI_FUNCTION_TRACE ("acpi_initialize_subsystem"); 77 ACPI_FUNCTION_TRACE ("acpi_initialize_subsystem");
77 78
78 79
@@ -105,7 +106,6 @@ acpi_initialize_subsystem (
105 * Initialize the namespace manager and 106 * Initialize the namespace manager and
106 * the root of the namespace tree 107 * the root of the namespace tree
107 */ 108 */
108
109 status = acpi_ns_root_initialize (); 109 status = acpi_ns_root_initialize ();
110 if (ACPI_FAILURE (status)) { 110 if (ACPI_FAILURE (status)) {
111 ACPI_REPORT_ERROR (("Namespace initialization failure, %s\n", 111 ACPI_REPORT_ERROR (("Namespace initialization failure, %s\n",
@@ -113,7 +113,6 @@ acpi_initialize_subsystem (
113 return_ACPI_STATUS (status); 113 return_ACPI_STATUS (status);
114 } 114 }
115 115
116
117 /* If configured, initialize the AML debugger */ 116 /* If configured, initialize the AML debugger */
118 117
119 ACPI_DEBUGGER_EXEC (status = acpi_db_initialize ()); 118 ACPI_DEBUGGER_EXEC (status = acpi_db_initialize ());
@@ -150,7 +149,8 @@ acpi_enable_subsystem (
150 * The values from the FADT are validated here. 149 * The values from the FADT are validated here.
151 */ 150 */
152 if (!(flags & ACPI_NO_HARDWARE_INIT)) { 151 if (!(flags & ACPI_NO_HARDWARE_INIT)) {
153 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI hardware\n")); 152 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
153 "[Init] Initializing ACPI hardware\n"));
154 154
155 status = acpi_hw_initialize (); 155 status = acpi_hw_initialize ();
156 if (ACPI_FAILURE (status)) { 156 if (ACPI_FAILURE (status)) {
@@ -178,7 +178,8 @@ acpi_enable_subsystem (
178 * install_address_space_handler interface. 178 * install_address_space_handler interface.
179 */ 179 */
180 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { 180 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
181 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n")); 181 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
182 "[Init] Installing default address space handlers\n"));
182 183
183 status = acpi_ev_install_region_handlers (); 184 status = acpi_ev_install_region_handlers ();
184 if (ACPI_FAILURE (status)) { 185 if (ACPI_FAILURE (status)) {
@@ -189,12 +190,14 @@ acpi_enable_subsystem (
189 /* 190 /*
190 * Initialize ACPI Event handling (Fixed and General Purpose) 191 * Initialize ACPI Event handling (Fixed and General Purpose)
191 * 192 *
192 * NOTE: We must have the hardware AND events initialized before we can execute 193 * NOTE: We must have the hardware AND events initialized before we can
193 * ANY control methods SAFELY. Any control method can require ACPI hardware 194 * execute ANY control methods SAFELY. Any control method can require
194 * support, so the hardware MUST be initialized before execution! 195 * ACPI hardware support, so the hardware MUST be initialized before
196 * execution!
195 */ 197 */
196 if (!(flags & ACPI_NO_EVENT_INIT)) { 198 if (!(flags & ACPI_NO_EVENT_INIT)) {
197 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI events\n")); 199 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
200 "[Init] Initializing ACPI events\n"));
198 201
199 status = acpi_ev_initialize_events (); 202 status = acpi_ev_initialize_events ();
200 if (ACPI_FAILURE (status)) { 203 if (ACPI_FAILURE (status)) {
@@ -205,7 +208,8 @@ acpi_enable_subsystem (
205 /* Install the SCI handler and Global Lock handler */ 208 /* Install the SCI handler and Global Lock handler */
206 209
207 if (!(flags & ACPI_NO_HANDLER_INIT)) { 210 if (!(flags & ACPI_NO_HANDLER_INIT)) {
208 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing SCI/GL handlers\n")); 211 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
212 "[Init] Installing SCI/GL handlers\n"));
209 213
210 status = acpi_ev_install_xrupt_handlers (); 214 status = acpi_ev_install_xrupt_handlers ();
211 if (ACPI_FAILURE (status)) { 215 if (ACPI_FAILURE (status)) {
@@ -247,7 +251,8 @@ acpi_initialize_objects (
247 * contain executable AML (see call to acpi_ns_initialize_objects below). 251 * contain executable AML (see call to acpi_ns_initialize_objects below).
248 */ 252 */
249 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { 253 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
250 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Executing _REG op_region methods\n")); 254 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
255 "[Init] Executing _REG op_region methods\n"));
251 256
252 status = acpi_ev_initialize_op_regions (); 257 status = acpi_ev_initialize_op_regions ();
253 if (ACPI_FAILURE (status)) { 258 if (ACPI_FAILURE (status)) {
@@ -261,7 +266,8 @@ acpi_initialize_objects (
261 * objects: operation_regions, buffer_fields, Buffers, and Packages. 266 * objects: operation_regions, buffer_fields, Buffers, and Packages.
262 */ 267 */
263 if (!(flags & ACPI_NO_OBJECT_INIT)) { 268 if (!(flags & ACPI_NO_OBJECT_INIT)) {
264 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Completing Initialization of ACPI Objects\n")); 269 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
270 "[Init] Completing Initialization of ACPI Objects\n"));
265 271
266 status = acpi_ns_initialize_objects (); 272 status = acpi_ns_initialize_objects ();
267 if (ACPI_FAILURE (status)) { 273 if (ACPI_FAILURE (status)) {
@@ -274,7 +280,8 @@ acpi_initialize_objects (
274 * This runs the _STA and _INI methods. 280 * This runs the _STA and _INI methods.
275 */ 281 */
276 if (!(flags & ACPI_NO_DEVICE_INIT)) { 282 if (!(flags & ACPI_NO_DEVICE_INIT)) {
277 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Devices\n")); 283 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
284 "[Init] Initializing ACPI Devices\n"));
278 285
279 status = acpi_ns_initialize_devices (); 286 status = acpi_ns_initialize_devices ();
280 if (ACPI_FAILURE (status)) { 287 if (ACPI_FAILURE (status)) {
@@ -307,7 +314,8 @@ acpi_initialize_objects (
307 ******************************************************************************/ 314 ******************************************************************************/
308 315
309acpi_status 316acpi_status
310acpi_terminate (void) 317acpi_terminate (
318 void)
311{ 319{
312 acpi_status status; 320 acpi_status status;
313 321
@@ -344,8 +352,7 @@ acpi_terminate (void)
344 352
345 353
346#ifdef ACPI_FUTURE_USAGE 354#ifdef ACPI_FUTURE_USAGE
347 355/*******************************************************************************
348/*****************************************************************************
349 * 356 *
350 * FUNCTION: acpi_subsystem_status 357 * FUNCTION: acpi_subsystem_status
351 * 358 *
@@ -354,14 +361,16 @@ acpi_terminate (void)
354 * RETURN: Status of the ACPI subsystem 361 * RETURN: Status of the ACPI subsystem
355 * 362 *
356 * DESCRIPTION: Other drivers that use the ACPI subsystem should call this 363 * DESCRIPTION: Other drivers that use the ACPI subsystem should call this
357 * before making any other calls, to ensure the subsystem initial- 364 * before making any other calls, to ensure the subsystem
358 * ized successfully. 365 * initialized successfully.
359 * 366 *
360 ****************************************************************************/ 367 ******************************************************************************/
361 368
362acpi_status 369acpi_status
363acpi_subsystem_status (void) 370acpi_subsystem_status (
371 void)
364{ 372{
373
365 if (acpi_gbl_startup_flags & ACPI_INITIALIZED_OK) { 374 if (acpi_gbl_startup_flags & ACPI_INITIALIZED_OK) {
366 return (AE_OK); 375 return (AE_OK);
367 } 376 }
@@ -371,13 +380,12 @@ acpi_subsystem_status (void)
371} 380}
372 381
373 382
374/****************************************************************************** 383/*******************************************************************************
375 * 384 *
376 * FUNCTION: acpi_get_system_info 385 * FUNCTION: acpi_get_system_info
377 * 386 *
378 * PARAMETERS: out_buffer - a pointer to a buffer to receive the 387 * PARAMETERS: out_buffer - A buffer to receive the resources for the
379 * resources for the device 388 * device
380 * buffer_length - the number of bytes available in the buffer
381 * 389 *
382 * RETURN: Status - the status of the call 390 * RETURN: Status - the status of the call
383 * 391 *
@@ -395,8 +403,8 @@ acpi_get_system_info (
395 struct acpi_buffer *out_buffer) 403 struct acpi_buffer *out_buffer)
396{ 404{
397 struct acpi_system_info *info_ptr; 405 struct acpi_system_info *info_ptr;
398 u32 i;
399 acpi_status status; 406 acpi_status status;
407 u32 i;
400 408
401 409
402 ACPI_FUNCTION_TRACE ("acpi_get_system_info"); 410 ACPI_FUNCTION_TRACE ("acpi_get_system_info");
@@ -466,6 +474,7 @@ EXPORT_SYMBOL(acpi_get_system_info);
466 * FUNCTION: acpi_install_initialization_handler 474 * FUNCTION: acpi_install_initialization_handler
467 * 475 *
468 * PARAMETERS: Handler - Callback procedure 476 * PARAMETERS: Handler - Callback procedure
477 * Function - Not (currently) used, see below
469 * 478 *
470 * RETURN: Status 479 * RETURN: Status
471 * 480 *
@@ -495,7 +504,6 @@ acpi_install_initialization_handler (
495 504
496#endif /* ACPI_FUTURE_USAGE */ 505#endif /* ACPI_FUTURE_USAGE */
497 506
498
499/***************************************************************************** 507/*****************************************************************************
500 * 508 *
501 * FUNCTION: acpi_purge_cached_objects 509 * FUNCTION: acpi_purge_cached_objects
@@ -509,7 +517,8 @@ acpi_install_initialization_handler (
509 ****************************************************************************/ 517 ****************************************************************************/
510 518
511acpi_status 519acpi_status
512acpi_purge_cached_objects (void) 520acpi_purge_cached_objects (
521 void)
513{ 522{
514 ACPI_FUNCTION_TRACE ("acpi_purge_cached_objects"); 523 ACPI_FUNCTION_TRACE ("acpi_purge_cached_objects");
515 524
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 2b41e47b7d80..2f6ab189fc6f 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -64,7 +64,7 @@
64 64
65/* Version string */ 65/* Version string */
66 66
67#define ACPI_CA_VERSION 0x20050309 67#define ACPI_CA_VERSION 0x20050408
68 68
69/* 69/*
70 * OS name, used for the _OS object. The _OS object is essentially obsolete, 70 * OS name, used for the _OS object. The _OS object is essentially obsolete,
@@ -130,9 +130,8 @@
130#define ACPI_MAX_GPE_BLOCKS 2 130#define ACPI_MAX_GPE_BLOCKS 2
131#define ACPI_GPE_REGISTER_WIDTH 8 131#define ACPI_GPE_REGISTER_WIDTH 8
132 132
133/* 133/* Method info (in WALK_STATE), containing local variables and argumetns */
134 * Method info (in WALK_STATE), containing local variables and argumetns 134
135 */
136#define ACPI_METHOD_NUM_LOCALS 8 135#define ACPI_METHOD_NUM_LOCALS 8
137#define ACPI_METHOD_MAX_LOCAL 7 136#define ACPI_METHOD_MAX_LOCAL 7
138 137
diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h
index 223b2a506e49..8ba372b0f245 100644
--- a/include/acpi/acdebug.h
+++ b/include/acpi/acdebug.h
@@ -61,9 +61,7 @@ struct argument_info
61 61
62 62
63#define PARAM_LIST(pl) pl 63#define PARAM_LIST(pl) pl
64
65#define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose) 64#define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose)
66
67#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ 65#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\
68 acpi_os_printf PARAM_LIST(fp);} 66 acpi_os_printf PARAM_LIST(fp);}
69 67
@@ -71,13 +69,9 @@ struct argument_info
71#define EX_SINGLE_STEP 2 69#define EX_SINGLE_STEP 2
72 70
73 71
74/* Prototypes */
75
76
77/* 72/*
78 * dbxface - external debugger interfaces 73 * dbxface - external debugger interfaces
79 */ 74 */
80
81acpi_status 75acpi_status
82acpi_db_initialize ( 76acpi_db_initialize (
83 void); 77 void);
@@ -92,20 +86,10 @@ acpi_db_single_step (
92 union acpi_parse_object *op, 86 union acpi_parse_object *op,
93 u32 op_type); 87 u32 op_type);
94 88
95acpi_status
96acpi_db_start_command (
97 struct acpi_walk_state *walk_state,
98 union acpi_parse_object *op);
99
100void
101acpi_db_method_end (
102 struct acpi_walk_state *walk_state);
103
104 89
105/* 90/*
106 * dbcmds - debug commands and output routines 91 * dbcmds - debug commands and output routines
107 */ 92 */
108
109acpi_status 93acpi_status
110acpi_db_disassemble_method ( 94acpi_db_disassemble_method (
111 char *name); 95 char *name);
@@ -177,57 +161,30 @@ acpi_db_find_references (
177 char *object_arg); 161 char *object_arg);
178 162
179void 163void
180acpi_db_display_locks (void); 164acpi_db_display_locks (
181 165 void);
182 166
183void 167void
184acpi_db_display_resources ( 168acpi_db_display_resources (
185 char *object_arg); 169 char *object_arg);
186 170
187void 171void
188acpi_db_display_gpes (void); 172acpi_db_display_gpes (
173 void);
189 174
190void 175void
191acpi_db_check_integrity ( 176acpi_db_check_integrity (
192 void); 177 void);
193 178
194acpi_status
195acpi_db_integrity_walk (
196 acpi_handle obj_handle,
197 u32 nesting_level,
198 void *context,
199 void **return_value);
200
201acpi_status
202acpi_db_walk_and_match_name (
203 acpi_handle obj_handle,
204 u32 nesting_level,
205 void *context,
206 void **return_value);
207
208acpi_status
209acpi_db_walk_for_references (
210 acpi_handle obj_handle,
211 u32 nesting_level,
212 void *context,
213 void **return_value);
214
215acpi_status
216acpi_db_walk_for_specific_objects (
217 acpi_handle obj_handle,
218 u32 nesting_level,
219 void *context,
220 void **return_value);
221
222void 179void
223acpi_db_generate_gpe ( 180acpi_db_generate_gpe (
224 char *gpe_arg, 181 char *gpe_arg,
225 char *block_arg); 182 char *block_arg);
226 183
184
227/* 185/*
228 * dbdisply - debug display commands 186 * dbdisply - debug display commands
229 */ 187 */
230
231void 188void
232acpi_db_display_method_info ( 189acpi_db_display_method_info (
233 union acpi_parse_object *op); 190 union acpi_parse_object *op);
@@ -271,19 +228,10 @@ acpi_db_display_argument_object (
271 union acpi_operand_object *obj_desc, 228 union acpi_operand_object *obj_desc,
272 struct acpi_walk_state *walk_state); 229 struct acpi_walk_state *walk_state);
273 230
274void
275acpi_db_dump_parser_descriptor (
276 union acpi_parse_object *op);
277
278void *
279acpi_db_get_pointer (
280 void *target);
281
282 231
283/* 232/*
284 * dbexec - debugger control method execution 233 * dbexec - debugger control method execution
285 */ 234 */
286
287void 235void
288acpi_db_execute ( 236acpi_db_execute (
289 char *name, 237 char *name,
@@ -296,44 +244,15 @@ acpi_db_create_execution_threads (
296 char *num_loops_arg, 244 char *num_loops_arg,
297 char *method_name_arg); 245 char *method_name_arg);
298 246
299acpi_status
300acpi_db_execute_method (
301 struct acpi_db_method_info *info,
302 struct acpi_buffer *return_obj);
303
304void
305acpi_db_execute_setup (
306 struct acpi_db_method_info *info);
307
308u32
309acpi_db_get_outstanding_allocations (
310 void);
311
312void ACPI_SYSTEM_XFACE
313acpi_db_method_thread (
314 void *context);
315
316acpi_status
317acpi_db_execution_walk (
318 acpi_handle obj_handle,
319 u32 nesting_level,
320 void *context,
321 void **return_value);
322
323 247
324/* 248/*
325 * dbfileio - Debugger file I/O commands 249 * dbfileio - Debugger file I/O commands
326 */ 250 */
327
328acpi_object_type 251acpi_object_type
329acpi_db_match_argument ( 252acpi_db_match_argument (
330 char *user_argument, 253 char *user_argument,
331 struct argument_info *arguments); 254 struct argument_info *arguments);
332 255
333acpi_status
334ae_local_load_table (
335 struct acpi_table_header *table_ptr);
336
337void 256void
338acpi_db_close_debug_file ( 257acpi_db_close_debug_file (
339 void); 258 void);
@@ -356,16 +275,17 @@ acpi_db_read_table_from_file (
356 char *filename, 275 char *filename,
357 struct acpi_table_header **table); 276 struct acpi_table_header **table);
358 277
278
359/* 279/*
360 * dbhistry - debugger HISTORY command 280 * dbhistry - debugger HISTORY command
361 */ 281 */
362
363void 282void
364acpi_db_add_to_history ( 283acpi_db_add_to_history (
365 char *command_line); 284 char *command_line);
366 285
367void 286void
368acpi_db_display_history (void); 287acpi_db_display_history (
288 void);
369 289
370char * 290char *
371acpi_db_get_from_history ( 291acpi_db_get_from_history (
@@ -375,7 +295,6 @@ acpi_db_get_from_history (
375/* 295/*
376 * dbinput - user front-end to the AML debugger 296 * dbinput - user front-end to the AML debugger
377 */ 297 */
378
379acpi_status 298acpi_status
380acpi_db_command_dispatch ( 299acpi_db_command_dispatch (
381 char *input_buffer, 300 char *input_buffer,
@@ -386,71 +305,28 @@ void ACPI_SYSTEM_XFACE
386acpi_db_execute_thread ( 305acpi_db_execute_thread (
387 void *context); 306 void *context);
388 307
389void
390acpi_db_display_help (
391 char *help_type);
392
393char *
394acpi_db_get_next_token (
395 char *string,
396 char **next);
397
398u32
399acpi_db_get_line (
400 char *input_buffer);
401
402u32
403acpi_db_match_command (
404 char *user_command);
405
406void
407acpi_db_single_thread (
408 void);
409
410 308
411/* 309/*
412 * dbstats - Generation and display of ACPI table statistics 310 * dbstats - Generation and display of ACPI table statistics
413 */ 311 */
414
415void 312void
416acpi_db_generate_statistics ( 313acpi_db_generate_statistics (
417 union acpi_parse_object *root, 314 union acpi_parse_object *root,
418 u8 is_method); 315 u8 is_method);
419 316
420
421acpi_status 317acpi_status
422acpi_db_display_statistics ( 318acpi_db_display_statistics (
423 char *type_arg); 319 char *type_arg);
424 320
425acpi_status
426acpi_db_classify_one_object (
427 acpi_handle obj_handle,
428 u32 nesting_level,
429 void *context,
430 void **return_value);
431
432void
433acpi_db_count_namespace_objects (
434 void);
435
436void
437acpi_db_enumerate_object (
438 union acpi_operand_object *obj_desc);
439
440 321
441/* 322/*
442 * dbutils - AML debugger utilities 323 * dbutils - AML debugger utilities
443 */ 324 */
444
445void 325void
446acpi_db_set_output_destination ( 326acpi_db_set_output_destination (
447 u32 where); 327 u32 where);
448 328
449void 329void
450acpi_db_dump_buffer (
451 u32 address);
452
453void
454acpi_db_dump_object ( 330acpi_db_dump_object (
455 union acpi_object *obj_desc, 331 union acpi_object *obj_desc,
456 u32 level); 332 u32 level);
@@ -459,14 +335,8 @@ void
459acpi_db_prep_namestring ( 335acpi_db_prep_namestring (
460 char *name); 336 char *name);
461 337
462
463acpi_status
464acpi_db_second_pass_parse (
465 union acpi_parse_object *root);
466
467struct acpi_namespace_node * 338struct acpi_namespace_node *
468acpi_db_local_ns_lookup ( 339acpi_db_local_ns_lookup (
469 char *name); 340 char *name);
470 341
471
472#endif /* __ACDEBUG_H__ */ 342#endif /* __ACDEBUG_H__ */
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h
index 26d907eae6fe..dbfa877121ba 100644
--- a/include/acpi/acdisasm.h
+++ b/include/acpi/acdisasm.h
@@ -102,58 +102,16 @@ acpi_status (*asl_walk_callback) (
102/* 102/*
103 * dmwalk 103 * dmwalk
104 */ 104 */
105
106void
107acpi_dm_walk_parse_tree (
108 union acpi_parse_object *op,
109 asl_walk_callback descending_callback,
110 asl_walk_callback ascending_callback,
111 void *context);
112
113acpi_status
114acpi_dm_descending_op (
115 union acpi_parse_object *op,
116 u32 level,
117 void *context);
118
119acpi_status
120acpi_dm_ascending_op (
121 union acpi_parse_object *op,
122 u32 level,
123 void *context);
124
125
126/*
127 * dmopcode
128 */
129
130void
131acpi_dm_validate_name (
132 char *name,
133 union acpi_parse_object *op);
134
135u32
136acpi_dm_dump_name (
137 char *name);
138
139void
140acpi_dm_unicode (
141 union acpi_parse_object *op);
142
143void 105void
144acpi_dm_disassemble ( 106acpi_dm_disassemble (
145 struct acpi_walk_state *walk_state, 107 struct acpi_walk_state *walk_state,
146 union acpi_parse_object *origin, 108 union acpi_parse_object *origin,
147 u32 num_opcodes); 109 u32 num_opcodes);
148 110
149void
150acpi_dm_namestring (
151 char *name);
152
153void
154acpi_dm_display_path (
155 union acpi_parse_object *op);
156 111
112/*
113 * dmopcode
114 */
157void 115void
158acpi_dm_disassemble_one_op ( 116acpi_dm_disassemble_one_op (
159 struct acpi_walk_state *walk_state, 117 struct acpi_walk_state *walk_state,
@@ -165,18 +123,9 @@ acpi_dm_decode_internal_object (
165 union acpi_operand_object *obj_desc); 123 union acpi_operand_object *obj_desc);
166 124
167u32 125u32
168acpi_dm_block_type (
169 union acpi_parse_object *op);
170
171u32
172acpi_dm_list_type ( 126acpi_dm_list_type (
173 union acpi_parse_object *op); 127 union acpi_parse_object *op);
174 128
175acpi_status
176acpi_ps_display_object_pathname (
177 struct acpi_walk_state *walk_state,
178 union acpi_parse_object *op);
179
180void 129void
181acpi_dm_method_flags ( 130acpi_dm_method_flags (
182 union acpi_parse_object *op); 131 union acpi_parse_object *op);
@@ -197,10 +146,6 @@ void
197acpi_dm_match_op ( 146acpi_dm_match_op (
198 union acpi_parse_object *op); 147 union acpi_parse_object *op);
199 148
200void
201acpi_dm_match_keyword (
202 union acpi_parse_object *op);
203
204u8 149u8
205acpi_dm_comma_if_list_member ( 150acpi_dm_comma_if_list_member (
206 union acpi_parse_object *op); 151 union acpi_parse_object *op);
@@ -211,13 +156,25 @@ acpi_dm_comma_if_field_member (
211 156
212 157
213/* 158/*
214 * dmobject 159 * dmnames
215 */ 160 */
161u32
162acpi_dm_dump_name (
163 char *name);
164
165acpi_status
166acpi_ps_display_object_pathname (
167 struct acpi_walk_state *walk_state,
168 union acpi_parse_object *op);
216 169
217void 170void
218acpi_dm_decode_node ( 171acpi_dm_namestring (
219 struct acpi_namespace_node *node); 172 char *name);
173
220 174
175/*
176 * dmobject
177 */
221void 178void
222acpi_dm_display_internal_object ( 179acpi_dm_display_internal_object (
223 union acpi_operand_object *obj_desc, 180 union acpi_operand_object *obj_desc,
@@ -241,6 +198,16 @@ acpi_dm_dump_method_info (
241/* 198/*
242 * dmbuffer 199 * dmbuffer
243 */ 200 */
201void
202acpi_dm_disasm_byte_list (
203 u32 level,
204 u8 *byte_data,
205 u32 byte_count);
206
207void
208acpi_dm_byte_list (
209 struct acpi_op_walk_info *info,
210 union acpi_parse_object *op);
244 211
245void 212void
246acpi_is_eisa_id ( 213acpi_is_eisa_id (
@@ -262,18 +229,6 @@ acpi_dm_is_string_buffer (
262/* 229/*
263 * dmresrc 230 * dmresrc
264 */ 231 */
265
266void
267acpi_dm_disasm_byte_list (
268 u32 level,
269 u8 *byte_data,
270 u32 byte_count);
271
272void
273acpi_dm_byte_list (
274 struct acpi_op_walk_info *info,
275 union acpi_parse_object *op);
276
277void 232void
278acpi_dm_resource_descriptor ( 233acpi_dm_resource_descriptor (
279 struct acpi_op_walk_info *info, 234 struct acpi_op_walk_info *info,
@@ -296,19 +251,10 @@ void
296acpi_dm_decode_attribute ( 251acpi_dm_decode_attribute (
297 u8 attribute); 252 u8 attribute);
298 253
254
299/* 255/*
300 * dmresrcl 256 * dmresrcl
301 */ 257 */
302
303void
304acpi_dm_io_flags (
305 u8 flags);
306
307void
308acpi_dm_memory_flags (
309 u8 flags,
310 u8 specific_flags);
311
312void 258void
313acpi_dm_word_descriptor ( 259acpi_dm_word_descriptor (
314 struct asl_word_address_desc *resource, 260 struct asl_word_address_desc *resource,
@@ -373,7 +319,6 @@ acpi_dm_vendor_large_descriptor (
373/* 319/*
374 * dmresrcs 320 * dmresrcs
375 */ 321 */
376
377void 322void
378acpi_dm_irq_descriptor ( 323acpi_dm_irq_descriptor (
379 struct asl_irq_format_desc *resource, 324 struct asl_irq_format_desc *resource,
@@ -420,7 +365,6 @@ acpi_dm_vendor_small_descriptor (
420/* 365/*
421 * dmutils 366 * dmutils
422 */ 367 */
423
424void 368void
425acpi_dm_add_to_external_list ( 369acpi_dm_add_to_external_list (
426 char *path); 370 char *path);
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h
index 237d63433581..8f5f2f71b1de 100644
--- a/include/acpi/acdispat.h
+++ b/include/acpi/acdispat.h
@@ -50,40 +50,9 @@
50#define NAMEOF_ARG_NTE "__A0" 50#define NAMEOF_ARG_NTE "__A0"
51 51
52 52
53/* Common interfaces */ 53/*
54 54 * dsopcode - support for late evaluation
55acpi_status 55 */
56acpi_ds_obj_stack_push (
57 void *object,
58 struct acpi_walk_state *walk_state);
59
60acpi_status
61acpi_ds_obj_stack_pop (
62 u32 pop_count,
63 struct acpi_walk_state *walk_state);
64
65#ifdef ACPI_FUTURE_USAGE
66void *
67acpi_ds_obj_stack_get_value (
68 u32 index,
69 struct acpi_walk_state *walk_state);
70#endif
71
72acpi_status
73acpi_ds_obj_stack_pop_object (
74 union acpi_operand_object **object,
75 struct acpi_walk_state *walk_state);
76
77
78/* dsopcode - support for late evaluation */
79
80acpi_status
81acpi_ds_execute_arguments (
82 struct acpi_namespace_node *node,
83 struct acpi_namespace_node *scope_node,
84 u32 aml_length,
85 u8 *aml_start);
86
87acpi_status 56acpi_status
88acpi_ds_get_buffer_field_arguments ( 57acpi_ds_get_buffer_field_arguments (
89 union acpi_operand_object *obj_desc); 58 union acpi_operand_object *obj_desc);
@@ -101,15 +70,6 @@ acpi_ds_get_package_arguments (
101 union acpi_operand_object *obj_desc); 70 union acpi_operand_object *obj_desc);
102 71
103acpi_status 72acpi_status
104acpi_ds_init_buffer_field (
105 u16 aml_opcode,
106 union acpi_operand_object *obj_desc,
107 union acpi_operand_object *buffer_desc,
108 union acpi_operand_object *offset_desc,
109 union acpi_operand_object *length_desc,
110 union acpi_operand_object *result_desc);
111
112acpi_status
113acpi_ds_eval_buffer_field_operands ( 73acpi_ds_eval_buffer_field_operands (
114 struct acpi_walk_state *walk_state, 74 struct acpi_walk_state *walk_state,
115 union acpi_parse_object *op); 75 union acpi_parse_object *op);
@@ -130,9 +90,9 @@ acpi_ds_initialize_region (
130 acpi_handle obj_handle); 90 acpi_handle obj_handle);
131 91
132 92
133/* dsctrl - Parser/Interpreter interface, control stack routines */ 93/*
134 94 * dsctrl - Parser/Interpreter interface, control stack routines
135 95 */
136acpi_status 96acpi_status
137acpi_ds_exec_begin_control_op ( 97acpi_ds_exec_begin_control_op (
138 struct acpi_walk_state *walk_state, 98 struct acpi_walk_state *walk_state,
@@ -144,9 +104,9 @@ acpi_ds_exec_end_control_op (
144 union acpi_parse_object *op); 104 union acpi_parse_object *op);
145 105
146 106
147/* dsexec - Parser/Interpreter interface, method execution callbacks */ 107/*
148 108 * dsexec - Parser/Interpreter interface, method execution callbacks
149 109 */
150acpi_status 110acpi_status
151acpi_ds_get_predicate_value ( 111acpi_ds_get_predicate_value (
152 struct acpi_walk_state *walk_state, 112 struct acpi_walk_state *walk_state,
@@ -162,14 +122,9 @@ acpi_ds_exec_end_op (
162 struct acpi_walk_state *state); 122 struct acpi_walk_state *state);
163 123
164 124
165/* dsfield - Parser/Interpreter interface for AML fields */ 125/*
166 126 * dsfield - Parser/Interpreter interface for AML fields
167acpi_status 127 */
168acpi_ds_get_field_names (
169 struct acpi_create_field_info *info,
170 struct acpi_walk_state *walk_state,
171 union acpi_parse_object *arg);
172
173acpi_status 128acpi_status
174acpi_ds_create_field ( 129acpi_ds_create_field (
175 union acpi_parse_object *op, 130 union acpi_parse_object *op,
@@ -199,8 +154,9 @@ acpi_ds_init_field_objects (
199 struct acpi_walk_state *walk_state); 154 struct acpi_walk_state *walk_state);
200 155
201 156
202/* dsload - Parser/Interpreter interface, namespace load callbacks */ 157/*
203 158 * dsload - Parser/Interpreter interface, namespace load callbacks
159 */
204acpi_status 160acpi_status
205acpi_ds_load1_begin_op ( 161acpi_ds_load1_begin_op (
206 struct acpi_walk_state *walk_state, 162 struct acpi_walk_state *walk_state,
@@ -225,9 +181,9 @@ acpi_ds_init_callbacks (
225 u32 pass_number); 181 u32 pass_number);
226 182
227 183
228/* dsmthdat - method data (locals/args) */ 184/*
229 185 * dsmthdat - method data (locals/args)
230 186 */
231acpi_status 187acpi_status
232acpi_ds_store_object_to_local ( 188acpi_ds_store_object_to_local (
233 u16 opcode, 189 u16 opcode,
@@ -250,14 +206,6 @@ u8
250acpi_ds_is_method_value ( 206acpi_ds_is_method_value (
251 union acpi_operand_object *obj_desc); 207 union acpi_operand_object *obj_desc);
252 208
253#ifdef ACPI_FUTURE_USAGE
254acpi_object_type
255acpi_ds_method_data_get_type (
256 u16 opcode,
257 u32 index,
258 struct acpi_walk_state *walk_state);
259#endif
260
261acpi_status 209acpi_status
262acpi_ds_method_data_get_value ( 210acpi_ds_method_data_get_value (
263 u16 opcode, 211 u16 opcode,
@@ -265,12 +213,6 @@ acpi_ds_method_data_get_value (
265 struct acpi_walk_state *walk_state, 213 struct acpi_walk_state *walk_state,
266 union acpi_operand_object **dest_desc); 214 union acpi_operand_object **dest_desc);
267 215
268void
269acpi_ds_method_data_delete_value (
270 u16 opcode,
271 u32 index,
272 struct acpi_walk_state *walk_state);
273
274acpi_status 216acpi_status
275acpi_ds_method_data_init_args ( 217acpi_ds_method_data_init_args (
276 union acpi_operand_object **params, 218 union acpi_operand_object **params,
@@ -288,16 +230,10 @@ void
288acpi_ds_method_data_init ( 230acpi_ds_method_data_init (
289 struct acpi_walk_state *walk_state); 231 struct acpi_walk_state *walk_state);
290 232
291acpi_status
292acpi_ds_method_data_set_value (
293 u16 opcode,
294 u32 index,
295 union acpi_operand_object *object,
296 struct acpi_walk_state *walk_state);
297
298
299/* dsmethod - Parser/Interpreter interface - control method parsing */
300 233
234/*
235 * dsmethod - Parser/Interpreter interface - control method parsing
236 */
301acpi_status 237acpi_status
302acpi_ds_parse_method ( 238acpi_ds_parse_method (
303 acpi_handle obj_handle); 239 acpi_handle obj_handle);
@@ -324,20 +260,18 @@ acpi_ds_begin_method_execution (
324 struct acpi_namespace_node *calling_method_node); 260 struct acpi_namespace_node *calling_method_node);
325 261
326 262
327/* dsobj - Parser/Interpreter interface - object initialization and conversion */ 263/*
328 264 * dsinit
329acpi_status 265 */
330acpi_ds_init_one_object (
331 acpi_handle obj_handle,
332 u32 level,
333 void *context,
334 void **return_value);
335
336acpi_status 266acpi_status
337acpi_ds_initialize_objects ( 267acpi_ds_initialize_objects (
338 struct acpi_table_desc *table_desc, 268 struct acpi_table_desc *table_desc,
339 struct acpi_namespace_node *start_node); 269 struct acpi_namespace_node *start_node);
340 270
271
272/*
273 * dsobject - Parser/Interpreter interface - object initialization and conversion
274 */
341acpi_status 275acpi_status
342acpi_ds_build_internal_buffer_obj ( 276acpi_ds_build_internal_buffer_obj (
343 struct acpi_walk_state *walk_state, 277 struct acpi_walk_state *walk_state,
@@ -353,12 +287,6 @@ acpi_ds_build_internal_package_obj (
353 union acpi_operand_object **obj_desc); 287 union acpi_operand_object **obj_desc);
354 288
355acpi_status 289acpi_status
356acpi_ds_build_internal_object (
357 struct acpi_walk_state *walk_state,
358 union acpi_parse_object *op,
359 union acpi_operand_object **obj_desc_ptr);
360
361acpi_status
362acpi_ds_init_object_from_op ( 290acpi_ds_init_object_from_op (
363 struct acpi_walk_state *walk_state, 291 struct acpi_walk_state *walk_state,
364 union acpi_parse_object *op, 292 union acpi_parse_object *op,
@@ -372,8 +300,9 @@ acpi_ds_create_node (
372 union acpi_parse_object *op); 300 union acpi_parse_object *op);
373 301
374 302
375/* dsutils - Parser/Interpreter interface utility routines */ 303/*
376 304 * dsutils - Parser/Interpreter interface utility routines
305 */
377void 306void
378acpi_ds_clear_implicit_return ( 307acpi_ds_clear_implicit_return (
379 struct acpi_walk_state *walk_state); 308 struct acpi_walk_state *walk_state);
@@ -418,7 +347,6 @@ acpi_ds_clear_operands (
418/* 347/*
419 * dswscope - Scope Stack manipulation 348 * dswscope - Scope Stack manipulation
420 */ 349 */
421
422acpi_status 350acpi_status
423acpi_ds_scope_stack_push ( 351acpi_ds_scope_stack_push (
424 struct acpi_namespace_node *node, 352 struct acpi_namespace_node *node,
@@ -435,7 +363,18 @@ acpi_ds_scope_stack_clear (
435 struct acpi_walk_state *walk_state); 363 struct acpi_walk_state *walk_state);
436 364
437 365
438/* dswstate - parser WALK_STATE management routines */ 366/*
367 * dswstate - parser WALK_STATE management routines
368 */
369acpi_status
370acpi_ds_obj_stack_push (
371 void *object,
372 struct acpi_walk_state *walk_state);
373
374acpi_status
375acpi_ds_obj_stack_pop (
376 u32 pop_count,
377 struct acpi_walk_state *walk_state);
439 378
440struct acpi_walk_state * 379struct acpi_walk_state *
441acpi_ds_create_walk_state ( 380acpi_ds_create_walk_state (
@@ -454,12 +393,6 @@ acpi_ds_init_aml_walk (
454 struct acpi_parameter_info *info, 393 struct acpi_parameter_info *info,
455 u32 pass_number); 394 u32 pass_number);
456 395
457#ifdef ACPI_FUTURE_USAGE
458acpi_status
459acpi_ds_obj_stack_delete_all (
460 struct acpi_walk_state *walk_state);
461#endif
462
463acpi_status 396acpi_status
464acpi_ds_obj_stack_pop_and_delete ( 397acpi_ds_obj_stack_pop_and_delete (
465 u32 pop_count, 398 u32 pop_count,
@@ -494,20 +427,8 @@ struct acpi_walk_state *
494acpi_ds_get_current_walk_state ( 427acpi_ds_get_current_walk_state (
495 struct acpi_thread_state *thread); 428 struct acpi_thread_state *thread);
496 429
497#ifdef ACPI_ENABLE_OBJECT_CACHE
498void
499acpi_ds_delete_walk_state_cache (
500 void);
501#endif
502
503#ifdef ACPI_FUTURE_USAGE 430#ifdef ACPI_FUTURE_USAGE
504acpi_status 431acpi_status
505acpi_ds_result_insert (
506 void *object,
507 u32 index,
508 struct acpi_walk_state *walk_state);
509
510acpi_status
511acpi_ds_result_remove ( 432acpi_ds_result_remove (
512 union acpi_operand_object **object, 433 union acpi_operand_object **object,
513 u32 index, 434 u32 index,
@@ -529,4 +450,10 @@ acpi_ds_result_pop_from_bottom (
529 union acpi_operand_object **object, 450 union acpi_operand_object **object,
530 struct acpi_walk_state *walk_state); 451 struct acpi_walk_state *walk_state);
531 452
453#ifdef ACPI_ENABLE_OBJECT_CACHE
454void
455acpi_ds_delete_walk_state_cache (
456 void);
457#endif
458
532#endif /* _ACDISPAT_H_ */ 459#endif /* _ACDISPAT_H_ */
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h
index 2dec083ba1cd..61a27c8c5079 100644
--- a/include/acpi/acevents.h
+++ b/include/acpi/acevents.h
@@ -45,6 +45,9 @@
45#define __ACEVENTS_H__ 45#define __ACEVENTS_H__
46 46
47 47
48/*
49 * evevent
50 */
48acpi_status 51acpi_status
49acpi_ev_initialize_events ( 52acpi_ev_initialize_events (
50 void); 53 void);
@@ -53,28 +56,14 @@ acpi_status
53acpi_ev_install_xrupt_handlers ( 56acpi_ev_install_xrupt_handlers (
54 void); 57 void);
55 58
56
57/*
58 * Evfixed - Fixed event handling
59 */
60
61acpi_status
62acpi_ev_fixed_event_initialize (
63 void);
64
65u32 59u32
66acpi_ev_fixed_event_detect ( 60acpi_ev_fixed_event_detect (
67 void); 61 void);
68 62
69u32
70acpi_ev_fixed_event_dispatch (
71 u32 event);
72
73 63
74/* 64/*
75 * Evmisc 65 * evmisc
76 */ 66 */
77
78u8 67u8
79acpi_ev_is_notify_object ( 68acpi_ev_is_notify_object (
80 struct acpi_namespace_node *node); 69 struct acpi_namespace_node *node);
@@ -100,24 +89,10 @@ acpi_ev_queue_notify_request (
100 struct acpi_namespace_node *node, 89 struct acpi_namespace_node *node,
101 u32 notify_value); 90 u32 notify_value);
102 91
103void ACPI_SYSTEM_XFACE
104acpi_ev_notify_dispatch (
105 void *context);
106
107 92
108/* 93/*
109 * Evgpe - GPE handling and dispatch 94 * evgpe - GPE handling and dispatch
110 */ 95 */
111
112acpi_status
113acpi_ev_walk_gpe_list (
114 ACPI_GPE_CALLBACK gpe_walk_callback,
115 u32 flags);
116
117u8
118acpi_ev_valid_gpe_event (
119 struct acpi_gpe_event_info *gpe_event_info);
120
121acpi_status 96acpi_status
122acpi_ev_update_gpe_enable_masks ( 97acpi_ev_update_gpe_enable_masks (
123 struct acpi_gpe_event_info *gpe_event_info, 98 struct acpi_gpe_event_info *gpe_event_info,
@@ -137,9 +112,23 @@ acpi_ev_get_gpe_event_info (
137 acpi_handle gpe_device, 112 acpi_handle gpe_device,
138 u32 gpe_number); 113 u32 gpe_number);
139 114
115
116/*
117 * evgpeblk
118 */
119u8
120acpi_ev_valid_gpe_event (
121 struct acpi_gpe_event_info *gpe_event_info);
122
140acpi_status 123acpi_status
141acpi_ev_gpe_initialize ( 124acpi_ev_walk_gpe_list (
142 void); 125 ACPI_GPE_CALLBACK gpe_walk_callback,
126 u32 flags);
127
128acpi_status
129acpi_ev_delete_gpe_handlers (
130 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
131 struct acpi_gpe_block_info *gpe_block);
143 132
144acpi_status 133acpi_status
145acpi_ev_create_gpe_block ( 134acpi_ev_create_gpe_block (
@@ -154,11 +143,6 @@ acpi_status
154acpi_ev_delete_gpe_block ( 143acpi_ev_delete_gpe_block (
155 struct acpi_gpe_block_info *gpe_block); 144 struct acpi_gpe_block_info *gpe_block);
156 145
157acpi_status
158acpi_ev_delete_gpe_handlers (
159 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
160 struct acpi_gpe_block_info *gpe_block);
161
162u32 146u32
163acpi_ev_gpe_dispatch ( 147acpi_ev_gpe_dispatch (
164 struct acpi_gpe_event_info *gpe_event_info, 148 struct acpi_gpe_event_info *gpe_event_info,
@@ -177,10 +161,14 @@ acpi_status
177acpi_ev_check_for_wake_only_gpe ( 161acpi_ev_check_for_wake_only_gpe (
178 struct acpi_gpe_event_info *gpe_event_info); 162 struct acpi_gpe_event_info *gpe_event_info);
179 163
164acpi_status
165acpi_ev_gpe_initialize (
166 void);
167
168
180/* 169/*
181 * Evregion - Address Space handling 170 * evregion - Address Space handling
182 */ 171 */
183
184acpi_status 172acpi_status
185acpi_ev_install_region_handlers ( 173acpi_ev_install_region_handlers (
186 void); 174 void);
@@ -198,13 +186,6 @@ acpi_ev_address_space_dispatch (
198 void *value); 186 void *value);
199 187
200acpi_status 188acpi_status
201acpi_ev_install_handler (
202 acpi_handle obj_handle,
203 u32 level,
204 void *context,
205 void **return_value);
206
207acpi_status
208acpi_ev_attach_region ( 189acpi_ev_attach_region (
209 union acpi_operand_object *handler_obj, 190 union acpi_operand_object *handler_obj,
210 union acpi_operand_object *region_obj, 191 union acpi_operand_object *region_obj,
@@ -233,17 +214,10 @@ acpi_ev_execute_reg_method (
233 union acpi_operand_object *region_obj, 214 union acpi_operand_object *region_obj,
234 u32 function); 215 u32 function);
235 216
236acpi_status
237acpi_ev_reg_run (
238 acpi_handle obj_handle,
239 u32 level,
240 void *context,
241 void **return_value);
242 217
243/* 218/*
244 * Evregini - Region initialization and setup 219 * evregini - Region initialization and setup
245 */ 220 */
246
247acpi_status 221acpi_status
248acpi_ev_system_memory_region_setup ( 222acpi_ev_system_memory_region_setup (
249 acpi_handle handle, 223 acpi_handle handle,
@@ -293,9 +267,8 @@ acpi_ev_initialize_region (
293 267
294 268
295/* 269/*
296 * Evsci - SCI (System Control Interrupt) handling/dispatch 270 * evsci - SCI (System Control Interrupt) handling/dispatch
297 */ 271 */
298
299u32 ACPI_SYSTEM_XFACE 272u32 ACPI_SYSTEM_XFACE
300acpi_ev_gpe_xrupt_handler ( 273acpi_ev_gpe_xrupt_handler (
301 void *context); 274 void *context);
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 53f8b50fac1a..60d737b2d70f 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -48,7 +48,6 @@
48/* 48/*
49 * Exceptions returned by external ACPI interfaces 49 * Exceptions returned by external ACPI interfaces
50 */ 50 */
51
52#define AE_CODE_ENVIRONMENTAL 0x0000 51#define AE_CODE_ENVIRONMENTAL 0x0000
53#define AE_CODE_PROGRAMMER 0x1000 52#define AE_CODE_PROGRAMMER 0x1000
54#define AE_CODE_ACPI_TABLES 0x2000 53#define AE_CODE_ACPI_TABLES 0x2000
@@ -99,6 +98,7 @@
99 98
100#define AE_CODE_ENV_MAX 0x001E 99#define AE_CODE_ENV_MAX 0x001E
101 100
101
102/* 102/*
103 * Programmer exceptions 103 * Programmer exceptions
104 */ 104 */
@@ -168,6 +168,7 @@
168 168
169#define AE_CODE_AML_MAX 0x0021 169#define AE_CODE_AML_MAX 0x0021
170 170
171
171/* 172/*
172 * Internal exceptions used for control 173 * Internal exceptions used for control
173 */ 174 */
@@ -188,6 +189,7 @@
188 189
189#ifdef DEFINE_ACPI_GLOBALS 190#ifdef DEFINE_ACPI_GLOBALS
190 191
192
191/* 193/*
192 * String versions of the exception codes above 194 * String versions of the exception codes above
193 * These strings must match the corresponding defines exactly 195 * These strings must match the corresponding defines exactly
@@ -304,5 +306,4 @@ char const *acpi_gbl_exception_names_ctrl[] =
304 306
305#endif /* ACPI GLOBALS */ 307#endif /* ACPI GLOBALS */
306 308
307
308#endif /* __ACEXCEP_H__ */ 309#endif /* __ACEXCEP_H__ */
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
index c7f387a972cb..4946696088c3 100644
--- a/include/acpi/acglobal.h
+++ b/include/acpi/acglobal.h
@@ -146,15 +146,15 @@ ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT;
146ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS; 146ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS;
147ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; 147ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS;
148/* 148/*
149 * Since there may be multiple SSDTs and PSDTS, a single pointer is not 149 * Since there may be multiple SSDTs and PSDTs, a single pointer is not
150 * sufficient; Therefore, there isn't one! 150 * sufficient; Therefore, there isn't one!
151 */ 151 */
152 152
153 153
154/* 154/*
155 * Handle both ACPI 1.0 and ACPI 2.0 Integer widths 155 * Handle both ACPI 1.0 and ACPI 2.0 Integer widths:
156 * If we are running a method that exists in a 32-bit ACPI table. 156 * If we are executing a method that exists in a 32-bit ACPI table,
157 * Use only 32 bits of the Integer for conversion. 157 * use only the lower 32 bits of the (internal) 64-bit Integer.
158 */ 158 */
159ACPI_EXTERN u8 acpi_gbl_integer_bit_width; 159ACPI_EXTERN u8 acpi_gbl_integer_bit_width;
160ACPI_EXTERN u8 acpi_gbl_integer_byte_width; 160ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
@@ -246,6 +246,7 @@ ACPI_EXTERN acpi_size acpi_gbl_lowest_stack_pointer;
246ACPI_EXTERN u32 acpi_gbl_deepest_nesting; 246ACPI_EXTERN u32 acpi_gbl_deepest_nesting;
247#endif 247#endif
248 248
249
249/***************************************************************************** 250/*****************************************************************************
250 * 251 *
251 * Interpreter globals 252 * Interpreter globals
@@ -268,6 +269,7 @@ ACPI_EXTERN u8 acpi_gbl_cm_single_step;
268 269
269ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root; 270ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root;
270 271
272
271/***************************************************************************** 273/*****************************************************************************
272 * 274 *
273 * Hardware globals 275 * Hardware globals
@@ -298,7 +300,6 @@ ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock;
298 * 300 *
299 ****************************************************************************/ 301 ****************************************************************************/
300 302
301
302ACPI_EXTERN u8 acpi_gbl_db_output_flags; 303ACPI_EXTERN u8 acpi_gbl_db_output_flags;
303 304
304#ifdef ACPI_DISASSEMBLER 305#ifdef ACPI_DISASSEMBLER
@@ -353,5 +354,4 @@ ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects;
353 354
354#endif /* ACPI_DEBUGGER */ 355#endif /* ACPI_DEBUGGER */
355 356
356
357#endif /* __ACGLOBAL_H__ */ 357#endif /* __ACGLOBAL_H__ */
diff --git a/include/acpi/achware.h b/include/acpi/achware.h
index 28ad1398c159..9d63641b8e7d 100644
--- a/include/acpi/achware.h
+++ b/include/acpi/achware.h
@@ -46,22 +46,26 @@
46 46
47 47
48/* PM Timer ticks per second (HZ) */ 48/* PM Timer ticks per second (HZ) */
49
49#define PM_TIMER_FREQUENCY 3579545 50#define PM_TIMER_FREQUENCY 3579545
50 51
52/* Values for the _SST reserved method */
51 53
52/* Prototypes */ 54#define ACPI_SST_INDICATOR_OFF 0
55#define ACPI_SST_WORKING 1
56#define ACPI_SST_WAKING 2
57#define ACPI_SST_SLEEPING 3
58#define ACPI_SST_SLEEP_CONTEXT 4
53 59
54 60
55acpi_status 61/* Prototypes */
56acpi_hw_initialize (
57 void);
58 62
59acpi_status
60acpi_hw_shutdown (
61 void);
62 63
64/*
65 * hwacpi - high level functions
66 */
63acpi_status 67acpi_status
64acpi_hw_initialize_system_info ( 68acpi_hw_initialize (
65 void); 69 void);
66 70
67acpi_status 71acpi_status
@@ -72,12 +76,10 @@ u32
72acpi_hw_get_mode ( 76acpi_hw_get_mode (
73 void); 77 void);
74 78
75u32
76acpi_hw_get_mode_capabilities (
77 void);
78
79/* Register I/O Prototypes */
80 79
80/*
81 * hwregs - ACPI Register I/O
82 */
81struct acpi_bit_register_info * 83struct acpi_bit_register_info *
82acpi_hw_get_bit_register_info ( 84acpi_hw_get_bit_register_info (
83 u32 register_id); 85 u32 register_id);
@@ -111,8 +113,9 @@ acpi_hw_clear_acpi_status (
111 u32 flags); 113 u32 flags);
112 114
113 115
114/* GPE support */ 116/*
115 117 * hwgpe - GPE support
118 */
116acpi_status 119acpi_status
117acpi_hw_write_gpe_enable_reg ( 120acpi_hw_write_gpe_enable_reg (
118 struct acpi_gpe_event_info *gpe_event_info); 121 struct acpi_gpe_event_info *gpe_event_info);
@@ -131,12 +134,12 @@ acpi_hw_clear_gpe_block (
131 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 134 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
132 struct acpi_gpe_block_info *gpe_block); 135 struct acpi_gpe_block_info *gpe_block);
133 136
134#ifdef ACPI_FUTURE_USAGE 137#ifdef ACPI_FUTURE_USAGE
135acpi_status 138acpi_status
136acpi_hw_get_gpe_status ( 139acpi_hw_get_gpe_status (
137 struct acpi_gpe_event_info *gpe_event_info, 140 struct acpi_gpe_event_info *gpe_event_info,
138 acpi_event_status *event_status); 141 acpi_event_status *event_status);
139#endif 142#endif /* ACPI_FUTURE_USAGE */
140 143
141acpi_status 144acpi_status
142acpi_hw_disable_all_gpes ( 145acpi_hw_disable_all_gpes (
@@ -155,15 +158,11 @@ acpi_hw_enable_runtime_gpe_block (
155 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 158 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
156 struct acpi_gpe_block_info *gpe_block); 159 struct acpi_gpe_block_info *gpe_block);
157 160
158acpi_status
159acpi_hw_enable_wakeup_gpe_block (
160 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
161 struct acpi_gpe_block_info *gpe_block);
162
163
164/* ACPI Timer prototypes */
165 161
166#ifdef ACPI_FUTURE_USAGE 162#ifdef ACPI_FUTURE_USAGE
163/*
164 * hwtimer - ACPI Timer prototypes
165 */
167acpi_status 166acpi_status
168acpi_get_timer_resolution ( 167acpi_get_timer_resolution (
169 u32 *resolution); 168 u32 *resolution);
@@ -177,6 +176,7 @@ acpi_get_timer_duration (
177 u32 start_ticks, 176 u32 start_ticks,
178 u32 end_ticks, 177 u32 end_ticks,
179 u32 *time_elapsed); 178 u32 *time_elapsed);
180#endif /* ACPI_FUTURE_USAGE */ 179#endif /* ACPI_FUTURE_USAGE */
180
181 181
182#endif /* __ACHWARE_H__ */ 182#endif /* __ACHWARE_H__ */
diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h
index c5301f5ffaf4..5c7172477a0f 100644
--- a/include/acpi/acinterp.h
+++ b/include/acpi/acinterp.h
@@ -48,37 +48,9 @@
48#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) 48#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1]))
49 49
50 50
51acpi_status
52acpi_ex_resolve_operands (
53 u16 opcode,
54 union acpi_operand_object **stack_ptr,
55 struct acpi_walk_state *walk_state);
56
57acpi_status
58acpi_ex_check_object_type (
59 acpi_object_type type_needed,
60 acpi_object_type this_type,
61 void *object);
62
63/*
64 * exxface - External interpreter interfaces
65 */
66
67acpi_status
68acpi_ex_load_table (
69 acpi_table_type table_id);
70
71acpi_status
72acpi_ex_execute_method (
73 struct acpi_namespace_node *method_node,
74 union acpi_operand_object **params,
75 union acpi_operand_object **return_obj_desc);
76
77
78/* 51/*
79 * exconvrt - object conversion 52 * exconvrt - object conversion
80 */ 53 */
81
82acpi_status 54acpi_status
83acpi_ex_convert_to_integer ( 55acpi_ex_convert_to_integer (
84 union acpi_operand_object *obj_desc, 56 union acpi_operand_object *obj_desc,
@@ -110,17 +82,10 @@ acpi_ex_convert_to_target_type (
110 union acpi_operand_object **result_desc, 82 union acpi_operand_object **result_desc,
111 struct acpi_walk_state *walk_state); 83 struct acpi_walk_state *walk_state);
112 84
113u32
114acpi_ex_convert_to_ascii (
115 acpi_integer integer,
116 u16 base,
117 u8 *string,
118 u8 max_length);
119 85
120/* 86/*
121 * exfield - ACPI AML (p-code) execution - field manipulation 87 * exfield - ACPI AML (p-code) execution - field manipulation
122 */ 88 */
123
124acpi_status 89acpi_status
125acpi_ex_common_buffer_setup ( 90acpi_ex_common_buffer_setup (
126 union acpi_operand_object *obj_desc, 91 union acpi_operand_object *obj_desc,
@@ -128,42 +93,6 @@ acpi_ex_common_buffer_setup (
128 u32 *datum_count); 93 u32 *datum_count);
129 94
130acpi_status 95acpi_status
131acpi_ex_extract_from_field (
132 union acpi_operand_object *obj_desc,
133 void *buffer,
134 u32 buffer_length);
135
136acpi_status
137acpi_ex_insert_into_field (
138 union acpi_operand_object *obj_desc,
139 void *buffer,
140 u32 buffer_length);
141
142acpi_status
143acpi_ex_setup_region (
144 union acpi_operand_object *obj_desc,
145 u32 field_datum_byte_offset);
146
147acpi_status
148acpi_ex_access_region (
149 union acpi_operand_object *obj_desc,
150 u32 field_datum_byte_offset,
151 acpi_integer *value,
152 u32 read_write);
153
154u8
155acpi_ex_register_overflow (
156 union acpi_operand_object *obj_desc,
157 acpi_integer value);
158
159acpi_status
160acpi_ex_field_datum_io (
161 union acpi_operand_object *obj_desc,
162 u32 field_datum_byte_offset,
163 acpi_integer *value,
164 u32 read_write);
165
166acpi_status
167acpi_ex_write_with_update_rule ( 96acpi_ex_write_with_update_rule (
168 union acpi_operand_object *obj_desc, 97 union acpi_operand_object *obj_desc,
169 acpi_integer mask, 98 acpi_integer mask,
@@ -198,28 +127,33 @@ acpi_ex_write_data_to_field (
198 union acpi_operand_object *obj_desc, 127 union acpi_operand_object *obj_desc,
199 union acpi_operand_object **result_desc); 128 union acpi_operand_object **result_desc);
200 129
130
201/* 131/*
202 * exmisc - ACPI AML (p-code) execution - specific opcodes 132 * exfldio - low level field I/O
203 */ 133 */
204
205acpi_status 134acpi_status
206acpi_ex_opcode_3A_0T_0R ( 135acpi_ex_extract_from_field (
207 struct acpi_walk_state *walk_state); 136 union acpi_operand_object *obj_desc,
137 void *buffer,
138 u32 buffer_length);
208 139
209acpi_status 140acpi_status
210acpi_ex_opcode_3A_1T_1R ( 141acpi_ex_insert_into_field (
211 struct acpi_walk_state *walk_state); 142 union acpi_operand_object *obj_desc,
143 void *buffer,
144 u32 buffer_length);
212 145
213acpi_status 146acpi_status
214acpi_ex_opcode_6A_0T_1R ( 147acpi_ex_access_region (
215 struct acpi_walk_state *walk_state); 148 union acpi_operand_object *obj_desc,
149 u32 field_datum_byte_offset,
150 acpi_integer *value,
151 u32 read_write);
216 152
217u8
218acpi_ex_do_match (
219 u32 match_op,
220 union acpi_operand_object *package_obj,
221 union acpi_operand_object *match_obj);
222 153
154/*
155 * exmisc - misc support routines
156 */
223acpi_status 157acpi_status
224acpi_ex_get_object_reference ( 158acpi_ex_get_object_reference (
225 union acpi_operand_object *obj_desc, 159 union acpi_operand_object *obj_desc,
@@ -227,13 +161,6 @@ acpi_ex_get_object_reference (
227 struct acpi_walk_state *walk_state); 161 struct acpi_walk_state *walk_state);
228 162
229acpi_status 163acpi_status
230acpi_ex_resolve_multiple (
231 struct acpi_walk_state *walk_state,
232 union acpi_operand_object *operand,
233 acpi_object_type *return_type,
234 union acpi_operand_object **return_desc);
235
236acpi_status
237acpi_ex_concat_template ( 164acpi_ex_concat_template (
238 union acpi_operand_object *obj_desc, 165 union acpi_operand_object *obj_desc,
239 union acpi_operand_object *obj_desc2, 166 union acpi_operand_object *obj_desc2,
@@ -308,13 +235,6 @@ acpi_ex_create_method (
308/* 235/*
309 * exconfig - dynamic table load/unload 236 * exconfig - dynamic table load/unload
310 */ 237 */
311
312acpi_status
313acpi_ex_add_table (
314 struct acpi_table_header *table,
315 struct acpi_namespace_node *parent_node,
316 union acpi_operand_object **ddb_handle);
317
318acpi_status 238acpi_status
319acpi_ex_load_op ( 239acpi_ex_load_op (
320 union acpi_operand_object *obj_desc, 240 union acpi_operand_object *obj_desc,
@@ -334,7 +254,6 @@ acpi_ex_unload_table (
334/* 254/*
335 * exmutex - mutex support 255 * exmutex - mutex support
336 */ 256 */
337
338acpi_status 257acpi_status
339acpi_ex_acquire_mutex ( 258acpi_ex_acquire_mutex (
340 union acpi_operand_object *time_desc, 259 union acpi_operand_object *time_desc,
@@ -354,15 +273,10 @@ void
354acpi_ex_unlink_mutex ( 273acpi_ex_unlink_mutex (
355 union acpi_operand_object *obj_desc); 274 union acpi_operand_object *obj_desc);
356 275
357void
358acpi_ex_link_mutex (
359 union acpi_operand_object *obj_desc,
360 struct acpi_thread_state *thread);
361 276
362/* 277/*
363 * exprep - ACPI AML (p-code) execution - prep utilities 278 * exprep - ACPI AML execution - prep utilities
364 */ 279 */
365
366acpi_status 280acpi_status
367acpi_ex_prep_common_field_object ( 281acpi_ex_prep_common_field_object (
368 union acpi_operand_object *obj_desc, 282 union acpi_operand_object *obj_desc,
@@ -375,10 +289,10 @@ acpi_status
375acpi_ex_prep_field_value ( 289acpi_ex_prep_field_value (
376 struct acpi_create_field_info *info); 290 struct acpi_create_field_info *info);
377 291
292
378/* 293/*
379 * exsystem - Interface to OS services 294 * exsystem - Interface to OS services
380 */ 295 */
381
382acpi_status 296acpi_status
383acpi_ex_system_do_notify_op ( 297acpi_ex_system_do_notify_op (
384 union acpi_operand_object *value, 298 union acpi_operand_object *value,
@@ -421,9 +335,8 @@ acpi_ex_system_wait_semaphore (
421 335
422 336
423/* 337/*
424 * exmonadic - ACPI AML (p-code) execution, monadic operators 338 * exoparg1 - ACPI AML execution, 1 operand
425 */ 339 */
426
427acpi_status 340acpi_status
428acpi_ex_opcode_0A_0T_1R ( 341acpi_ex_opcode_0A_0T_1R (
429 struct acpi_walk_state *walk_state); 342 struct acpi_walk_state *walk_state);
@@ -445,9 +358,8 @@ acpi_ex_opcode_1A_1T_0R (
445 struct acpi_walk_state *walk_state); 358 struct acpi_walk_state *walk_state);
446 359
447/* 360/*
448 * exdyadic - ACPI AML (p-code) execution, dyadic operators 361 * exoparg2 - ACPI AML execution, 2 operands
449 */ 362 */
450
451acpi_status 363acpi_status
452acpi_ex_opcode_2A_0T_0R ( 364acpi_ex_opcode_2A_0T_0R (
453 struct acpi_walk_state *walk_state); 365 struct acpi_walk_state *walk_state);
@@ -466,21 +378,56 @@ acpi_ex_opcode_2A_2T_1R (
466 378
467 379
468/* 380/*
469 * exresolv - Object resolution and get value functions 381 * exoparg3 - ACPI AML execution, 3 operands
382 */
383acpi_status
384acpi_ex_opcode_3A_0T_0R (
385 struct acpi_walk_state *walk_state);
386
387acpi_status
388acpi_ex_opcode_3A_1T_1R (
389 struct acpi_walk_state *walk_state);
390
391
392/*
393 * exoparg6 - ACPI AML execution, 6 operands
470 */ 394 */
395acpi_status
396acpi_ex_opcode_6A_0T_1R (
397 struct acpi_walk_state *walk_state);
398
471 399
400/*
401 * exresolv - Object resolution and get value functions
402 */
472acpi_status 403acpi_status
473acpi_ex_resolve_to_value ( 404acpi_ex_resolve_to_value (
474 union acpi_operand_object **stack_ptr, 405 union acpi_operand_object **stack_ptr,
475 struct acpi_walk_state *walk_state); 406 struct acpi_walk_state *walk_state);
476 407
477acpi_status 408acpi_status
409acpi_ex_resolve_multiple (
410 struct acpi_walk_state *walk_state,
411 union acpi_operand_object *operand,
412 acpi_object_type *return_type,
413 union acpi_operand_object **return_desc);
414
415
416/*
417 * exresnte - resolve namespace node
418 */
419acpi_status
478acpi_ex_resolve_node_to_value ( 420acpi_ex_resolve_node_to_value (
479 struct acpi_namespace_node **stack_ptr, 421 struct acpi_namespace_node **stack_ptr,
480 struct acpi_walk_state *walk_state); 422 struct acpi_walk_state *walk_state);
481 423
424
425/*
426 * exresop - resolve operand to value
427 */
482acpi_status 428acpi_status
483acpi_ex_resolve_object_to_value ( 429acpi_ex_resolve_operands (
430 u16 opcode,
484 union acpi_operand_object **stack_ptr, 431 union acpi_operand_object **stack_ptr,
485 struct acpi_walk_state *walk_state); 432 struct acpi_walk_state *walk_state);
486 433
@@ -488,7 +435,6 @@ acpi_ex_resolve_object_to_value (
488/* 435/*
489 * exdump - Interpreter debug output routines 436 * exdump - Interpreter debug output routines
490 */ 437 */
491
492void 438void
493acpi_ex_dump_operand ( 439acpi_ex_dump_operand (
494 union acpi_operand_object *obj_desc, 440 union acpi_operand_object *obj_desc,
@@ -504,7 +450,7 @@ acpi_ex_dump_operands (
504 char *module_name, 450 char *module_name,
505 u32 line_number); 451 u32 line_number);
506 452
507#ifdef ACPI_FUTURE_USAGE 453#ifdef ACPI_FUTURE_USAGE
508void 454void
509acpi_ex_dump_object_descriptor ( 455acpi_ex_dump_object_descriptor (
510 union acpi_operand_object *object, 456 union acpi_operand_object *object,
@@ -514,46 +460,12 @@ void
514acpi_ex_dump_node ( 460acpi_ex_dump_node (
515 struct acpi_namespace_node *node, 461 struct acpi_namespace_node *node,
516 u32 flags); 462 u32 flags);
463#endif /* ACPI_FUTURE_USAGE */
517 464
518void
519acpi_ex_out_string (
520 char *title,
521 char *value);
522
523void
524acpi_ex_out_pointer (
525 char *title,
526 void *value);
527
528void
529acpi_ex_out_integer (
530 char *title,
531 u32 value);
532
533void
534acpi_ex_out_address (
535 char *title,
536 acpi_physical_address value);
537#endif /* ACPI_FUTURE_USAGE */
538 465
539/* 466/*
540 * exnames - interpreter/scanner name load/execute 467 * exnames - AML namestring support
541 */ 468 */
542
543char *
544acpi_ex_allocate_name_string (
545 u32 prefix_count,
546 u32 num_name_segs);
547
548u32
549acpi_ex_good_char (
550 u32 character);
551
552acpi_status
553acpi_ex_name_segment (
554 u8 **in_aml_address,
555 char *name_string);
556
557acpi_status 469acpi_status
558acpi_ex_get_name_string ( 470acpi_ex_get_name_string (
559 acpi_object_type data_type, 471 acpi_object_type data_type,
@@ -561,16 +473,10 @@ acpi_ex_get_name_string (
561 char **out_name_string, 473 char **out_name_string,
562 u32 *out_name_length); 474 u32 *out_name_length);
563 475
564acpi_status
565acpi_ex_do_name (
566 acpi_object_type data_type,
567 acpi_interpreter_mode load_exec_mode);
568
569 476
570/* 477/*
571 * exstore - Object store support 478 * exstore - Object store support
572 */ 479 */
573
574acpi_status 480acpi_status
575acpi_ex_store ( 481acpi_ex_store (
576 union acpi_operand_object *val_desc, 482 union acpi_operand_object *val_desc,
@@ -578,12 +484,6 @@ acpi_ex_store (
578 struct acpi_walk_state *walk_state); 484 struct acpi_walk_state *walk_state);
579 485
580acpi_status 486acpi_status
581acpi_ex_store_object_to_index (
582 union acpi_operand_object *val_desc,
583 union acpi_operand_object *dest_desc,
584 struct acpi_walk_state *walk_state);
585
586acpi_status
587acpi_ex_store_object_to_node ( 487acpi_ex_store_object_to_node (
588 union acpi_operand_object *source_desc, 488 union acpi_operand_object *source_desc,
589 struct acpi_namespace_node *node, 489 struct acpi_namespace_node *node,
@@ -593,10 +493,10 @@ acpi_ex_store_object_to_node (
593#define ACPI_IMPLICIT_CONVERSION TRUE 493#define ACPI_IMPLICIT_CONVERSION TRUE
594#define ACPI_NO_IMPLICIT_CONVERSION FALSE 494#define ACPI_NO_IMPLICIT_CONVERSION FALSE
595 495
496
596/* 497/*
597 * exstoren 498 * exstoren - resolve/store object
598 */ 499 */
599
600acpi_status 500acpi_status
601acpi_ex_resolve_object ( 501acpi_ex_resolve_object (
602 union acpi_operand_object **source_desc_ptr, 502 union acpi_operand_object **source_desc_ptr,
@@ -612,9 +512,8 @@ acpi_ex_store_object_to_object (
612 512
613 513
614/* 514/*
615 * excopy - object copy 515 * exstorob - store object - buffer/string
616 */ 516 */
617
618acpi_status 517acpi_status
619acpi_ex_store_buffer_to_buffer ( 518acpi_ex_store_buffer_to_buffer (
620 union acpi_operand_object *source_desc, 519 union acpi_operand_object *source_desc,
@@ -625,6 +524,10 @@ acpi_ex_store_string_to_string (
625 union acpi_operand_object *source_desc, 524 union acpi_operand_object *source_desc,
626 union acpi_operand_object *target_desc); 525 union acpi_operand_object *target_desc);
627 526
527
528/*
529 * excopy - object copy
530 */
628acpi_status 531acpi_status
629acpi_ex_copy_integer_to_index_field ( 532acpi_ex_copy_integer_to_index_field (
630 union acpi_operand_object *source_desc, 533 union acpi_operand_object *source_desc,
@@ -645,10 +548,10 @@ acpi_ex_copy_integer_to_buffer_field (
645 union acpi_operand_object *source_desc, 548 union acpi_operand_object *source_desc,
646 union acpi_operand_object *target_desc); 549 union acpi_operand_object *target_desc);
647 550
551
648/* 552/*
649 * exutils - interpreter/scanner utilities 553 * exutils - interpreter/scanner utilities
650 */ 554 */
651
652acpi_status 555acpi_status
653acpi_ex_enter_interpreter ( 556acpi_ex_enter_interpreter (
654 void); 557 void);
@@ -669,11 +572,6 @@ void
669acpi_ex_release_global_lock ( 572acpi_ex_release_global_lock (
670 u8 locked); 573 u8 locked);
671 574
672u32
673acpi_ex_digits_needed (
674 acpi_integer value,
675 u32 base);
676
677void 575void
678acpi_ex_eisa_id_to_string ( 576acpi_ex_eisa_id_to_string (
679 u32 numeric_id, 577 u32 numeric_id,
@@ -688,7 +586,6 @@ acpi_ex_unsigned_integer_to_string (
688/* 586/*
689 * exregion - default op_region handlers 587 * exregion - default op_region handlers
690 */ 588 */
691
692acpi_status 589acpi_status
693acpi_ex_system_memory_space_handler ( 590acpi_ex_system_memory_space_handler (
694 u32 function, 591 u32 function,
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
index 01d3b4bc0c85..030e641115cb 100644
--- a/include/acpi/aclocal.h
+++ b/include/acpi/aclocal.h
@@ -72,7 +72,6 @@ typedef u32 acpi_mutex_handle;
72 * 72 *
73 * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also! 73 * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also!
74 */ 74 */
75
76#define ACPI_MTX_EXECUTE 0 75#define ACPI_MTX_EXECUTE 0
77#define ACPI_MTX_INTERPRETER 1 76#define ACPI_MTX_INTERPRETER 1
78#define ACPI_MTX_PARSER 2 77#define ACPI_MTX_PARSER 2
@@ -151,13 +150,13 @@ typedef u16 acpi_owner_id;
151#define ACPI_FIELD_DWORD_GRANULARITY 4 150#define ACPI_FIELD_DWORD_GRANULARITY 4
152#define ACPI_FIELD_QWORD_GRANULARITY 8 151#define ACPI_FIELD_QWORD_GRANULARITY 8
153 152
153
154/***************************************************************************** 154/*****************************************************************************
155 * 155 *
156 * Namespace typedefs and structs 156 * Namespace typedefs and structs
157 * 157 *
158 ****************************************************************************/ 158 ****************************************************************************/
159 159
160
161/* Operational modes of the AML interpreter/scanner */ 160/* Operational modes of the AML interpreter/scanner */
162 161
163typedef enum 162typedef enum
@@ -176,7 +175,6 @@ typedef enum
176 * data_type is used to differentiate between internal descriptors, and MUST 175 * data_type is used to differentiate between internal descriptors, and MUST
177 * be the first byte in this structure. 176 * be the first byte in this structure.
178 */ 177 */
179
180union acpi_name_union 178union acpi_name_union
181{ 179{
182 u32 integer; 180 u32 integer;
@@ -415,7 +413,6 @@ struct acpi_field_info
415 * 413 *
416 ****************************************************************************/ 414 ****************************************************************************/
417 415
418
419#define ACPI_CONTROL_NORMAL 0xC0 416#define ACPI_CONTROL_NORMAL 0xC0
420#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1 417#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
421#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2 418#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
@@ -424,6 +421,7 @@ struct acpi_field_info
424 421
425 422
426/* Forward declarations */ 423/* Forward declarations */
424
427struct acpi_walk_state ; 425struct acpi_walk_state ;
428struct acpi_obj_mutex; 426struct acpi_obj_mutex;
429union acpi_parse_object ; 427union acpi_parse_object ;
@@ -601,7 +599,6 @@ struct acpi_opcode_info
601 u8 type; /* Opcode type */ 599 u8 type; /* Opcode type */
602}; 600};
603 601
604
605union acpi_parse_value 602union acpi_parse_value
606{ 603{
607 acpi_integer integer; /* Integer constant (Up to 64 bits) */ 604 acpi_integer integer; /* Integer constant (Up to 64 bits) */
@@ -613,7 +610,6 @@ union acpi_parse_value
613 union acpi_parse_object *arg; /* arguments and contained ops */ 610 union acpi_parse_object *arg; /* arguments and contained ops */
614}; 611};
615 612
616
617#define ACPI_PARSE_COMMON \ 613#define ACPI_PARSE_COMMON \
618 u8 data_type; /* To differentiate various internal objs */\ 614 u8 data_type; /* To differentiate various internal objs */\
619 u8 flags; /* Type of Op */\ 615 u8 flags; /* Type of Op */\
@@ -691,7 +687,6 @@ struct acpi_parse_obj_asl
691 char parse_op_name[12]; 687 char parse_op_name[12];
692}; 688};
693 689
694
695union acpi_parse_object 690union acpi_parse_object
696{ 691{
697 struct acpi_parse_obj_common common; 692 struct acpi_parse_obj_common common;
@@ -834,7 +829,6 @@ struct acpi_bit_register_info
834 * 829 *
835 ****************************************************************************/ 830 ****************************************************************************/
836 831
837
838/* resource_type values */ 832/* resource_type values */
839 833
840#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0 834#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index fcaced16b16f..09be937d2c39 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -539,11 +539,6 @@
539 539
540 540
541#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) 541#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b)
542
543#ifdef ACPI_FUTURE_USAGE
544#define ACPI_DUMP_TABLES(a,b) acpi_ns_dump_tables(a,b)
545#endif
546
547#define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) 542#define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d)
548#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) 543#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a)
549#define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) 544#define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
@@ -596,11 +591,6 @@
596#define ACPI_DUMP_STACK_ENTRY(a) 591#define ACPI_DUMP_STACK_ENTRY(a)
597#define ACPI_DUMP_OPERANDS(a,b,c,d,e) 592#define ACPI_DUMP_OPERANDS(a,b,c,d,e)
598#define ACPI_DUMP_ENTRY(a,b) 593#define ACPI_DUMP_ENTRY(a,b)
599
600#ifdef ACPI_FUTURE_USAGE
601#define ACPI_DUMP_TABLES(a,b)
602#endif
603
604#define ACPI_DUMP_PATHNAME(a,b,c,d) 594#define ACPI_DUMP_PATHNAME(a,b,c,d)
605#define ACPI_DUMP_RESOURCE_LIST(a) 595#define ACPI_DUMP_RESOURCE_LIST(a)
606#define ACPI_DUMP_BUFFER(a,b) 596#define ACPI_DUMP_BUFFER(a,b)
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
new file mode 100644
index 000000000000..deb7cb06f5f0
--- /dev/null
+++ b/include/acpi/acnames.h
@@ -0,0 +1,84 @@
1/******************************************************************************
2 *
3 * Name: acnames.h - Global names and strings
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACNAMES_H__
45#define __ACNAMES_H__
46
47/* Method names - these methods can appear anywhere in the namespace */
48
49#define METHOD_NAME__HID "_HID"
50#define METHOD_NAME__CID "_CID"
51#define METHOD_NAME__UID "_UID"
52#define METHOD_NAME__ADR "_ADR"
53#define METHOD_NAME__INI "_INI"
54#define METHOD_NAME__STA "_STA"
55#define METHOD_NAME__REG "_REG"
56#define METHOD_NAME__SEG "_SEG"
57#define METHOD_NAME__BBN "_BBN"
58#define METHOD_NAME__PRT "_PRT"
59#define METHOD_NAME__CRS "_CRS"
60#define METHOD_NAME__PRS "_PRS"
61#define METHOD_NAME__PRW "_PRW"
62#define METHOD_NAME__SRS "_SRS"
63
64/* Method names - these methods must appear at the namespace root */
65
66#define METHOD_NAME__BFS "\\_BFS"
67#define METHOD_NAME__GTS "\\_GTS"
68#define METHOD_NAME__PTS "\\_PTS"
69#define METHOD_NAME__SST "\\_SI._SST"
70#define METHOD_NAME__WAK "\\_WAK"
71
72/* Definitions of the predefined namespace names */
73
74#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */
75#define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */
76#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */
77
78#define ACPI_NS_ROOT_PATH "\\"
79#define ACPI_NS_SYSTEM_BUS "_SB_"
80
81
82#endif /* __ACNAMES_H__ */
83
84
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h
index 8b3cdc3566b1..d1b3ce80056f 100644
--- a/include/acpi/acnamesp.h
+++ b/include/acpi/acnamesp.h
@@ -57,17 +57,6 @@
57#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */ 57#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */
58#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */ 58#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */
59 59
60
61/* Definitions of the predefined namespace names */
62
63#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */
64#define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */
65#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */
66
67#define ACPI_NS_ROOT_PATH "\\"
68#define ACPI_NS_SYSTEM_BUS "_SB_"
69
70
71/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */ 60/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
72 61
73#define ACPI_NS_NO_UPSEARCH 0 62#define ACPI_NS_NO_UPSEARCH 0
@@ -80,10 +69,9 @@
80#define ACPI_NS_WALK_NO_UNLOCK FALSE 69#define ACPI_NS_WALK_NO_UNLOCK FALSE
81 70
82 71
83acpi_status 72/*
84acpi_ns_load_namespace ( 73 * nsinit - Namespace initialization
85 void); 74 */
86
87acpi_status 75acpi_status
88acpi_ns_initialize_objects ( 76acpi_ns_initialize_objects (
89 void); 77 void);
@@ -93,23 +81,22 @@ acpi_ns_initialize_devices (
93 void); 81 void);
94 82
95 83
96/* Namespace init - nsxfinit */ 84/*
97 85 * nsload - Namespace loading
86 */
98acpi_status 87acpi_status
99acpi_ns_init_one_device ( 88acpi_ns_load_namespace (
100 acpi_handle obj_handle, 89 void);
101 u32 nesting_level,
102 void *context,
103 void **return_value);
104 90
105acpi_status 91acpi_status
106acpi_ns_init_one_object ( 92acpi_ns_load_table (
107 acpi_handle obj_handle, 93 struct acpi_table_desc *table_desc,
108 u32 level, 94 struct acpi_namespace_node *node);
109 void *context,
110 void **return_value);
111 95
112 96
97/*
98 * nswalk - walk the namespace
99 */
113acpi_status 100acpi_status
114acpi_ns_walk_namespace ( 101acpi_ns_walk_namespace (
115 acpi_object_type type, 102 acpi_object_type type,
@@ -126,37 +113,24 @@ acpi_ns_get_next_node (
126 struct acpi_namespace_node *parent, 113 struct acpi_namespace_node *parent,
127 struct acpi_namespace_node *child); 114 struct acpi_namespace_node *child);
128 115
129void
130acpi_ns_delete_namespace_by_owner (
131 u16 table_id);
132
133
134/* Namespace loading - nsload */
135
136acpi_status
137acpi_ns_one_complete_parse (
138 u32 pass_number,
139 struct acpi_table_desc *table_desc);
140 116
117/*
118 * nsparse - table parsing
119 */
141acpi_status 120acpi_status
142acpi_ns_parse_table ( 121acpi_ns_parse_table (
143 struct acpi_table_desc *table_desc, 122 struct acpi_table_desc *table_desc,
144 struct acpi_namespace_node *scope); 123 struct acpi_namespace_node *scope);
145 124
146acpi_status 125acpi_status
147acpi_ns_load_table ( 126acpi_ns_one_complete_parse (
148 struct acpi_table_desc *table_desc, 127 u32 pass_number,
149 struct acpi_namespace_node *node); 128 struct acpi_table_desc *table_desc);
150
151acpi_status
152acpi_ns_load_table_by_type (
153 acpi_table_type table_type);
154 129
155 130
156/* 131/*
157 * Top-level namespace access - nsaccess 132 * nsaccess - Top-level namespace access
158 */ 133 */
159
160acpi_status 134acpi_status
161acpi_ns_root_initialize ( 135acpi_ns_root_initialize (
162 void); 136 void);
@@ -173,9 +147,8 @@ acpi_ns_lookup (
173 147
174 148
175/* 149/*
176 * Named object allocation/deallocation - nsalloc 150 * nsalloc - Named object allocation/deallocation
177 */ 151 */
178
179struct acpi_namespace_node * 152struct acpi_namespace_node *
180acpi_ns_create_node ( 153acpi_ns_create_node (
181 u32 name); 154 u32 name);
@@ -189,6 +162,10 @@ acpi_ns_delete_namespace_subtree (
189 struct acpi_namespace_node *parent_handle); 162 struct acpi_namespace_node *parent_handle);
190 163
191void 164void
165acpi_ns_delete_namespace_by_owner (
166 u16 table_id);
167
168void
192acpi_ns_detach_object ( 169acpi_ns_detach_object (
193 struct acpi_namespace_node *node); 170 struct acpi_namespace_node *node);
194 171
@@ -201,36 +178,16 @@ acpi_ns_compare_names (
201 char *name1, 178 char *name1,
202 char *name2); 179 char *name2);
203 180
204void
205acpi_ns_remove_reference (
206 struct acpi_namespace_node *node);
207
208 181
209/* 182/*
210 * Namespace modification - nsmodify 183 * nsdump - Namespace dump/print utilities
211 */ 184 */
212 185#ifdef ACPI_FUTURE_USAGE
213#ifdef ACPI_FUTURE_USAGE
214acpi_status
215acpi_ns_unload_namespace (
216 acpi_handle handle);
217
218acpi_status
219acpi_ns_delete_subtree (
220 acpi_handle start_handle);
221#endif
222
223
224/*
225 * Namespace dump/print utilities - nsdump
226 */
227
228#ifdef ACPI_FUTURE_USAGE
229void 186void
230acpi_ns_dump_tables ( 187acpi_ns_dump_tables (
231 acpi_handle search_base, 188 acpi_handle search_base,
232 u32 max_depth); 189 u32 max_depth);
233#endif 190#endif /* ACPI_FUTURE_USAGE */
234 191
235void 192void
236acpi_ns_dump_entry ( 193acpi_ns_dump_entry (
@@ -249,19 +206,6 @@ acpi_ns_print_pathname (
249 u32 num_segments, 206 u32 num_segments,
250 char *pathname); 207 char *pathname);
251 208
252#ifdef ACPI_FUTURE_USAGE
253acpi_status
254acpi_ns_dump_one_device (
255 acpi_handle obj_handle,
256 u32 level,
257 void *context,
258 void **return_value);
259
260void
261acpi_ns_dump_root_devices (
262 void);
263#endif /* ACPI_FUTURE_USAGE */
264
265acpi_status 209acpi_status
266acpi_ns_dump_one_object ( 210acpi_ns_dump_one_object (
267 acpi_handle obj_handle, 211 acpi_handle obj_handle,
@@ -269,7 +213,7 @@ acpi_ns_dump_one_object (
269 void *context, 213 void *context,
270 void **return_value); 214 void **return_value);
271 215
272#ifdef ACPI_FUTURE_USAGE 216#ifdef ACPI_FUTURE_USAGE
273void 217void
274acpi_ns_dump_objects ( 218acpi_ns_dump_objects (
275 acpi_object_type type, 219 acpi_object_type type,
@@ -277,13 +221,12 @@ acpi_ns_dump_objects (
277 u32 max_depth, 221 u32 max_depth,
278 u32 ownder_id, 222 u32 ownder_id,
279 acpi_handle start_handle); 223 acpi_handle start_handle);
280#endif 224#endif /* ACPI_FUTURE_USAGE */
281 225
282 226
283/* 227/*
284 * Namespace evaluation functions - nseval 228 * nseval - Namespace evaluation functions
285 */ 229 */
286
287acpi_status 230acpi_status
288acpi_ns_evaluate_by_handle ( 231acpi_ns_evaluate_by_handle (
289 struct acpi_parameter_info *info); 232 struct acpi_parameter_info *info);
@@ -298,40 +241,14 @@ acpi_ns_evaluate_relative (
298 char *pathname, 241 char *pathname,
299 struct acpi_parameter_info *info); 242 struct acpi_parameter_info *info);
300 243
301acpi_status
302acpi_ns_execute_control_method (
303 struct acpi_parameter_info *info);
304
305acpi_status
306acpi_ns_get_object_value (
307 struct acpi_parameter_info *info);
308
309
310/*
311 * Parent/Child/Peer utility functions
312 */
313
314#ifdef ACPI_FUTURE_USAGE
315acpi_name
316acpi_ns_find_parent_name (
317 struct acpi_namespace_node *node_to_search);
318#endif
319
320 244
321/* 245/*
322 * Name and Scope manipulation - nsnames 246 * nsnames - Name and Scope manipulation
323 */ 247 */
324
325u32 248u32
326acpi_ns_opens_scope ( 249acpi_ns_opens_scope (
327 acpi_object_type type); 250 acpi_object_type type);
328 251
329void
330acpi_ns_build_external_path (
331 struct acpi_namespace_node *node,
332 acpi_size size,
333 char *name_buffer);
334
335char * 252char *
336acpi_ns_get_external_pathname ( 253acpi_ns_get_external_pathname (
337 struct acpi_namespace_node *node); 254 struct acpi_namespace_node *node);
@@ -363,9 +280,8 @@ acpi_ns_get_pathname_length (
363 280
364 281
365/* 282/*
366 * Object management for namespace nodes - nsobject 283 * nsobject - Object management for namespace nodes
367 */ 284 */
368
369acpi_status 285acpi_status
370acpi_ns_attach_object ( 286acpi_ns_attach_object (
371 struct acpi_namespace_node *node, 287 struct acpi_namespace_node *node,
@@ -399,9 +315,8 @@ acpi_ns_get_attached_data (
399 315
400 316
401/* 317/*
402 * Namespace searching and entry - nssearch 318 * nssearch - Namespace searching and entry
403 */ 319 */
404
405acpi_status 320acpi_status
406acpi_ns_search_and_enter ( 321acpi_ns_search_and_enter (
407 u32 entry_name, 322 u32 entry_name,
@@ -428,17 +343,12 @@ acpi_ns_install_node (
428 343
429 344
430/* 345/*
431 * Utility functions - nsutils 346 * nsutils - Utility functions
432 */ 347 */
433
434u8 348u8
435acpi_ns_valid_root_prefix ( 349acpi_ns_valid_root_prefix (
436 char prefix); 350 char prefix);
437 351
438u8
439acpi_ns_valid_path_separator (
440 char sep);
441
442acpi_object_type 352acpi_object_type
443acpi_ns_get_type ( 353acpi_ns_get_type (
444 struct acpi_namespace_node *node); 354 struct acpi_namespace_node *node);
@@ -511,5 +421,4 @@ struct acpi_namespace_node *
511acpi_ns_get_next_valid_node ( 421acpi_ns_get_next_valid_node (
512 struct acpi_namespace_node *node); 422 struct acpi_namespace_node *node);
513 423
514
515#endif /* __ACNAMESP_H__ */ 424#endif /* __ACNAMESP_H__ */
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h
index 036023a940b2..e079b94e4fce 100644
--- a/include/acpi/acobject.h
+++ b/include/acpi/acobject.h
@@ -133,6 +133,7 @@ struct acpi_object_integer
133 acpi_integer value; 133 acpi_integer value;
134}; 134};
135 135
136
136/* 137/*
137 * Note: The String and Buffer object must be identical through the Pointer 138 * Note: The String and Buffer object must be identical through the Pointer
138 * element. There is code that depends on this. 139 * element. There is code that depends on this.
@@ -468,7 +469,6 @@ union acpi_operand_object
468 * 469 *
469 *****************************************************************************/ 470 *****************************************************************************/
470 471
471
472/* Object descriptor types */ 472/* Object descriptor types */
473 473
474#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */ 474#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */
diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h
new file mode 100644
index 000000000000..118ecba4cf05
--- /dev/null
+++ b/include/acpi/acopcode.h
@@ -0,0 +1,325 @@
1/******************************************************************************
2 *
3 * Name: acopcode.h - AML opcode information for the AML parser and interpreter
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACOPCODE_H__
45#define __ACOPCODE_H__
46
47#define MAX_EXTENDED_OPCODE 0x88
48#define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1)
49#define MAX_INTERNAL_OPCODE
50#define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1)
51
52/* Used for non-assigned opcodes */
53
54#define _UNK 0x6B
55
56/*
57 * Reserved ASCII characters. Do not use any of these for
58 * internal opcodes, since they are used to differentiate
59 * name strings from AML opcodes
60 */
61#define _ASC 0x6C
62#define _NAM 0x6C
63#define _PFX 0x6D
64
65
66/*
67 * All AML opcodes and the parse-time arguments for each. Used by the AML
68 * parser Each list is compressed into a 32-bit number and stored in the
69 * master opcode table (in psopcode.c).
70 */
71#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
72#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA)
73#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
74#define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME)
75#define ARGP_ARG0 ARG_NONE
76#define ARGP_ARG1 ARG_NONE
77#define ARGP_ARG2 ARG_NONE
78#define ARGP_ARG3 ARG_NONE
79#define ARGP_ARG4 ARG_NONE
80#define ARGP_ARG5 ARG_NONE
81#define ARGP_ARG6 ARG_NONE
82#define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST)
83#define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
84#define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
85#define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
86#define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
87#define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
88#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
89#define ARGP_BREAK_OP ARG_NONE
90#define ARGP_BREAK_POINT_OP ARG_NONE
91#define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST)
92#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA)
93#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING)
94#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
95#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
96#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
97#define ARGP_CONTINUE_OP ARG_NONE
98#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME)
99#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
100#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
101#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
102#define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
103#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
104#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
105#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
106#define ARGP_DEBUG_OP ARG_NONE
107#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
108#define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG)
109#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
110#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET)
111#define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA)
112#define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST)
113#define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME)
114#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG)
115#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST)
116#define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
117#define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
118#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
119#define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
120#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
121#define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST)
122#define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
123#define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
124#define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
125#define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
126#define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
127#define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
128#define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
129#define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG)
130#define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
131#define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME)
132#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
133#define ARGP_LOCAL0 ARG_NONE
134#define ARGP_LOCAL1 ARG_NONE
135#define ARGP_LOCAL2 ARG_NONE
136#define ARGP_LOCAL3 ARG_NONE
137#define ARGP_LOCAL4 ARG_NONE
138#define ARGP_LOCAL5 ARG_NONE
139#define ARGP_LOCAL6 ARG_NONE
140#define ARGP_LOCAL7 ARG_NONE
141#define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
142#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
143#define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST)
144#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING)
145#define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
146#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
147#define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
148#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA)
149#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ)
150#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
151#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING)
152#define ARGP_NOOP_OP ARG_NONE
153#define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
154#define ARGP_ONE_OP ARG_NONE
155#define ARGP_ONES_OP ARG_NONE
156#define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST)
157#define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST)
158#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST)
159#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA)
160#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
161#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
162#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME)
163#define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
164#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME)
165#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
166#define ARGP_REVISION_OP ARG_NONE
167#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST)
168#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
169#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
170#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
171#define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
172#define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG)
173#define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG)
174#define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING)
175#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME)
176#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST)
177#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
178#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
179#define ARGP_TIMER_OP ARG_NONE
180#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
181#define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
182#define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
183#define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
184#define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
185#define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
186#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME)
187#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME)
188#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST)
189#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
190#define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
191#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA)
192#define ARGP_ZERO_OP ARG_NONE
193
194
195/*
196 * All AML opcodes and the runtime arguments for each. Used by the AML
197 * interpreter Each list is compressed into a 32-bit number and stored
198 * in the master opcode table (in psopcode.c).
199 *
200 * (Used by prep_operands procedure and the ASL Compiler)
201 */
202#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE
203#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER)
204#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
205#define ARGI_ALIAS_OP ARGI_INVALID_OPCODE
206#define ARGI_ARG0 ARG_NONE
207#define ARGI_ARG1 ARG_NONE
208#define ARGI_ARG2 ARG_NONE
209#define ARGI_ARG3 ARG_NONE
210#define ARGI_ARG4 ARG_NONE
211#define ARGI_ARG5 ARG_NONE
212#define ARGI_ARG6 ARG_NONE
213#define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE
214#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
215#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
216#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
217#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
218#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
219#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
220#define ARGI_BREAK_OP ARG_NONE
221#define ARGI_BREAK_POINT_OP ARG_NONE
222#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER)
223#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
224#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
225#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
226#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
227#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
228#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE
229#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET)
230#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
231#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
232#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
233#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE)
234#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
235#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
236#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
237#define ARGI_DEBUG_OP ARG_NONE
238#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
239#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING)
240#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE
241#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF)
242#define ARGI_DWORD_OP ARGI_INVALID_OPCODE
243#define ARGI_ELSE_OP ARGI_INVALID_OPCODE
244#define ARGI_EVENT_OP ARGI_INVALID_OPCODE
245#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
246#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
247#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
248#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
249#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
250#define ARGI_IF_OP ARGI_INVALID_OPCODE
251#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
252#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
253#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF)
254#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
255#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
256#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
257#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE
258#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
259#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE
260#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
261#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
262#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_FIELD,ARGI_TARGETREF)
263#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)
264#define ARGI_LOCAL0 ARG_NONE
265#define ARGI_LOCAL1 ARG_NONE
266#define ARGI_LOCAL2 ARG_NONE
267#define ARGI_LOCAL3 ARG_NONE
268#define ARGI_LOCAL4 ARG_NONE
269#define ARGI_LOCAL5 ARG_NONE
270#define ARGI_LOCAL6 ARG_NONE
271#define ARGI_LOCAL7 ARG_NONE
272#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
273#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_COMPUTEDATA, ARGI_INTEGER,ARGI_COMPUTEDATA,ARGI_INTEGER)
274#define ARGI_METHOD_OP ARGI_INVALID_OPCODE
275#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE
276#define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
277#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
278#define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
279#define ARGI_MUTEX_OP ARGI_INVALID_OPCODE
280#define ARGI_NAME_OP ARGI_INVALID_OPCODE
281#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE
282#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE
283#define ARGI_NOOP_OP ARG_NONE
284#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER)
285#define ARGI_ONE_OP ARG_NONE
286#define ARGI_ONES_OP ARG_NONE
287#define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
288#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE
289#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE
290#define ARGI_QWORD_OP ARGI_INVALID_OPCODE
291#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF)
292#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
293#define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX)
294#define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE
295#define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT)
296#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
297#define ARGI_REVISION_OP ARG_NONE
298#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE
299#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
300#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
301#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT)
302#define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT)
303#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER)
304#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER)
305#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE
306#define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_TARGETREF)
307#define ARGI_STRING_OP ARGI_INVALID_OPCODE
308#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
309#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE
310#define ARGI_TIMER_OP ARG_NONE
311#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
312#define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
313#define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
314#define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
315#define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
316#define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET)
317#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE)
318#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE)
319#define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
320#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER)
321#define ARGI_WHILE_OP ARGI_INVALID_OPCODE
322#define ARGI_WORD_OP ARGI_INVALID_OPCODE
323#define ARGI_ZERO_OP ARG_NONE
324
325#endif /* __ACOPCODE_H__ */
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h
index c0395ef2b0d0..698276571818 100644
--- a/include/acpi/acparser.h
+++ b/include/acpi/acparser.h
@@ -64,8 +64,17 @@
64 64
65#define ACPI_PARSE_DEFERRED_OP 0x0100 65#define ACPI_PARSE_DEFERRED_OP 0x0100
66 66
67/* Parser external interfaces */
68 67
68/******************************************************************************
69 *
70 * Parser interfaces
71 *
72 *****************************************************************************/
73
74
75/*
76 * psxface - Parser external interfaces
77 */
69acpi_status 78acpi_status
70acpi_psx_load_table ( 79acpi_psx_load_table (
71 u8 *pcode_addr, 80 u8 *pcode_addr,
@@ -76,23 +85,13 @@ acpi_psx_execute (
76 struct acpi_parameter_info *info); 85 struct acpi_parameter_info *info);
77 86
78 87
79/****************************************************************************** 88/*
80 * 89 * psargs - Parse AML opcode arguments
81 * Parser interfaces 90 */
82 *
83 *****************************************************************************/
84
85
86/* psargs - Parse AML opcode arguments */
87
88u8 * 91u8 *
89acpi_ps_get_next_package_end ( 92acpi_ps_get_next_package_end (
90 struct acpi_parse_state *parser_state); 93 struct acpi_parse_state *parser_state);
91 94
92u32
93acpi_ps_get_next_package_length (
94 struct acpi_parse_state *parser_state);
95
96char * 95char *
97acpi_ps_get_next_namestring ( 96acpi_ps_get_next_namestring (
98 struct acpi_parse_state *parser_state); 97 struct acpi_parse_state *parser_state);
@@ -110,10 +109,6 @@ acpi_ps_get_next_namepath (
110 union acpi_parse_object *arg, 109 union acpi_parse_object *arg,
111 u8 method_call); 110 u8 method_call);
112 111
113union acpi_parse_object *
114acpi_ps_get_next_field (
115 struct acpi_parse_state *parser_state);
116
117acpi_status 112acpi_status
118acpi_ps_get_next_arg ( 113acpi_ps_get_next_arg (
119 struct acpi_walk_state *walk_state, 114 struct acpi_walk_state *walk_state,
@@ -122,8 +117,9 @@ acpi_ps_get_next_arg (
122 union acpi_parse_object **return_arg); 117 union acpi_parse_object **return_arg);
123 118
124 119
125/* psfind */ 120/*
126 121 * psfind
122 */
127union acpi_parse_object * 123union acpi_parse_object *
128acpi_ps_find_name ( 124acpi_ps_find_name (
129 union acpi_parse_object *scope, 125 union acpi_parse_object *scope,
@@ -135,8 +131,9 @@ acpi_ps_get_parent (
135 union acpi_parse_object *op); 131 union acpi_parse_object *op);
136 132
137 133
138/* psopcode - AML Opcode information */ 134/*
139 135 * psopcode - AML Opcode information
136 */
140const struct acpi_opcode_info * 137const struct acpi_opcode_info *
141acpi_ps_get_opcode_info ( 138acpi_ps_get_opcode_info (
142 u16 opcode); 139 u16 opcode);
@@ -146,56 +143,25 @@ acpi_ps_get_opcode_name (
146 u16 opcode); 143 u16 opcode);
147 144
148 145
149/* psparse - top level parsing routines */ 146/*
150 147 * psparse - top level parsing routines
151u32 148 */
152acpi_ps_get_opcode_size (
153 u32 opcode);
154
155void
156acpi_ps_complete_this_op (
157 struct acpi_walk_state *walk_state,
158 union acpi_parse_object *op);
159
160acpi_status
161acpi_ps_next_parse_state (
162 struct acpi_walk_state *walk_state,
163 union acpi_parse_object *op,
164 acpi_status callback_status);
165
166acpi_status
167acpi_ps_find_object (
168 struct acpi_walk_state *walk_state,
169 union acpi_parse_object **out_op);
170
171void
172acpi_ps_delete_parse_tree (
173 union acpi_parse_object *root);
174
175acpi_status
176acpi_ps_parse_loop (
177 struct acpi_walk_state *walk_state);
178
179acpi_status 149acpi_status
180acpi_ps_parse_aml ( 150acpi_ps_parse_aml (
181 struct acpi_walk_state *walk_state); 151 struct acpi_walk_state *walk_state);
182 152
183acpi_status 153u32
184acpi_ps_parse_table ( 154acpi_ps_get_opcode_size (
185 u8 *aml, 155 u32 opcode);
186 u32 aml_size,
187 acpi_parse_downwards descending_callback,
188 acpi_parse_upwards ascending_callback,
189 union acpi_parse_object **root_object);
190 156
191u16 157u16
192acpi_ps_peek_opcode ( 158acpi_ps_peek_opcode (
193 struct acpi_parse_state *state); 159 struct acpi_parse_state *state);
194 160
195 161
196/* psscope - Scope stack management routines */ 162/*
197 163 * psscope - Scope stack management routines
198 164 */
199acpi_status 165acpi_status
200acpi_ps_init_scope ( 166acpi_ps_init_scope (
201 struct acpi_parse_state *parser_state, 167 struct acpi_parse_state *parser_state,
@@ -228,8 +194,9 @@ acpi_ps_cleanup_scope (
228 struct acpi_parse_state *state); 194 struct acpi_parse_state *state);
229 195
230 196
231/* pstree - parse tree manipulation routines */ 197/*
232 198 * pstree - parse tree manipulation routines
199 */
233void 200void
234acpi_ps_append_arg( 201acpi_ps_append_arg(
235 union acpi_parse_object *op, 202 union acpi_parse_object *op,
@@ -247,20 +214,17 @@ acpi_ps_get_arg(
247 union acpi_parse_object *op, 214 union acpi_parse_object *op,
248 u32 argn); 215 u32 argn);
249 216
250#ifdef ACPI_FUTURE_USAGE 217#ifdef ACPI_FUTURE_USAGE
251union acpi_parse_object *
252acpi_ps_get_child (
253 union acpi_parse_object *op);
254
255union acpi_parse_object * 218union acpi_parse_object *
256acpi_ps_get_depth_next ( 219acpi_ps_get_depth_next (
257 union acpi_parse_object *origin, 220 union acpi_parse_object *origin,
258 union acpi_parse_object *op); 221 union acpi_parse_object *op);
259#endif /* ACPI_FUTURE_USAGE */ 222#endif /* ACPI_FUTURE_USAGE */
260
261 223
262/* pswalk - parse tree walk routines */
263 224
225/*
226 * pswalk - parse tree walk routines
227 */
264acpi_status 228acpi_status
265acpi_ps_walk_parsed_aml ( 229acpi_ps_walk_parsed_aml (
266 union acpi_parse_object *start_op, 230 union acpi_parse_object *start_op,
@@ -283,9 +247,14 @@ acpi_status
283acpi_ps_delete_completed_op ( 247acpi_ps_delete_completed_op (
284 struct acpi_walk_state *walk_state); 248 struct acpi_walk_state *walk_state);
285 249
250void
251acpi_ps_delete_parse_tree (
252 union acpi_parse_object *root);
286 253
287/* psutils - parser utilities */
288 254
255/*
256 * psutils - parser utilities
257 */
289union acpi_parse_object * 258union acpi_parse_object *
290acpi_ps_create_scope_op ( 259acpi_ps_create_scope_op (
291 void); 260 void);
@@ -303,12 +272,6 @@ void
303acpi_ps_free_op ( 272acpi_ps_free_op (
304 union acpi_parse_object *op); 273 union acpi_parse_object *op);
305 274
306#ifdef ACPI_ENABLE_OBJECT_CACHE
307void
308acpi_ps_delete_parse_cache (
309 void);
310#endif
311
312u8 275u8
313acpi_ps_is_leading_char ( 276acpi_ps_is_leading_char (
314 u32 c); 277 u32 c);
@@ -317,20 +280,27 @@ u8
317acpi_ps_is_prefix_char ( 280acpi_ps_is_prefix_char (
318 u32 c); 281 u32 c);
319 282
320#ifdef ACPI_FUTURE_USAGE 283#ifdef ACPI_FUTURE_USAGE
321u32 284u32
322acpi_ps_get_name( 285acpi_ps_get_name(
323 union acpi_parse_object *op); 286 union acpi_parse_object *op);
324#endif 287#endif /* ACPI_FUTURE_USAGE */
325 288
326void 289void
327acpi_ps_set_name( 290acpi_ps_set_name(
328 union acpi_parse_object *op, 291 union acpi_parse_object *op,
329 u32 name); 292 u32 name);
330 293
294#ifdef ACPI_ENABLE_OBJECT_CACHE
295void
296acpi_ps_delete_parse_cache (
297 void);
298#endif
331 299
332/* psdump - display parser tree */
333 300
301/*
302 * psdump - display parser tree
303 */
334u32 304u32
335acpi_ps_sprint_path ( 305acpi_ps_sprint_path (
336 char *buffer_start, 306 char *buffer_start,
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index ad53252dd42d..a69d78942040 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -49,6 +49,7 @@
49 * We put them here because we don't want to duplicate them 49 * We put them here because we don't want to duplicate them
50 * in the rest of the source code again and again. 50 * in the rest of the source code again and again.
51 */ 51 */
52#include "acnames.h" /* Global ACPI names and strings */
52#include "acconfig.h" /* Configuration constants */ 53#include "acconfig.h" /* Configuration constants */
53#include "platform/acenv.h" /* Target environment specific items */ 54#include "platform/acenv.h" /* Target environment specific items */
54#include "actypes.h" /* Fundamental common data types */ 55#include "actypes.h" /* Fundamental common data types */
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 857c8072eb1e..ea489f235216 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -79,7 +79,6 @@ struct acpi_signal_fatal_info
79/* 79/*
80 * OSL Initialization and shutdown primitives 80 * OSL Initialization and shutdown primitives
81 */ 81 */
82
83acpi_status 82acpi_status
84acpi_os_initialize ( 83acpi_os_initialize (
85 void); 84 void);
@@ -92,7 +91,6 @@ acpi_os_terminate (
92/* 91/*
93 * ACPI Table interfaces 92 * ACPI Table interfaces
94 */ 93 */
95
96acpi_status 94acpi_status
97acpi_os_get_root_pointer ( 95acpi_os_get_root_pointer (
98 u32 flags, 96 u32 flags,
@@ -112,7 +110,6 @@ acpi_os_table_override (
112/* 110/*
113 * Synchronization primitives 111 * Synchronization primitives
114 */ 112 */
115
116acpi_status 113acpi_status
117acpi_os_create_semaphore ( 114acpi_os_create_semaphore (
118 u32 max_units, 115 u32 max_units,
@@ -156,7 +153,6 @@ acpi_os_release_lock (
156/* 153/*
157 * Memory allocation and mapping 154 * Memory allocation and mapping
158 */ 155 */
159
160void * 156void *
161acpi_os_allocate ( 157acpi_os_allocate (
162 acpi_size size); 158 acpi_size size);
@@ -187,7 +183,6 @@ acpi_os_get_physical_address (
187/* 183/*
188 * Interrupt handlers 184 * Interrupt handlers
189 */ 185 */
190
191acpi_status 186acpi_status
192acpi_os_install_interrupt_handler ( 187acpi_os_install_interrupt_handler (
193 u32 gsi, 188 u32 gsi,
@@ -203,7 +198,6 @@ acpi_os_remove_interrupt_handler (
203/* 198/*
204 * Threads and Scheduling 199 * Threads and Scheduling
205 */ 200 */
206
207u32 201u32
208acpi_os_get_thread_id ( 202acpi_os_get_thread_id (
209 void); 203 void);
@@ -234,7 +228,6 @@ acpi_os_stall (
234/* 228/*
235 * Platform and hardware-independent I/O interfaces 229 * Platform and hardware-independent I/O interfaces
236 */ 230 */
237
238acpi_status 231acpi_status
239acpi_os_read_port ( 232acpi_os_read_port (
240 acpi_io_address address, 233 acpi_io_address address,
@@ -251,7 +244,6 @@ acpi_os_write_port (
251/* 244/*
252 * Platform and hardware-independent physical memory interfaces 245 * Platform and hardware-independent physical memory interfaces
253 */ 246 */
254
255acpi_status 247acpi_status
256acpi_os_read_memory ( 248acpi_os_read_memory (
257 acpi_physical_address address, 249 acpi_physical_address address,
@@ -270,7 +262,6 @@ acpi_os_write_memory (
270 * Note: Can't use "Register" as a parameter, changed to "Reg" -- 262 * Note: Can't use "Register" as a parameter, changed to "Reg" --
271 * certain compilers complain. 263 * certain compilers complain.
272 */ 264 */
273
274acpi_status 265acpi_status
275acpi_os_read_pci_configuration ( 266acpi_os_read_pci_configuration (
276 struct acpi_pci_id *pci_id, 267 struct acpi_pci_id *pci_id,
@@ -288,7 +279,6 @@ acpi_os_write_pci_configuration (
288/* 279/*
289 * Interim function needed for PCI IRQ routing 280 * Interim function needed for PCI IRQ routing
290 */ 281 */
291
292void 282void
293acpi_os_derive_pci_id( 283acpi_os_derive_pci_id(
294 acpi_handle rhandle, 284 acpi_handle rhandle,
@@ -298,7 +288,6 @@ acpi_os_derive_pci_id(
298/* 288/*
299 * Miscellaneous 289 * Miscellaneous
300 */ 290 */
301
302u8 291u8
303acpi_os_readable ( 292acpi_os_readable (
304 void *pointer, 293 void *pointer,
@@ -323,7 +312,6 @@ acpi_os_signal (
323/* 312/*
324 * Debug print routines 313 * Debug print routines
325 */ 314 */
326
327void ACPI_INTERNAL_VAR_XFACE 315void ACPI_INTERNAL_VAR_XFACE
328acpi_os_printf ( 316acpi_os_printf (
329 const char *format, 317 const char *format,
@@ -339,11 +327,10 @@ acpi_os_redirect_output (
339 void *destination); 327 void *destination);
340 328
341 329
330#ifdef ACPI_FUTURE_USAGE
342/* 331/*
343 * Debug input 332 * Debug input
344 */ 333 */
345
346#ifdef ACPI_FUTURE_USAGE
347u32 334u32
348acpi_os_get_line ( 335acpi_os_get_line (
349 char *buffer); 336 char *buffer);
@@ -353,7 +340,6 @@ acpi_os_get_line (
353/* 340/*
354 * Directory manipulation 341 * Directory manipulation
355 */ 342 */
356
357void * 343void *
358acpi_os_open_directory ( 344acpi_os_open_directory (
359 char *pathname, 345 char *pathname,
@@ -377,7 +363,6 @@ acpi_os_close_directory (
377/* 363/*
378 * Debug 364 * Debug
379 */ 365 */
380
381void 366void
382acpi_os_dbg_assert( 367acpi_os_dbg_assert(
383 void *failed_assertion, 368 void *failed_assertion,
@@ -385,5 +370,4 @@ acpi_os_dbg_assert(
385 u32 line_number, 370 u32 line_number,
386 char *message); 371 char *message);
387 372
388
389#endif /* __ACPIOSXF_H__ */ 373#endif /* __ACPIOSXF_H__ */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 00d78b79652e..f8f619f8e4f8 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -50,10 +50,9 @@
50#include "actbl.h" 50#include "actbl.h"
51 51
52 52
53 /* 53/*
54 * Global interfaces 54 * Global interfaces
55 */ 55 */
56
57acpi_status 56acpi_status
58acpi_initialize_subsystem ( 57acpi_initialize_subsystem (
59 void); 58 void);
@@ -106,9 +105,8 @@ acpi_install_initialization_handler (
106#endif 105#endif
107 106
108/* 107/*
109 * ACPI Memory manager 108 * ACPI Memory managment
110 */ 109 */
111
112void * 110void *
113acpi_allocate ( 111acpi_allocate (
114 u32 size); 112 u32 size);
@@ -125,7 +123,6 @@ acpi_free (
125/* 123/*
126 * ACPI table manipulation interfaces 124 * ACPI table manipulation interfaces
127 */ 125 */
128
129acpi_status 126acpi_status
130acpi_find_root_pointer ( 127acpi_find_root_pointer (
131 u32 flags, 128 u32 flags,
@@ -168,7 +165,6 @@ acpi_get_firmware_table (
168/* 165/*
169 * Namespace and name interfaces 166 * Namespace and name interfaces
170 */ 167 */
171
172acpi_status 168acpi_status
173acpi_walk_namespace ( 169acpi_walk_namespace (
174 acpi_object_type type, 170 acpi_object_type type,
@@ -218,7 +214,6 @@ acpi_get_data (
218/* 214/*
219 * Object manipulation and enumeration 215 * Object manipulation and enumeration
220 */ 216 */
221
222acpi_status 217acpi_status
223acpi_evaluate_object ( 218acpi_evaluate_object (
224 acpi_handle object, 219 acpi_handle object,
@@ -262,7 +257,6 @@ acpi_get_parent (
262/* 257/*
263 * Event handler interfaces 258 * Event handler interfaces
264 */ 259 */
265
266acpi_status 260acpi_status
267acpi_install_fixed_event_handler ( 261acpi_install_fixed_event_handler (
268 u32 acpi_event, 262 u32 acpi_event,
@@ -319,7 +313,6 @@ acpi_install_exception_handler (
319/* 313/*
320 * Event interfaces 314 * Event interfaces
321 */ 315 */
322
323acpi_status 316acpi_status
324acpi_acquire_global_lock ( 317acpi_acquire_global_lock (
325 u16 timeout, 318 u16 timeout,
@@ -404,7 +397,6 @@ acpi_remove_gpe_block (
404/* 397/*
405 * Resource interfaces 398 * Resource interfaces
406 */ 399 */
407
408typedef 400typedef
409acpi_status (*ACPI_WALK_RESOURCE_CALLBACK) ( 401acpi_status (*ACPI_WALK_RESOURCE_CALLBACK) (
410 struct acpi_resource *resource, 402 struct acpi_resource *resource,
@@ -448,7 +440,6 @@ acpi_resource_to_address64 (
448/* 440/*
449 * Hardware (ACPI device) interfaces 441 * Hardware (ACPI device) interfaces
450 */ 442 */
451
452acpi_status 443acpi_status
453acpi_get_register ( 444acpi_get_register (
454 u32 register_id, 445 u32 register_id,
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h
index 93c55ff5c237..ed679264c12c 100644
--- a/include/acpi/acresrc.h
+++ b/include/acpi/acresrc.h
@@ -48,7 +48,6 @@
48/* 48/*
49 * Function prototypes called from Acpi* APIs 49 * Function prototypes called from Acpi* APIs
50 */ 50 */
51
52acpi_status 51acpi_status
53acpi_rs_get_prt_method_data ( 52acpi_rs_get_prt_method_data (
54 acpi_handle handle, 53 acpi_handle handle,
@@ -60,12 +59,12 @@ acpi_rs_get_crs_method_data (
60 acpi_handle handle, 59 acpi_handle handle,
61 struct acpi_buffer *ret_buffer); 60 struct acpi_buffer *ret_buffer);
62 61
63#ifdef ACPI_FUTURE_USAGE 62#ifdef ACPI_FUTURE_USAGE
64acpi_status 63acpi_status
65acpi_rs_get_prs_method_data ( 64acpi_rs_get_prs_method_data (
66 acpi_handle handle, 65 acpi_handle handle,
67 struct acpi_buffer *ret_buffer); 66 struct acpi_buffer *ret_buffer);
68#endif 67#endif /* ACPI_FUTURE_USAGE */
69 68
70acpi_status 69acpi_status
71acpi_rs_get_method_data ( 70acpi_rs_get_method_data (
@@ -95,61 +94,9 @@ acpi_rs_create_pci_routing_table (
95 94
96 95
97/* 96/*
98 * Function prototypes called from acpi_rs_create* 97 * rsdump
99 */ 98 */
100#ifdef ACPI_FUTURE_USAGE 99#ifdef ACPI_FUTURE_USAGE
101void
102acpi_rs_dump_irq (
103 union acpi_resource_data *data);
104
105void
106acpi_rs_dump_address16 (
107 union acpi_resource_data *data);
108
109void
110acpi_rs_dump_address32 (
111 union acpi_resource_data *data);
112
113void
114acpi_rs_dump_address64 (
115 union acpi_resource_data *data);
116
117void
118acpi_rs_dump_dma (
119 union acpi_resource_data *data);
120
121void
122acpi_rs_dump_io (
123 union acpi_resource_data *data);
124
125void
126acpi_rs_dump_extended_irq (
127 union acpi_resource_data *data);
128
129void
130acpi_rs_dump_fixed_io (
131 union acpi_resource_data *data);
132
133void
134acpi_rs_dump_fixed_memory32 (
135 union acpi_resource_data *data);
136
137void
138acpi_rs_dump_memory24 (
139 union acpi_resource_data *data);
140
141void
142acpi_rs_dump_memory32 (
143 union acpi_resource_data *data);
144
145void
146acpi_rs_dump_start_depend_fns (
147 union acpi_resource_data *data);
148
149void
150acpi_rs_dump_vendor_specific (
151 union acpi_resource_data *data);
152
153void 100void
154acpi_rs_dump_resource_list ( 101acpi_rs_dump_resource_list (
155 struct acpi_resource *resource); 102 struct acpi_resource *resource);
@@ -157,8 +104,12 @@ acpi_rs_dump_resource_list (
157void 104void
158acpi_rs_dump_irq_list ( 105acpi_rs_dump_irq_list (
159 u8 *route_table); 106 u8 *route_table);
160#endif /* ACPI_FUTURE_USAGE */ 107#endif /* ACPI_FUTURE_USAGE */
161 108
109
110/*
111 * rscalc
112 */
162acpi_status 113acpi_status
163acpi_rs_get_byte_stream_start ( 114acpi_rs_get_byte_stream_start (
164 u8 *byte_stream_buffer, 115 u8 *byte_stream_buffer,
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h
index c97843f6bcbc..e6b9e36a2eda 100644
--- a/include/acpi/acstruct.h
+++ b/include/acpi/acstruct.h
@@ -56,7 +56,6 @@
56 * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through 56 * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through
57 * the tree (for whatever reason), and for control method execution. 57 * the tree (for whatever reason), and for control method execution.
58 */ 58 */
59
60#define ACPI_NEXT_OP_DOWNWARD 1 59#define ACPI_NEXT_OP_DOWNWARD 1
61#define ACPI_NEXT_OP_UPWARD 2 60#define ACPI_NEXT_OP_UPWARD 2
62 61
diff --git a/include/acpi/actables.h b/include/acpi/actables.h
index e8f5d4ffd452..39df92e21a0d 100644
--- a/include/acpi/actables.h
+++ b/include/acpi/actables.h
@@ -50,17 +50,9 @@
50#define SIZE_IN_HEADER 0 50#define SIZE_IN_HEADER 0
51 51
52 52
53#ifdef ACPI_FUTURE_USAGE
54acpi_status
55acpi_tb_handle_to_object (
56 u16 table_id,
57 struct acpi_table_desc **table_desc);
58#endif
59
60/* 53/*
61 * tbconvrt - Table conversion routines 54 * tbconvrt - Table conversion routines
62 */ 55 */
63
64acpi_status 56acpi_status
65acpi_tb_convert_to_xsdt ( 57acpi_tb_convert_to_xsdt (
66 struct acpi_table_desc *table_info); 58 struct acpi_table_desc *table_info);
@@ -78,10 +70,10 @@ acpi_tb_get_table_count (
78 struct rsdp_descriptor *RSDP, 70 struct rsdp_descriptor *RSDP,
79 struct acpi_table_header *RSDT); 71 struct acpi_table_header *RSDT);
80 72
73
81/* 74/*
82 * tbget - Table "get" routines 75 * tbget - Table "get" routines
83 */ 76 */
84
85acpi_status 77acpi_status
86acpi_tb_get_table ( 78acpi_tb_get_table (
87 struct acpi_pointer *address, 79 struct acpi_pointer *address,
@@ -99,17 +91,6 @@ acpi_tb_get_table_body (
99 struct acpi_table_desc *table_info); 91 struct acpi_table_desc *table_info);
100 92
101acpi_status 93acpi_status
102acpi_tb_get_this_table (
103 struct acpi_pointer *address,
104 struct acpi_table_header *header,
105 struct acpi_table_desc *table_info);
106
107acpi_status
108acpi_tb_table_override (
109 struct acpi_table_header *header,
110 struct acpi_table_desc *table_info);
111
112acpi_status
113acpi_tb_get_table_ptr ( 94acpi_tb_get_table_ptr (
114 acpi_table_type table_type, 95 acpi_table_type table_type,
115 u32 instance, 96 u32 instance,
@@ -127,36 +108,23 @@ acpi_status
127acpi_tb_validate_rsdt ( 108acpi_tb_validate_rsdt (
128 struct acpi_table_header *table_ptr); 109 struct acpi_table_header *table_ptr);
129 110
111
112/*
113 * tbgetall - get multiple required tables
114 */
130acpi_status 115acpi_status
131acpi_tb_get_required_tables ( 116acpi_tb_get_required_tables (
132 void); 117 void);
133 118
134acpi_status
135acpi_tb_get_primary_table (
136 struct acpi_pointer *address,
137 struct acpi_table_desc *table_info);
138
139acpi_status
140acpi_tb_get_secondary_table (
141 struct acpi_pointer *address,
142 acpi_string signature,
143 struct acpi_table_desc *table_info);
144 119
145/* 120/*
146 * tbinstall - Table installation 121 * tbinstall - Table installation
147 */ 122 */
148
149acpi_status 123acpi_status
150acpi_tb_install_table ( 124acpi_tb_install_table (
151 struct acpi_table_desc *table_info); 125 struct acpi_table_desc *table_info);
152 126
153acpi_status 127acpi_status
154acpi_tb_match_signature (
155 char *signature,
156 struct acpi_table_desc *table_info,
157 u8 search_type);
158
159acpi_status
160acpi_tb_recognize_table ( 128acpi_tb_recognize_table (
161 struct acpi_table_desc *table_info, 129 struct acpi_table_desc *table_info,
162 u8 search_type); 130 u8 search_type);
@@ -170,7 +138,6 @@ acpi_tb_init_table_descriptor (
170/* 138/*
171 * tbremove - Table removal and deletion 139 * tbremove - Table removal and deletion
172 */ 140 */
173
174void 141void
175acpi_tb_delete_all_tables ( 142acpi_tb_delete_all_tables (
176 void); 143 void);
@@ -189,35 +156,23 @@ acpi_tb_uninstall_table (
189 156
190 157
191/* 158/*
192 * tbrsd - RSDP, RSDT utilities 159 * tbxfroot - RSDP, RSDT utilities
193 */ 160 */
161acpi_status
162acpi_tb_find_table (
163 char *signature,
164 char *oem_id,
165 char *oem_table_id,
166 struct acpi_table_header **table_ptr);
194 167
195acpi_status 168acpi_status
196acpi_tb_get_table_rsdt ( 169acpi_tb_get_table_rsdt (
197 void); 170 void);
198 171
199u8 *
200acpi_tb_scan_memory_for_rsdp (
201 u8 *start_address,
202 u32 length);
203
204acpi_status
205acpi_tb_find_rsdp (
206 struct acpi_table_desc *table_info,
207 u32 flags);
208
209 172
210/* 173/*
211 * tbutils - common table utilities 174 * tbutils - common table utilities
212 */ 175 */
213
214acpi_status
215acpi_tb_find_table (
216 char *signature,
217 char *oem_id,
218 char *oem_table_id,
219 struct acpi_table_header **table_ptr);
220
221acpi_status 176acpi_status
222acpi_tb_verify_table_checksum ( 177acpi_tb_verify_table_checksum (
223 struct acpi_table_header *table_header); 178 struct acpi_table_header *table_header);
@@ -231,5 +186,4 @@ acpi_status
231acpi_tb_validate_table_header ( 186acpi_tb_validate_table_header (
232 struct acpi_table_header *table_header); 187 struct acpi_table_header *table_header);
233 188
234
235#endif /* __ACTABLES_H__ */ 189#endif /* __ACTABLES_H__ */
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 7eee731112b1..b5cdcca444c8 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -133,7 +133,6 @@ struct acpi_table_header /* ACPI common table header */
133#define DUAL_PIC 0 133#define DUAL_PIC 0
134#define MULTIPLE_APIC 1 134#define MULTIPLE_APIC 1
135 135
136
137/* Master MADT */ 136/* Master MADT */
138 137
139struct multiple_apic_table 138struct multiple_apic_table
@@ -144,7 +143,6 @@ struct multiple_apic_table
144 u32 reserved1 : 31; 143 u32 reserved1 : 31;
145}; 144};
146 145
147
148/* Values for Type in APIC_HEADER_DEF */ 146/* Values for Type in APIC_HEADER_DEF */
149 147
150#define APIC_PROCESSOR 0 148#define APIC_PROCESSOR 0
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 7acb550af3eb..3a451dc48ac8 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -478,7 +478,6 @@ typedef u32 acpi_object_type;
478#define ACPI_TYPE_INVALID 0x1E 478#define ACPI_TYPE_INVALID 0x1E
479#define ACPI_TYPE_NOT_FOUND 0xFF 479#define ACPI_TYPE_NOT_FOUND 0xFF
480 480
481
482/* 481/*
483 * Bitmapped ACPI types. Used internally only 482 * Bitmapped ACPI types. Used internally only
484 */ 483 */
@@ -803,7 +802,6 @@ struct acpi_system_info
803/* 802/*
804 * Types specific to the OS service interfaces 803 * Types specific to the OS service interfaces
805 */ 804 */
806
807typedef u32 805typedef u32
808(ACPI_SYSTEM_XFACE *acpi_osd_handler) ( 806(ACPI_SYSTEM_XFACE *acpi_osd_handler) (
809 void *context); 807 void *context);
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
index 0de26b8f1028..192d0bea3884 100644
--- a/include/acpi/acutils.h
+++ b/include/acpi/acutils.h
@@ -52,13 +52,6 @@ acpi_status (*acpi_pkg_callback) (
52 union acpi_generic_state *state, 52 union acpi_generic_state *state,
53 void *context); 53 void *context);
54 54
55acpi_status
56acpi_ut_walk_package_tree (
57 union acpi_operand_object *source_object,
58 void *target_object,
59 acpi_pkg_callback walk_callback,
60 void *context);
61
62struct acpi_pkg_info 55struct acpi_pkg_info
63{ 56{
64 u8 *free_space; 57 u8 *free_space;
@@ -79,37 +72,13 @@ struct acpi_pkg_info
79#define DB_QWORD_DISPLAY 8 72#define DB_QWORD_DISPLAY 8
80 73
81 74
82/* Global initialization interfaces */
83
84void
85acpi_ut_init_globals (
86 void);
87
88void
89acpi_ut_terminate (
90 void);
91
92
93/* 75/*
94 * ut_init - miscellaneous initialization and shutdown 76 * utglobal - Global data structures and procedures
95 */ 77 */
96
97acpi_status
98acpi_ut_hardware_initialize (
99 void);
100
101void 78void
102acpi_ut_subsystem_shutdown ( 79acpi_ut_init_globals (
103 void);
104
105acpi_status
106acpi_ut_validate_fadt (
107 void); 80 void);
108 81
109/*
110 * ut_global - Global data structures and procedures
111 */
112
113#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 82#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
114 83
115char * 84char *
@@ -157,9 +126,24 @@ acpi_ut_allocate_owner_id (
157 126
158 127
159/* 128/*
160 * ut_clib - Local implementations of C library functions 129 * utinit - miscellaneous initialization and shutdown
161 */ 130 */
131acpi_status
132acpi_ut_hardware_initialize (
133 void);
162 134
135void
136acpi_ut_subsystem_shutdown (
137 void);
138
139acpi_status
140acpi_ut_validate_fadt (
141 void);
142
143
144/*
145 * utclib - Local implementations of C library functions
146 */
163#ifndef ACPI_USE_SYSTEM_CLIBRARY 147#ifndef ACPI_USE_SYSTEM_CLIBRARY
164 148
165acpi_size 149acpi_size
@@ -260,10 +244,10 @@ extern const u8 _acpi_ctype[];
260 244
261#endif /* ACPI_USE_SYSTEM_CLIBRARY */ 245#endif /* ACPI_USE_SYSTEM_CLIBRARY */
262 246
247
263/* 248/*
264 * ut_copy - Object construction and conversion interfaces 249 * utcopy - Object construction and conversion interfaces
265 */ 250 */
266
267acpi_status 251acpi_status
268acpi_ut_build_simple_object( 252acpi_ut_build_simple_object(
269 union acpi_operand_object *obj, 253 union acpi_operand_object *obj,
@@ -278,30 +262,11 @@ acpi_ut_build_package_object (
278 u32 *space_used); 262 u32 *space_used);
279 263
280acpi_status 264acpi_status
281acpi_ut_copy_ielement_to_eelement (
282 u8 object_type,
283 union acpi_operand_object *source_object,
284 union acpi_generic_state *state,
285 void *context);
286
287acpi_status
288acpi_ut_copy_ielement_to_ielement (
289 u8 object_type,
290 union acpi_operand_object *source_object,
291 union acpi_generic_state *state,
292 void *context);
293
294acpi_status
295acpi_ut_copy_iobject_to_eobject ( 265acpi_ut_copy_iobject_to_eobject (
296 union acpi_operand_object *obj, 266 union acpi_operand_object *obj,
297 struct acpi_buffer *ret_buffer); 267 struct acpi_buffer *ret_buffer);
298 268
299acpi_status 269acpi_status
300acpi_ut_copy_esimple_to_isimple(
301 union acpi_object *user_obj,
302 union acpi_operand_object **return_obj);
303
304acpi_status
305acpi_ut_copy_eobject_to_iobject ( 270acpi_ut_copy_eobject_to_iobject (
306 union acpi_object *obj, 271 union acpi_object *obj,
307 union acpi_operand_object **internal_obj); 272 union acpi_operand_object **internal_obj);
@@ -312,17 +277,6 @@ acpi_ut_copy_isimple_to_isimple (
312 union acpi_operand_object *dest_obj); 277 union acpi_operand_object *dest_obj);
313 278
314acpi_status 279acpi_status
315acpi_ut_copy_ipackage_to_ipackage (
316 union acpi_operand_object *source_obj,
317 union acpi_operand_object *dest_obj,
318 struct acpi_walk_state *walk_state);
319
320acpi_status
321acpi_ut_copy_simple_object (
322 union acpi_operand_object *source_desc,
323 union acpi_operand_object *dest_desc);
324
325acpi_status
326acpi_ut_copy_iobject_to_iobject ( 280acpi_ut_copy_iobject_to_iobject (
327 union acpi_operand_object *source_desc, 281 union acpi_operand_object *source_desc,
328 union acpi_operand_object **dest_desc, 282 union acpi_operand_object **dest_desc,
@@ -330,9 +284,8 @@ acpi_ut_copy_iobject_to_iobject (
330 284
331 285
332/* 286/*
333 * ut_create - Object creation 287 * utcreate - Object creation
334 */ 288 */
335
336acpi_status 289acpi_status
337acpi_ut_update_object_reference ( 290acpi_ut_update_object_reference (
338 union acpi_operand_object *object, 291 union acpi_operand_object *object,
@@ -340,9 +293,8 @@ acpi_ut_update_object_reference (
340 293
341 294
342/* 295/*
343 * ut_debug - Debug interfaces 296 * utdebug - Debug interfaces
344 */ 297 */
345
346void 298void
347acpi_ut_init_stack_ptr_trace ( 299acpi_ut_init_stack_ptr_trace (
348 void); 300 void);
@@ -440,11 +392,14 @@ acpi_ut_debug_print_raw (
440 392
441 393
442/* 394/*
443 * ut_delete - Object deletion 395 * utdelete - Object deletion and reference counts
444 */ 396 */
397void
398acpi_ut_add_reference (
399 union acpi_operand_object *object);
445 400
446void 401void
447acpi_ut_delete_internal_obj ( 402acpi_ut_remove_reference (
448 union acpi_operand_object *object); 403 union acpi_operand_object *object);
449 404
450void 405void
@@ -461,25 +416,8 @@ acpi_ut_delete_internal_object_list (
461 416
462 417
463/* 418/*
464 * ut_eval - object evaluation 419 * uteval - object evaluation
465 */ 420 */
466
467/* Method name strings */
468
469#define METHOD_NAME__HID "_HID"
470#define METHOD_NAME__CID "_CID"
471#define METHOD_NAME__UID "_UID"
472#define METHOD_NAME__ADR "_ADR"
473#define METHOD_NAME__STA "_STA"
474#define METHOD_NAME__REG "_REG"
475#define METHOD_NAME__SEG "_SEG"
476#define METHOD_NAME__BBN "_BBN"
477#define METHOD_NAME__PRT "_PRT"
478#define METHOD_NAME__CRS "_CRS"
479#define METHOD_NAME__PRS "_PRS"
480#define METHOD_NAME__PRW "_PRW"
481
482
483acpi_status 421acpi_status
484acpi_ut_osi_implementation ( 422acpi_ut_osi_implementation (
485 struct acpi_walk_state *walk_state); 423 struct acpi_walk_state *walk_state);
@@ -522,39 +460,10 @@ acpi_ut_execute_sxds (
522 struct acpi_namespace_node *device_node, 460 struct acpi_namespace_node *device_node,
523 u8 *highest); 461 u8 *highest);
524 462
525/*
526 * ut_mutex - mutual exclusion interfaces
527 */
528
529acpi_status
530acpi_ut_mutex_initialize (
531 void);
532
533void
534acpi_ut_mutex_terminate (
535 void);
536
537acpi_status
538acpi_ut_create_mutex (
539 acpi_mutex_handle mutex_id);
540
541acpi_status
542acpi_ut_delete_mutex (
543 acpi_mutex_handle mutex_id);
544
545acpi_status
546acpi_ut_acquire_mutex (
547 acpi_mutex_handle mutex_id);
548
549acpi_status
550acpi_ut_release_mutex (
551 acpi_mutex_handle mutex_id);
552
553 463
554/* 464/*
555 * ut_object - internal object create/delete/cache routines 465 * utobject - internal object create/delete/cache routines
556 */ 466 */
557
558union acpi_operand_object * 467union acpi_operand_object *
559acpi_ut_create_internal_object_dbg ( 468acpi_ut_create_internal_object_dbg (
560 char *module_name, 469 char *module_name,
@@ -587,50 +496,15 @@ union acpi_operand_object *
587acpi_ut_create_string_object ( 496acpi_ut_create_string_object (
588 acpi_size string_size); 497 acpi_size string_size);
589 498
590
591/*
592 * ut_ref_cnt - Object reference count management
593 */
594
595void
596acpi_ut_add_reference (
597 union acpi_operand_object *object);
598
599void
600acpi_ut_remove_reference (
601 union acpi_operand_object *object);
602
603/*
604 * ut_size - Object size routines
605 */
606
607acpi_status
608acpi_ut_get_simple_object_size (
609 union acpi_operand_object *obj,
610 acpi_size *obj_length);
611
612acpi_status
613acpi_ut_get_package_object_size (
614 union acpi_operand_object *obj,
615 acpi_size *obj_length);
616
617acpi_status 499acpi_status
618acpi_ut_get_object_size( 500acpi_ut_get_object_size(
619 union acpi_operand_object *obj, 501 union acpi_operand_object *obj,
620 acpi_size *obj_length); 502 acpi_size *obj_length);
621 503
622acpi_status
623acpi_ut_get_element_length (
624 u8 object_type,
625 union acpi_operand_object *source_object,
626 union acpi_generic_state *state,
627 void *context);
628
629 504
630/* 505/*
631 * ut_state - Generic state creation/cache routines 506 * utstate - Generic state creation/cache routines
632 */ 507 */
633
634void 508void
635acpi_ut_push_generic_state ( 509acpi_ut_push_generic_state (
636 union acpi_generic_state **list_head, 510 union acpi_generic_state **list_head,
@@ -666,14 +540,14 @@ acpi_ut_create_update_state_and_push (
666 u16 action, 540 u16 action,
667 union acpi_generic_state **state_list); 541 union acpi_generic_state **state_list);
668 542
669#ifdef ACPI_FUTURE_USAGE 543#ifdef ACPI_FUTURE_USAGE
670acpi_status 544acpi_status
671acpi_ut_create_pkg_state_and_push ( 545acpi_ut_create_pkg_state_and_push (
672 void *internal_object, 546 void *internal_object,
673 void *external_object, 547 void *external_object,
674 u16 index, 548 u16 index,
675 union acpi_generic_state **state_list); 549 union acpi_generic_state **state_list);
676#endif 550#endif /* ACPI_FUTURE_USAGE */
677 551
678union acpi_generic_state * 552union acpi_generic_state *
679acpi_ut_create_control_state ( 553acpi_ut_create_control_state (
@@ -693,15 +567,10 @@ acpi_ut_delete_object_cache (
693 void); 567 void);
694#endif 568#endif
695 569
570
696/* 571/*
697 * utmisc 572 * utmath
698 */ 573 */
699
700void
701acpi_ut_print_string (
702 char *string,
703 u8 max_length);
704
705acpi_status 574acpi_status
706acpi_ut_divide ( 575acpi_ut_divide (
707 acpi_integer in_dividend, 576 acpi_integer in_dividend,
@@ -716,6 +585,25 @@ acpi_ut_short_divide (
716 acpi_integer *out_quotient, 585 acpi_integer *out_quotient,
717 u32 *out_remainder); 586 u32 *out_remainder);
718 587
588/*
589 * utmisc
590 */
591acpi_status
592acpi_ut_walk_package_tree (
593 union acpi_operand_object *source_object,
594 void *target_object,
595 acpi_pkg_callback walk_callback,
596 void *context);
597
598char *
599acpi_ut_strupr (
600 char *src_string);
601
602void
603acpi_ut_print_string (
604 char *string,
605 u8 max_length);
606
719u8 607u8
720acpi_ut_valid_acpi_name ( 608acpi_ut_valid_acpi_name (
721 u32 name); 609 u32 name);
@@ -734,11 +622,21 @@ acpi_ut_strtoul64 (
734 622
735#define ACPI_ANY_BASE 0 623#define ACPI_ANY_BASE 0
736 624
737#ifdef ACPI_FUTURE_USAGE 625acpi_status
738char * 626acpi_ut_mutex_initialize (
739acpi_ut_strupr ( 627 void);
740 char *src_string); 628
741#endif 629void
630acpi_ut_mutex_terminate (
631 void);
632
633acpi_status
634acpi_ut_acquire_mutex (
635 acpi_mutex_handle mutex_id);
636
637acpi_status
638acpi_ut_release_mutex (
639 acpi_mutex_handle mutex_id);
742 640
743u8 * 641u8 *
744acpi_ut_get_resource_end_tag ( 642acpi_ut_get_resource_end_tag (
@@ -768,9 +666,8 @@ acpi_ut_display_init_pathname (
768 666
769 667
770/* 668/*
771 * Utalloc - memory allocation and object caching 669 * utalloc - memory allocation and object caching
772 */ 670 */
773
774void * 671void *
775acpi_ut_acquire_from_cache ( 672acpi_ut_acquire_from_cache (
776 u32 list_id); 673 u32 list_id);
@@ -795,9 +692,6 @@ acpi_ut_initialize_buffer (
795 struct acpi_buffer *buffer, 692 struct acpi_buffer *buffer,
796 acpi_size required_length); 693 acpi_size required_length);
797 694
798
799/* Memory allocation functions */
800
801void * 695void *
802acpi_ut_allocate ( 696acpi_ut_allocate (
803 acpi_size size, 697 acpi_size size,
@@ -812,9 +706,7 @@ acpi_ut_callocate (
812 char *module, 706 char *module,
813 u32 line); 707 u32 line);
814 708
815
816#ifdef ACPI_DBG_TRACK_ALLOCATIONS 709#ifdef ACPI_DBG_TRACK_ALLOCATIONS
817
818void * 710void *
819acpi_ut_allocate_and_track ( 711acpi_ut_allocate_and_track (
820 acpi_size size, 712 acpi_size size,
@@ -836,34 +728,11 @@ acpi_ut_free_and_track (
836 char *module, 728 char *module,
837 u32 line); 729 u32 line);
838 730
839struct acpi_debug_mem_block * 731#ifdef ACPI_FUTURE_USAGE
840acpi_ut_find_allocation (
841 u32 list_id,
842 void *allocation);
843
844acpi_status
845acpi_ut_track_allocation (
846 u32 list_id,
847 struct acpi_debug_mem_block *address,
848 acpi_size size,
849 u8 alloc_type,
850 u32 component,
851 char *module,
852 u32 line);
853
854acpi_status
855acpi_ut_remove_allocation (
856 u32 list_id,
857 struct acpi_debug_mem_block *address,
858 u32 component,
859 char *module,
860 u32 line);
861
862#ifdef ACPI_FUTURE_USAGE
863void 732void
864acpi_ut_dump_allocation_info ( 733acpi_ut_dump_allocation_info (
865 void); 734 void);
866#endif 735#endif /* ACPI_FUTURE_USAGE */
867 736
868void 737void
869acpi_ut_dump_allocations ( 738acpi_ut_dump_allocations (
@@ -871,5 +740,4 @@ acpi_ut_dump_allocations (
871 char *module); 740 char *module);
872#endif 741#endif
873 742
874
875#endif /* _ACUTILS_H */ 743#endif /* _ACUTILS_H */
diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h
index 2ec538eac58e..55e97ed29190 100644
--- a/include/acpi/amlcode.h
+++ b/include/acpi/amlcode.h
@@ -146,8 +146,7 @@
146 146
147/* prefixed opcodes */ 147/* prefixed opcodes */
148 148
149#define AML_EXTOP (u16) 0x005b 149#define AML_EXTOP (u16) 0x005b /* prefix for 2-byte opcodes */
150
151 150
152#define AML_MUTEX_OP (u16) 0x5b01 151#define AML_MUTEX_OP (u16) 0x5b01
153#define AML_EVENT_OP (u16) 0x5b02 152#define AML_EVENT_OP (u16) 0x5b02
@@ -194,7 +193,6 @@
194 * Use only "Unknown" AML opcodes, don't attempt to use 193 * Use only "Unknown" AML opcodes, don't attempt to use
195 * any valid ACPI ASCII values (A-Z, 0-9, '-') 194 * any valid ACPI ASCII values (A-Z, 0-9, '-')
196 */ 195 */
197
198#define AML_INT_NAMEPATH_OP (u16) 0x002d 196#define AML_INT_NAMEPATH_OP (u16) 0x002d
199#define AML_INT_NAMEDFIELD_OP (u16) 0x0030 197#define AML_INT_NAMEDFIELD_OP (u16) 0x0030
200#define AML_INT_RESERVEDFIELD_OP (u16) 0x0031 198#define AML_INT_RESERVEDFIELD_OP (u16) 0x0031
@@ -214,7 +212,6 @@
214 * There can be up to 31 unique argument types 212 * There can be up to 31 unique argument types
215 * Zero is reserved as end-of-list indicator 213 * Zero is reserved as end-of-list indicator
216 */ 214 */
217
218#define ARGP_BYTEDATA 0x01 215#define ARGP_BYTEDATA 0x01
219#define ARGP_BYTELIST 0x02 216#define ARGP_BYTELIST 0x02
220#define ARGP_CHARLIST 0x03 217#define ARGP_CHARLIST 0x03
@@ -295,7 +292,6 @@
295/* 292/*
296 * opcode groups and types 293 * opcode groups and types
297 */ 294 */
298
299#define OPGRP_NAMED 0x01 295#define OPGRP_NAMED 0x01
300#define OPGRP_FIELD 0x02 296#define OPGRP_FIELD 0x02
301#define OPGRP_BYTELIST 0x04 297#define OPGRP_BYTELIST 0x04
@@ -381,6 +377,12 @@
381#define AML_TYPE_UNDEFINED 0x19 377#define AML_TYPE_UNDEFINED 0x19
382#define AML_TYPE_BOGUS 0x1A 378#define AML_TYPE_BOGUS 0x1A
383 379
380/* AML Package Length encodings */
381
382#define ACPI_AML_PACKAGE_TYPE1 0x40
383#define ACPI_AML_PACKAGE_TYPE2 0x4000
384#define ACPI_AML_PACKAGE_TYPE3 0x400000
385#define ACPI_AML_PACKAGE_TYPE4 0x40000000
384 386
385/* 387/*
386 * Opcode classes 388 * Opcode classes
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 57bf9362335d..adf969efa510 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -198,6 +198,7 @@
198#endif 198#endif
199#endif /* !DEBUGGER_THREADING */ 199#endif /* !DEBUGGER_THREADING */
200 200
201
201/****************************************************************************** 202/******************************************************************************
202 * 203 *
203 * C library configuration 204 * C library configuration
@@ -209,7 +210,6 @@
209 * Use the standard C library headers. 210 * Use the standard C library headers.
210 * We want to keep these to a minimum. 211 * We want to keep these to a minimum.
211 */ 212 */
212
213#ifdef ACPI_USE_STANDARD_HEADERS 213#ifdef ACPI_USE_STANDARD_HEADERS
214/* 214/*
215 * Use the standard headers from the standard locations 215 * Use the standard headers from the standard locations
@@ -224,14 +224,8 @@
224/* 224/*
225 * We will be linking to the standard Clib functions 225 * We will be linking to the standard Clib functions
226 */ 226 */
227
228#define ACPI_STRSTR(s1,s2) strstr((s1), (s2)) 227#define ACPI_STRSTR(s1,s2) strstr((s1), (s2))
229#define ACPI_STRCHR(s1,c) strchr((s1), (c)) 228#define ACPI_STRCHR(s1,c) strchr((s1), (c))
230
231#ifdef ACPI_FUTURE_USAGE
232#define ACPI_STRUPR(s) (void) acpi_ut_strupr ((s))
233#endif
234
235#define ACPI_STRLEN(s) (acpi_size) strlen((s)) 229#define ACPI_STRLEN(s) (acpi_size) strlen((s))
236#define ACPI_STRCPY(d,s) (void) strcpy((d), (s)) 230#define ACPI_STRCPY(d,s) (void) strcpy((d), (s))
237#define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (acpi_size)(n)) 231#define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (acpi_size)(n))
@@ -254,14 +248,15 @@
254#define ACPI_IS_ALPHA isalpha 248#define ACPI_IS_ALPHA isalpha
255#define ACPI_IS_ASCII isascii 249#define ACPI_IS_ASCII isascii
256 250
251#else
252
257/****************************************************************************** 253/******************************************************************************
258 * 254 *
259 * Not using native C library, use local implementations 255 * Not using native C library, use local implementations
260 * 256 *
261 *****************************************************************************/ 257 *****************************************************************************/
262#else
263 258
264/* 259 /*
265 * Use local definitions of C library macros and functions 260 * Use local definitions of C library macros and functions
266 * NOTE: The function implementations may not be as efficient 261 * NOTE: The function implementations may not be as efficient
267 * as an inline or assembly code implementation provided by a 262 * as an inline or assembly code implementation provided by a
@@ -278,14 +273,12 @@ typedef char *va_list;
278/* 273/*
279 * Storage alignment properties 274 * Storage alignment properties
280 */ 275 */
281
282#define _AUPBND (sizeof (acpi_native_int) - 1) 276#define _AUPBND (sizeof (acpi_native_int) - 1)
283#define _ADNBND (sizeof (acpi_native_int) - 1) 277#define _ADNBND (sizeof (acpi_native_int) - 1)
284 278
285/* 279/*
286 * Variable argument list macro definitions 280 * Variable argument list macro definitions
287 */ 281 */
288
289#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd))) 282#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
290#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND)))) 283#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND))))
291#define va_end(ap) (void) 0 284#define va_end(ap) (void) 0
@@ -296,11 +289,6 @@ typedef char *va_list;
296 289
297#define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2)) 290#define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2))
298#define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c)) 291#define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c))
299
300#ifdef ACPI_FUTURE_USAGE
301#define ACPI_STRUPR(s) (void) acpi_ut_strupr ((s))
302#endif
303
304#define ACPI_STRLEN(s) (acpi_size) acpi_ut_strlen ((s)) 292#define ACPI_STRLEN(s) (acpi_size) acpi_ut_strlen ((s))
305#define ACPI_STRCPY(d,s) (void) acpi_ut_strcpy ((d), (s)) 293#define ACPI_STRCPY(d,s) (void) acpi_ut_strcpy ((d), (s))
306#define ACPI_STRNCPY(d,s,n) (void) acpi_ut_strncpy ((d), (s), (acpi_size)(n)) 294#define ACPI_STRNCPY(d,s,n) (void) acpi_ut_strncpy ((d), (s), (acpi_size)(n))