aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/parser/psargs.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/parser/psargs.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/parser/psargs.c')
-rw-r--r--drivers/acpi/parser/psargs.c376
1 files changed, 167 insertions, 209 deletions
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c
index b7ac68cc9e1c..5858188f94a6 100644
--- a/drivers/acpi/parser/psargs.c
+++ b/drivers/acpi/parser/psargs.c
@@ -41,25 +41,20 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acparser.h> 45#include <acpi/acparser.h>
47#include <acpi/amlcode.h> 46#include <acpi/amlcode.h>
48#include <acpi/acnamesp.h> 47#include <acpi/acnamesp.h>
49 48
50#define _COMPONENT ACPI_PARSER 49#define _COMPONENT ACPI_PARSER
51 ACPI_MODULE_NAME ("psargs") 50ACPI_MODULE_NAME("psargs")
52 51
53/* Local prototypes */ 52/* Local prototypes */
54
55static u32 53static u32
56acpi_ps_get_next_package_length ( 54acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state);
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 55
56static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
57 *parser_state);
63 58
64/******************************************************************************* 59/*******************************************************************************
65 * 60 *
@@ -75,49 +70,43 @@ acpi_ps_get_next_field (
75 ******************************************************************************/ 70 ******************************************************************************/
76 71
77static u32 72static u32
78acpi_ps_get_next_package_length ( 73acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
79 struct acpi_parse_state *parser_state)
80{ 74{
81 u32 encoded_length; 75 u32 encoded_length;
82 u32 length = 0; 76 u32 length = 0;
83 77
78 ACPI_FUNCTION_TRACE("ps_get_next_package_length");
84 79
85 ACPI_FUNCTION_TRACE ("ps_get_next_package_length"); 80 encoded_length = (u32) ACPI_GET8(parser_state->aml);
86
87
88 encoded_length = (u32) ACPI_GET8 (parser_state->aml);
89 parser_state->aml++; 81 parser_state->aml++;
90 82
91 switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ { 83 switch (encoded_length >> 6) { /* bits 6-7 contain encoding scheme */
92 case 0: /* 1-byte encoding (bits 0-5) */ 84 case 0: /* 1-byte encoding (bits 0-5) */
93 85
94 length = (encoded_length & 0x3F); 86 length = (encoded_length & 0x3F);
95 break; 87 break;
96 88
89 case 1: /* 2-byte encoding (next byte + bits 0-3) */
97 90
98 case 1: /* 2-byte encoding (next byte + bits 0-3) */ 91 length = ((ACPI_GET8(parser_state->aml) << 04) |
99 92 (encoded_length & 0x0F));
100 length = ((ACPI_GET8 (parser_state->aml) << 04) |
101 (encoded_length & 0x0F));
102 parser_state->aml++; 93 parser_state->aml++;
103 break; 94 break;
104 95
96 case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */
105 97
106 case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */ 98 length = ((ACPI_GET8(parser_state->aml + 1) << 12) |
107 99 (ACPI_GET8(parser_state->aml) << 04) |
108 length = ((ACPI_GET8 (parser_state->aml + 1) << 12) | 100 (encoded_length & 0x0F));
109 (ACPI_GET8 (parser_state->aml) << 04) |
110 (encoded_length & 0x0F));
111 parser_state->aml += 2; 101 parser_state->aml += 2;
112 break; 102 break;
113 103
104 case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */
114 105
115 case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */ 106 length = ((ACPI_GET8(parser_state->aml + 2) << 20) |
116 107 (ACPI_GET8(parser_state->aml + 1) << 12) |
117 length = ((ACPI_GET8 (parser_state->aml + 2) << 20) | 108 (ACPI_GET8(parser_state->aml) << 04) |
118 (ACPI_GET8 (parser_state->aml + 1) << 12) | 109 (encoded_length & 0x0F));
119 (ACPI_GET8 (parser_state->aml) << 04) |
120 (encoded_length & 0x0F));
121 parser_state->aml += 3; 110 parser_state->aml += 3;
122 break; 111 break;
123 112
@@ -127,10 +116,9 @@ acpi_ps_get_next_package_length (
127 break; 116 break;
128 } 117 }
129 118
130 return_VALUE (length); 119 return_VALUE(length);
131} 120}
132 121
133
134/******************************************************************************* 122/*******************************************************************************
135 * 123 *
136 * FUNCTION: acpi_ps_get_next_package_end 124 * FUNCTION: acpi_ps_get_next_package_end
@@ -144,25 +132,21 @@ acpi_ps_get_next_package_length (
144 * 132 *
145 ******************************************************************************/ 133 ******************************************************************************/
146 134
147u8 * 135u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state)
148acpi_ps_get_next_package_end (
149 struct acpi_parse_state *parser_state)
150{ 136{
151 u8 *start = parser_state->aml; 137 u8 *start = parser_state->aml;
152 acpi_native_uint length; 138 acpi_native_uint length;
153
154
155 ACPI_FUNCTION_TRACE ("ps_get_next_package_end");
156 139
140 ACPI_FUNCTION_TRACE("ps_get_next_package_end");
157 141
158 /* Function below changes parser_state->Aml */ 142 /* Function below changes parser_state->Aml */
159 143
160 length = (acpi_native_uint) acpi_ps_get_next_package_length (parser_state); 144 length =
145 (acpi_native_uint) acpi_ps_get_next_package_length(parser_state);
161 146
162 return_PTR (start + length); /* end of package */ 147 return_PTR(start + length); /* end of package */
163} 148}
164 149
165
166/******************************************************************************* 150/*******************************************************************************
167 * 151 *
168 * FUNCTION: acpi_ps_get_next_namestring 152 * FUNCTION: acpi_ps_get_next_namestring
@@ -178,20 +162,16 @@ acpi_ps_get_next_package_end (
178 * 162 *
179 ******************************************************************************/ 163 ******************************************************************************/
180 164
181char * 165char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
182acpi_ps_get_next_namestring (
183 struct acpi_parse_state *parser_state)
184{ 166{
185 u8 *start = parser_state->aml; 167 u8 *start = parser_state->aml;
186 u8 *end = parser_state->aml; 168 u8 *end = parser_state->aml;
187
188
189 ACPI_FUNCTION_TRACE ("ps_get_next_namestring");
190 169
170 ACPI_FUNCTION_TRACE("ps_get_next_namestring");
191 171
192 /* Handle multiple prefix characters */ 172 /* Handle multiple prefix characters */
193 173
194 while (acpi_ps_is_prefix_char (ACPI_GET8 (end))) { 174 while (acpi_ps_is_prefix_char(ACPI_GET8(end))) {
195 /* Include prefix '\\' or '^' */ 175 /* Include prefix '\\' or '^' */
196 176
197 end++; 177 end++;
@@ -199,7 +179,7 @@ acpi_ps_get_next_namestring (
199 179
200 /* Decode the path */ 180 /* Decode the path */
201 181
202 switch (ACPI_GET8 (end)) { 182 switch (ACPI_GET8(end)) {
203 case 0: 183 case 0:
204 184
205 /* null_name */ 185 /* null_name */
@@ -221,7 +201,7 @@ acpi_ps_get_next_namestring (
221 201
222 /* Multiple name segments, 4 chars each */ 202 /* Multiple name segments, 4 chars each */
223 203
224 end += 2 + ((acpi_size) ACPI_GET8 (end + 1) * ACPI_NAME_SIZE); 204 end += 2 + ((acpi_size) ACPI_GET8(end + 1) * ACPI_NAME_SIZE);
225 break; 205 break;
226 206
227 default: 207 default:
@@ -232,11 +212,10 @@ acpi_ps_get_next_namestring (
232 break; 212 break;
233 } 213 }
234 214
235 parser_state->aml = (u8*) end; 215 parser_state->aml = (u8 *) end;
236 return_PTR ((char *) start); 216 return_PTR((char *)start);
237} 217}
238 218
239
240/******************************************************************************* 219/*******************************************************************************
241 * 220 *
242 * FUNCTION: acpi_ps_get_next_namepath 221 * FUNCTION: acpi_ps_get_next_namepath
@@ -259,24 +238,20 @@ acpi_ps_get_next_namestring (
259 ******************************************************************************/ 238 ******************************************************************************/
260 239
261acpi_status 240acpi_status
262acpi_ps_get_next_namepath ( 241acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
263 struct acpi_walk_state *walk_state, 242 struct acpi_parse_state *parser_state,
264 struct acpi_parse_state *parser_state, 243 union acpi_parse_object *arg, u8 method_call)
265 union acpi_parse_object *arg,
266 u8 method_call)
267{ 244{
268 char *path; 245 char *path;
269 union acpi_parse_object *name_op; 246 union acpi_parse_object *name_op;
270 acpi_status status = AE_OK; 247 acpi_status status = AE_OK;
271 union acpi_operand_object *method_desc; 248 union acpi_operand_object *method_desc;
272 struct acpi_namespace_node *node; 249 struct acpi_namespace_node *node;
273 union acpi_generic_state scope_info; 250 union acpi_generic_state scope_info;
274 251
252 ACPI_FUNCTION_TRACE("ps_get_next_namepath");
275 253
276 ACPI_FUNCTION_TRACE ("ps_get_next_namepath"); 254 path = acpi_ps_get_next_namestring(parser_state);
277
278
279 path = acpi_ps_get_next_namestring (parser_state);
280 255
281 /* Null path case is allowed */ 256 /* Null path case is allowed */
282 257
@@ -296,49 +271,50 @@ acpi_ps_get_next_namepath (
296 * parent tree, but don't open a new scope -- we just want to lookup the 271 * parent tree, but don't open a new scope -- we just want to lookup the
297 * object (MUST BE mode EXECUTE to perform upsearch) 272 * object (MUST BE mode EXECUTE to perform upsearch)
298 */ 273 */
299 status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, 274 status = acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY,
300 ACPI_IMODE_EXECUTE, 275 ACPI_IMODE_EXECUTE,
301 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, 276 ACPI_NS_SEARCH_PARENT |
302 NULL, &node); 277 ACPI_NS_DONT_OPEN_SCOPE, NULL, &node);
303 if (ACPI_SUCCESS (status) && method_call) { 278 if (ACPI_SUCCESS(status) && method_call) {
304 if (node->type == ACPI_TYPE_METHOD) { 279 if (node->type == ACPI_TYPE_METHOD) {
305 /* This name is actually a control method invocation */ 280 /* This name is actually a control method invocation */
306 281
307 method_desc = acpi_ns_get_attached_object (node); 282 method_desc = acpi_ns_get_attached_object(node);
308 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, 283 ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
309 "Control Method - %p Desc %p Path=%p\n", 284 "Control Method - %p Desc %p Path=%p\n",
310 node, method_desc, path)); 285 node, method_desc, path));
311 286
312 name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP); 287 name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
313 if (!name_op) { 288 if (!name_op) {
314 return_ACPI_STATUS (AE_NO_MEMORY); 289 return_ACPI_STATUS(AE_NO_MEMORY);
315 } 290 }
316 291
317 /* Change arg into a METHOD CALL and attach name to it */ 292 /* Change arg into a METHOD CALL and attach name to it */
318 293
319 acpi_ps_init_op (arg, AML_INT_METHODCALL_OP); 294 acpi_ps_init_op(arg, AML_INT_METHODCALL_OP);
320 name_op->common.value.name = path; 295 name_op->common.value.name = path;
321 296
322 /* Point METHODCALL/NAME to the METHOD Node */ 297 /* Point METHODCALL/NAME to the METHOD Node */
323 298
324 name_op->common.node = node; 299 name_op->common.node = node;
325 acpi_ps_append_arg (arg, name_op); 300 acpi_ps_append_arg(arg, name_op);
326 301
327 if (!method_desc) { 302 if (!method_desc) {
328 ACPI_REPORT_ERROR (( 303 ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node));
329 "ps_get_next_namepath: Control Method %p has no attached object\n", 304 return_ACPI_STATUS(AE_AML_INTERNAL);
330 node));
331 return_ACPI_STATUS (AE_AML_INTERNAL);
332 } 305 }
333 306
334 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, 307 ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
335 "Control Method - %p Args %X\n", 308 "Control Method - %p Args %X\n",
336 node, method_desc->method.param_count)); 309 node,
310 method_desc->method.
311 param_count));
337 312
338 /* Get the number of arguments to expect */ 313 /* Get the number of arguments to expect */
339 314
340 walk_state->arg_count = method_desc->method.param_count; 315 walk_state->arg_count =
341 return_ACPI_STATUS (AE_OK); 316 method_desc->method.param_count;
317 return_ACPI_STATUS(AE_OK);
342 } 318 }
343 319
344 /* 320 /*
@@ -348,25 +324,26 @@ acpi_ps_get_next_namepath (
348 */ 324 */
349 } 325 }
350 326
351 if (ACPI_FAILURE (status)) { 327 if (ACPI_FAILURE(status)) {
352 /* 328 /*
353 * 1) Any error other than NOT_FOUND is always severe 329 * 1) Any error other than NOT_FOUND is always severe
354 * 2) NOT_FOUND is only important if we are executing a method. 330 * 2) NOT_FOUND is only important if we are executing a method.
355 * 3) If executing a cond_ref_of opcode, NOT_FOUND is ok. 331 * 3) If executing a cond_ref_of opcode, NOT_FOUND is ok.
356 */ 332 */
357 if ((((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) && 333 if ((((walk_state->
358 (status == AE_NOT_FOUND) && 334 parse_flags & ACPI_PARSE_MODE_MASK) ==
359 (walk_state->op->common.aml_opcode != AML_COND_REF_OF_OP)) || 335 ACPI_PARSE_EXECUTE) && (status == AE_NOT_FOUND)
360 336 && (walk_state->op->common.aml_opcode !=
361 (status != AE_NOT_FOUND)) { 337 AML_COND_REF_OF_OP))
362 ACPI_REPORT_NSERROR (path, status); 338 || (status != AE_NOT_FOUND)) {
363 339 ACPI_REPORT_NSERROR(path, status);
364 acpi_os_printf ("search_node %p start_node %p return_node %p\n", 340
365 scope_info.scope.node, parser_state->start_node, node); 341 acpi_os_printf
366 342 ("search_node %p start_node %p return_node %p\n",
367 343 scope_info.scope.node,
368 } 344 parser_state->start_node, node);
369 else { 345
346 } else {
370 /* 347 /*
371 * We got a NOT_FOUND during table load or we encountered 348 * We got a NOT_FOUND during table load or we encountered
372 * a cond_ref_of(x) where the target does not exist. 349 * a cond_ref_of(x) where the target does not exist.
@@ -381,13 +358,12 @@ acpi_ps_get_next_namepath (
381 * Regardless of success/failure above, 358 * Regardless of success/failure above,
382 * Just initialize the Op with the pathname. 359 * Just initialize the Op with the pathname.
383 */ 360 */
384 acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP); 361 acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
385 arg->common.value.name = path; 362 arg->common.value.name = path;
386 363
387 return_ACPI_STATUS (status); 364 return_ACPI_STATUS(status);
388} 365}
389 366
390
391/******************************************************************************* 367/*******************************************************************************
392 * 368 *
393 * FUNCTION: acpi_ps_get_next_simple_arg 369 * FUNCTION: acpi_ps_get_next_simple_arg
@@ -403,87 +379,81 @@ acpi_ps_get_next_namepath (
403 ******************************************************************************/ 379 ******************************************************************************/
404 380
405void 381void
406acpi_ps_get_next_simple_arg ( 382acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
407 struct acpi_parse_state *parser_state, 383 u32 arg_type, union acpi_parse_object *arg)
408 u32 arg_type,
409 union acpi_parse_object *arg)
410{ 384{
411 385
412 ACPI_FUNCTION_TRACE_U32 ("ps_get_next_simple_arg", arg_type); 386 ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type);
413
414 387
415 switch (arg_type) { 388 switch (arg_type) {
416 case ARGP_BYTEDATA: 389 case ARGP_BYTEDATA:
417 390
418 acpi_ps_init_op (arg, AML_BYTE_OP); 391 acpi_ps_init_op(arg, AML_BYTE_OP);
419 arg->common.value.integer = (u32) ACPI_GET8 (parser_state->aml); 392 arg->common.value.integer = (u32) ACPI_GET8(parser_state->aml);
420 parser_state->aml++; 393 parser_state->aml++;
421 break; 394 break;
422 395
423
424 case ARGP_WORDDATA: 396 case ARGP_WORDDATA:
425 397
426 acpi_ps_init_op (arg, AML_WORD_OP); 398 acpi_ps_init_op(arg, AML_WORD_OP);
427 399
428 /* Get 2 bytes from the AML stream */ 400 /* Get 2 bytes from the AML stream */
429 401
430 ACPI_MOVE_16_TO_32 (&arg->common.value.integer, parser_state->aml); 402 ACPI_MOVE_16_TO_32(&arg->common.value.integer,
403 parser_state->aml);
431 parser_state->aml += 2; 404 parser_state->aml += 2;
432 break; 405 break;
433 406
434
435 case ARGP_DWORDDATA: 407 case ARGP_DWORDDATA:
436 408
437 acpi_ps_init_op (arg, AML_DWORD_OP); 409 acpi_ps_init_op(arg, AML_DWORD_OP);
438 410
439 /* Get 4 bytes from the AML stream */ 411 /* Get 4 bytes from the AML stream */
440 412
441 ACPI_MOVE_32_TO_32 (&arg->common.value.integer, parser_state->aml); 413 ACPI_MOVE_32_TO_32(&arg->common.value.integer,
414 parser_state->aml);
442 parser_state->aml += 4; 415 parser_state->aml += 4;
443 break; 416 break;
444 417
445
446 case ARGP_QWORDDATA: 418 case ARGP_QWORDDATA:
447 419
448 acpi_ps_init_op (arg, AML_QWORD_OP); 420 acpi_ps_init_op(arg, AML_QWORD_OP);
449 421
450 /* Get 8 bytes from the AML stream */ 422 /* Get 8 bytes from the AML stream */
451 423
452 ACPI_MOVE_64_TO_64 (&arg->common.value.integer, parser_state->aml); 424 ACPI_MOVE_64_TO_64(&arg->common.value.integer,
425 parser_state->aml);
453 parser_state->aml += 8; 426 parser_state->aml += 8;
454 break; 427 break;
455 428
456
457 case ARGP_CHARLIST: 429 case ARGP_CHARLIST:
458 430
459 acpi_ps_init_op (arg, AML_STRING_OP); 431 acpi_ps_init_op(arg, AML_STRING_OP);
460 arg->common.value.string = (char *) parser_state->aml; 432 arg->common.value.string = (char *)parser_state->aml;
461 433
462 while (ACPI_GET8 (parser_state->aml) != '\0') { 434 while (ACPI_GET8(parser_state->aml) != '\0') {
463 parser_state->aml++; 435 parser_state->aml++;
464 } 436 }
465 parser_state->aml++; 437 parser_state->aml++;
466 break; 438 break;
467 439
468
469 case ARGP_NAME: 440 case ARGP_NAME:
470 case ARGP_NAMESTRING: 441 case ARGP_NAMESTRING:
471 442
472 acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP); 443 acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
473 arg->common.value.name = acpi_ps_get_next_namestring (parser_state); 444 arg->common.value.name =
445 acpi_ps_get_next_namestring(parser_state);
474 break; 446 break;
475 447
476
477 default: 448 default:
478 449
479 ACPI_REPORT_ERROR (("Invalid arg_type %X\n", arg_type)); 450 ACPI_REPORT_ERROR(("Invalid arg_type %X\n", arg_type));
480 break; 451 break;
481 } 452 }
482 453
483 return_VOID; 454 return_VOID;
484} 455}
485 456
486
487/******************************************************************************* 457/*******************************************************************************
488 * 458 *
489 * FUNCTION: acpi_ps_get_next_field 459 * FUNCTION: acpi_ps_get_next_field
@@ -496,24 +466,21 @@ acpi_ps_get_next_simple_arg (
496 * 466 *
497 ******************************************************************************/ 467 ******************************************************************************/
498 468
499static union acpi_parse_object * 469static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
500acpi_ps_get_next_field ( 470 *parser_state)
501 struct acpi_parse_state *parser_state)
502{ 471{
503 u32 aml_offset = (u32) 472 u32 aml_offset = (u32)
504 ACPI_PTR_DIFF (parser_state->aml, 473 ACPI_PTR_DIFF(parser_state->aml,
505 parser_state->aml_start); 474 parser_state->aml_start);
506 union acpi_parse_object *field; 475 union acpi_parse_object *field;
507 u16 opcode; 476 u16 opcode;
508 u32 name; 477 u32 name;
509
510
511 ACPI_FUNCTION_TRACE ("ps_get_next_field");
512 478
479 ACPI_FUNCTION_TRACE("ps_get_next_field");
513 480
514 /* Determine field type */ 481 /* Determine field type */
515 482
516 switch (ACPI_GET8 (parser_state->aml)) { 483 switch (ACPI_GET8(parser_state->aml)) {
517 default: 484 default:
518 485
519 opcode = AML_INT_NAMEDFIELD_OP; 486 opcode = AML_INT_NAMEDFIELD_OP;
@@ -534,9 +501,9 @@ acpi_ps_get_next_field (
534 501
535 /* Allocate a new field op */ 502 /* Allocate a new field op */
536 503
537 field = acpi_ps_alloc_op (opcode); 504 field = acpi_ps_alloc_op(opcode);
538 if (!field) { 505 if (!field) {
539 return_PTR (NULL); 506 return_PTR(NULL);
540 } 507 }
541 508
542 field->common.aml_offset = aml_offset; 509 field->common.aml_offset = aml_offset;
@@ -548,33 +515,34 @@ acpi_ps_get_next_field (
548 515
549 /* Get the 4-character name */ 516 /* Get the 4-character name */
550 517
551 ACPI_MOVE_32_TO_32 (&name, parser_state->aml); 518 ACPI_MOVE_32_TO_32(&name, parser_state->aml);
552 acpi_ps_set_name (field, name); 519 acpi_ps_set_name(field, name);
553 parser_state->aml += ACPI_NAME_SIZE; 520 parser_state->aml += ACPI_NAME_SIZE;
554 521
555 /* Get the length which is encoded as a package length */ 522 /* Get the length which is encoded as a package length */
556 523
557 field->common.value.size = acpi_ps_get_next_package_length (parser_state); 524 field->common.value.size =
525 acpi_ps_get_next_package_length(parser_state);
558 break; 526 break;
559 527
560
561 case AML_INT_RESERVEDFIELD_OP: 528 case AML_INT_RESERVEDFIELD_OP:
562 529
563 /* Get the length which is encoded as a package length */ 530 /* Get the length which is encoded as a package length */
564 531
565 field->common.value.size = acpi_ps_get_next_package_length (parser_state); 532 field->common.value.size =
533 acpi_ps_get_next_package_length(parser_state);
566 break; 534 break;
567 535
568
569 case AML_INT_ACCESSFIELD_OP: 536 case AML_INT_ACCESSFIELD_OP:
570 537
571 /* 538 /*
572 * Get access_type and access_attrib and merge into the field Op 539 * Get access_type and access_attrib and merge into the field Op
573 * access_type is first operand, access_attribute is second 540 * access_type is first operand, access_attribute is second
574 */ 541 */
575 field->common.value.integer = (ACPI_GET8 (parser_state->aml) << 8); 542 field->common.value.integer =
543 (ACPI_GET8(parser_state->aml) << 8);
576 parser_state->aml++; 544 parser_state->aml++;
577 field->common.value.integer |= ACPI_GET8 (parser_state->aml); 545 field->common.value.integer |= ACPI_GET8(parser_state->aml);
578 parser_state->aml++; 546 parser_state->aml++;
579 break; 547 break;
580 548
@@ -584,10 +552,9 @@ acpi_ps_get_next_field (
584 break; 552 break;
585 } 553 }
586 554
587 return_PTR (field); 555 return_PTR(field);
588} 556}
589 557
590
591/******************************************************************************* 558/*******************************************************************************
592 * 559 *
593 * FUNCTION: acpi_ps_get_next_arg 560 * FUNCTION: acpi_ps_get_next_arg
@@ -605,21 +572,17 @@ acpi_ps_get_next_field (
605 ******************************************************************************/ 572 ******************************************************************************/
606 573
607acpi_status 574acpi_status
608acpi_ps_get_next_arg ( 575acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
609 struct acpi_walk_state *walk_state, 576 struct acpi_parse_state *parser_state,
610 struct acpi_parse_state *parser_state, 577 u32 arg_type, union acpi_parse_object **return_arg)
611 u32 arg_type,
612 union acpi_parse_object **return_arg)
613{ 578{
614 union acpi_parse_object *arg = NULL; 579 union acpi_parse_object *arg = NULL;
615 union acpi_parse_object *prev = NULL; 580 union acpi_parse_object *prev = NULL;
616 union acpi_parse_object *field; 581 union acpi_parse_object *field;
617 u32 subop; 582 u32 subop;
618 acpi_status status = AE_OK; 583 acpi_status status = AE_OK;
619
620
621 ACPI_FUNCTION_TRACE_PTR ("ps_get_next_arg", parser_state);
622 584
585 ACPI_FUNCTION_TRACE_PTR("ps_get_next_arg", parser_state);
623 586
624 switch (arg_type) { 587 switch (arg_type) {
625 case ARGP_BYTEDATA: 588 case ARGP_BYTEDATA:
@@ -631,37 +594,35 @@ acpi_ps_get_next_arg (
631 594
632 /* Constants, strings, and namestrings are all the same size */ 595 /* Constants, strings, and namestrings are all the same size */
633 596
634 arg = acpi_ps_alloc_op (AML_BYTE_OP); 597 arg = acpi_ps_alloc_op(AML_BYTE_OP);
635 if (!arg) { 598 if (!arg) {
636 return_ACPI_STATUS (AE_NO_MEMORY); 599 return_ACPI_STATUS(AE_NO_MEMORY);
637 } 600 }
638 acpi_ps_get_next_simple_arg (parser_state, arg_type, arg); 601 acpi_ps_get_next_simple_arg(parser_state, arg_type, arg);
639 break; 602 break;
640 603
641
642 case ARGP_PKGLENGTH: 604 case ARGP_PKGLENGTH:
643 605
644 /* Package length, nothing returned */ 606 /* Package length, nothing returned */
645 607
646 parser_state->pkg_end = acpi_ps_get_next_package_end (parser_state); 608 parser_state->pkg_end =
609 acpi_ps_get_next_package_end(parser_state);
647 break; 610 break;
648 611
649
650 case ARGP_FIELDLIST: 612 case ARGP_FIELDLIST:
651 613
652 if (parser_state->aml < parser_state->pkg_end) { 614 if (parser_state->aml < parser_state->pkg_end) {
653 /* Non-empty list */ 615 /* Non-empty list */
654 616
655 while (parser_state->aml < parser_state->pkg_end) { 617 while (parser_state->aml < parser_state->pkg_end) {
656 field = acpi_ps_get_next_field (parser_state); 618 field = acpi_ps_get_next_field(parser_state);
657 if (!field) { 619 if (!field) {
658 return_ACPI_STATUS (AE_NO_MEMORY); 620 return_ACPI_STATUS(AE_NO_MEMORY);
659 } 621 }
660 622
661 if (prev) { 623 if (prev) {
662 prev->common.next = field; 624 prev->common.next = field;
663 } 625 } else {
664 else {
665 arg = field; 626 arg = field;
666 } 627 }
667 prev = field; 628 prev = field;
@@ -673,21 +634,21 @@ acpi_ps_get_next_arg (
673 } 634 }
674 break; 635 break;
675 636
676
677 case ARGP_BYTELIST: 637 case ARGP_BYTELIST:
678 638
679 if (parser_state->aml < parser_state->pkg_end) { 639 if (parser_state->aml < parser_state->pkg_end) {
680 /* Non-empty list */ 640 /* Non-empty list */
681 641
682 arg = acpi_ps_alloc_op (AML_INT_BYTELIST_OP); 642 arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
683 if (!arg) { 643 if (!arg) {
684 return_ACPI_STATUS (AE_NO_MEMORY); 644 return_ACPI_STATUS(AE_NO_MEMORY);
685 } 645 }
686 646
687 /* Fill in bytelist data */ 647 /* Fill in bytelist data */
688 648
689 arg->common.value.size = (u32) 649 arg->common.value.size = (u32)
690 ACPI_PTR_DIFF (parser_state->pkg_end, parser_state->aml); 650 ACPI_PTR_DIFF(parser_state->pkg_end,
651 parser_state->aml);
691 arg->named.data = parser_state->aml; 652 arg->named.data = parser_state->aml;
692 653
693 /* Skip to End of byte data */ 654 /* Skip to End of byte data */
@@ -696,32 +657,31 @@ acpi_ps_get_next_arg (
696 } 657 }
697 break; 658 break;
698 659
699
700 case ARGP_TARGET: 660 case ARGP_TARGET:
701 case ARGP_SUPERNAME: 661 case ARGP_SUPERNAME:
702 case ARGP_SIMPLENAME: 662 case ARGP_SIMPLENAME:
703 663
704 subop = acpi_ps_peek_opcode (parser_state); 664 subop = acpi_ps_peek_opcode(parser_state);
705 if (subop == 0 || 665 if (subop == 0 ||
706 acpi_ps_is_leading_char (subop) || 666 acpi_ps_is_leading_char(subop) ||
707 acpi_ps_is_prefix_char (subop)) { 667 acpi_ps_is_prefix_char(subop)) {
708 /* null_name or name_string */ 668 /* null_name or name_string */
709 669
710 arg = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP); 670 arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
711 if (!arg) { 671 if (!arg) {
712 return_ACPI_STATUS (AE_NO_MEMORY); 672 return_ACPI_STATUS(AE_NO_MEMORY);
713 } 673 }
714 674
715 status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0); 675 status =
716 } 676 acpi_ps_get_next_namepath(walk_state, parser_state,
717 else { 677 arg, 0);
678 } else {
718 /* Single complex argument, nothing returned */ 679 /* Single complex argument, nothing returned */
719 680
720 walk_state->arg_count = 1; 681 walk_state->arg_count = 1;
721 } 682 }
722 break; 683 break;
723 684
724
725 case ARGP_DATAOBJ: 685 case ARGP_DATAOBJ:
726 case ARGP_TERMARG: 686 case ARGP_TERMARG:
727 687
@@ -730,7 +690,6 @@ acpi_ps_get_next_arg (
730 walk_state->arg_count = 1; 690 walk_state->arg_count = 1;
731 break; 691 break;
732 692
733
734 case ARGP_DATAOBJLIST: 693 case ARGP_DATAOBJLIST:
735 case ARGP_TERMLIST: 694 case ARGP_TERMLIST:
736 case ARGP_OBJLIST: 695 case ARGP_OBJLIST:
@@ -742,14 +701,13 @@ acpi_ps_get_next_arg (
742 } 701 }
743 break; 702 break;
744 703
745
746 default: 704 default:
747 705
748 ACPI_REPORT_ERROR (("Invalid arg_type: %X\n", arg_type)); 706 ACPI_REPORT_ERROR(("Invalid arg_type: %X\n", arg_type));
749 status = AE_AML_OPERAND_TYPE; 707 status = AE_AML_OPERAND_TYPE;
750 break; 708 break;
751 } 709 }
752 710
753 *return_arg = arg; 711 *return_arg = arg;
754 return_ACPI_STATUS (status); 712 return_ACPI_STATUS(status);
755} 713}