aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/uteval.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities/uteval.c')
-rw-r--r--drivers/acpi/utilities/uteval.c396
1 files changed, 179 insertions, 217 deletions
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c
index 00046dd5d925..7b81d5ef3c32 100644
--- a/drivers/acpi/utilities/uteval.c
+++ b/drivers/acpi/utilities/uteval.c
@@ -41,28 +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/acnamesp.h> 45#include <acpi/acnamesp.h>
47#include <acpi/acinterp.h> 46#include <acpi/acinterp.h>
48 47
49
50#define _COMPONENT ACPI_UTILITIES 48#define _COMPONENT ACPI_UTILITIES
51 ACPI_MODULE_NAME ("uteval") 49ACPI_MODULE_NAME("uteval")
52 50
53/* Local prototypes */ 51/* Local prototypes */
54
55static void 52static void
56acpi_ut_copy_id_string ( 53acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length);
57 char *destination,
58 char *source,
59 acpi_size max_length);
60 54
61static acpi_status 55static acpi_status
62acpi_ut_translate_one_cid ( 56acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
63 union acpi_operand_object *obj_desc, 57 struct acpi_compatible_id *one_cid);
64 struct acpi_compatible_id *one_cid);
65
66 58
67/******************************************************************************* 59/*******************************************************************************
68 * 60 *
@@ -77,37 +69,33 @@ acpi_ut_translate_one_cid (
77 * 69 *
78 ******************************************************************************/ 70 ******************************************************************************/
79 71
80acpi_status 72acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
81acpi_ut_osi_implementation (
82 struct acpi_walk_state *walk_state)
83{ 73{
84 union acpi_operand_object *string_desc; 74 union acpi_operand_object *string_desc;
85 union acpi_operand_object *return_desc; 75 union acpi_operand_object *return_desc;
86 acpi_native_uint i; 76 acpi_native_uint i;
87
88
89 ACPI_FUNCTION_TRACE ("ut_osi_implementation");
90 77
78 ACPI_FUNCTION_TRACE("ut_osi_implementation");
91 79
92 /* Validate the string input argument */ 80 /* Validate the string input argument */
93 81
94 string_desc = walk_state->arguments[0].object; 82 string_desc = walk_state->arguments[0].object;
95 if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) { 83 if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) {
96 return_ACPI_STATUS (AE_TYPE); 84 return_ACPI_STATUS(AE_TYPE);
97 } 85 }
98 86
99 /* Create a return object (Default value = 0) */ 87 /* Create a return object (Default value = 0) */
100 88
101 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 89 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
102 if (!return_desc) { 90 if (!return_desc) {
103 return_ACPI_STATUS (AE_NO_MEMORY); 91 return_ACPI_STATUS(AE_NO_MEMORY);
104 } 92 }
105 93
106 /* Compare input string to table of supported strings */ 94 /* Compare input string to table of supported strings */
107 95
108 for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { 96 for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) {
109 if (!ACPI_STRCMP (string_desc->string.pointer, 97 if (!ACPI_STRCMP(string_desc->string.pointer,
110 (char *) acpi_gbl_valid_osi_strings[i])) { 98 (char *)acpi_gbl_valid_osi_strings[i])) {
111 /* This string is supported */ 99 /* This string is supported */
112 100
113 return_desc->integer.value = 0xFFFFFFFF; 101 return_desc->integer.value = 0xFFFFFFFF;
@@ -116,10 +104,9 @@ acpi_ut_osi_implementation (
116 } 104 }
117 105
118 walk_state->return_desc = return_desc; 106 walk_state->return_desc = return_desc;
119 return_ACPI_STATUS (AE_CTRL_TERMINATE); 107 return_ACPI_STATUS(AE_CTRL_TERMINATE);
120} 108}
121 109
122
123/******************************************************************************* 110/*******************************************************************************
124 * 111 *
125 * FUNCTION: acpi_ut_evaluate_object 112 * FUNCTION: acpi_ut_evaluate_object
@@ -140,19 +127,16 @@ acpi_ut_osi_implementation (
140 ******************************************************************************/ 127 ******************************************************************************/
141 128
142acpi_status 129acpi_status
143acpi_ut_evaluate_object ( 130acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
144 struct acpi_namespace_node *prefix_node, 131 char *path,
145 char *path, 132 u32 expected_return_btypes,
146 u32 expected_return_btypes, 133 union acpi_operand_object **return_desc)
147 union acpi_operand_object **return_desc)
148{ 134{
149 struct acpi_parameter_info info; 135 struct acpi_parameter_info info;
150 acpi_status status; 136 acpi_status status;
151 u32 return_btype; 137 u32 return_btype;
152
153
154 ACPI_FUNCTION_TRACE ("ut_evaluate_object");
155 138
139 ACPI_FUNCTION_TRACE("ut_evaluate_object");
156 140
157 info.node = prefix_node; 141 info.node = prefix_node;
158 info.parameters = NULL; 142 info.parameters = NULL;
@@ -160,36 +144,38 @@ acpi_ut_evaluate_object (
160 144
161 /* Evaluate the object/method */ 145 /* Evaluate the object/method */
162 146
163 status = acpi_ns_evaluate_relative (path, &info); 147 status = acpi_ns_evaluate_relative(path, &info);
164 if (ACPI_FAILURE (status)) { 148 if (ACPI_FAILURE(status)) {
165 if (status == AE_NOT_FOUND) { 149 if (status == AE_NOT_FOUND) {
166 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s.%s] was not found\n", 150 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
167 acpi_ut_get_node_name (prefix_node), path)); 151 "[%4.4s.%s] was not found\n",
168 } 152 acpi_ut_get_node_name(prefix_node),
169 else { 153 path));
170 ACPI_REPORT_METHOD_ERROR ("Method execution failed", 154 } else {
171 prefix_node, path, status); 155 ACPI_REPORT_METHOD_ERROR("Method execution failed",
156 prefix_node, path, status);
172 } 157 }
173 158
174 return_ACPI_STATUS (status); 159 return_ACPI_STATUS(status);
175 } 160 }
176 161
177 /* Did we get a return object? */ 162 /* Did we get a return object? */
178 163
179 if (!info.return_object) { 164 if (!info.return_object) {
180 if (expected_return_btypes) { 165 if (expected_return_btypes) {
181 ACPI_REPORT_METHOD_ERROR ("No object was returned from", 166 ACPI_REPORT_METHOD_ERROR("No object was returned from",
182 prefix_node, path, AE_NOT_EXIST); 167 prefix_node, path,
168 AE_NOT_EXIST);
183 169
184 return_ACPI_STATUS (AE_NOT_EXIST); 170 return_ACPI_STATUS(AE_NOT_EXIST);
185 } 171 }
186 172
187 return_ACPI_STATUS (AE_OK); 173 return_ACPI_STATUS(AE_OK);
188 } 174 }
189 175
190 /* Map the return object type to the bitmapped type */ 176 /* Map the return object type to the bitmapped type */
191 177
192 switch (ACPI_GET_OBJECT_TYPE (info.return_object)) { 178 switch (ACPI_GET_OBJECT_TYPE(info.return_object)) {
193 case ACPI_TYPE_INTEGER: 179 case ACPI_TYPE_INTEGER:
194 return_btype = ACPI_BTYPE_INTEGER; 180 return_btype = ACPI_BTYPE_INTEGER;
195 break; 181 break;
@@ -211,41 +197,41 @@ acpi_ut_evaluate_object (
211 break; 197 break;
212 } 198 }
213 199
214 if ((acpi_gbl_enable_interpreter_slack) && 200 if ((acpi_gbl_enable_interpreter_slack) && (!expected_return_btypes)) {
215 (!expected_return_btypes)) {
216 /* 201 /*
217 * We received a return object, but one was not expected. This can 202 * We received a return object, but one was not expected. This can
218 * happen frequently if the "implicit return" feature is enabled. 203 * happen frequently if the "implicit return" feature is enabled.
219 * Just delete the return object and return AE_OK. 204 * Just delete the return object and return AE_OK.
220 */ 205 */
221 acpi_ut_remove_reference (info.return_object); 206 acpi_ut_remove_reference(info.return_object);
222 return_ACPI_STATUS (AE_OK); 207 return_ACPI_STATUS(AE_OK);
223 } 208 }
224 209
225 /* Is the return object one of the expected types? */ 210 /* Is the return object one of the expected types? */
226 211
227 if (!(expected_return_btypes & return_btype)) { 212 if (!(expected_return_btypes & return_btype)) {
228 ACPI_REPORT_METHOD_ERROR ("Return object type is incorrect", 213 ACPI_REPORT_METHOD_ERROR("Return object type is incorrect",
229 prefix_node, path, AE_TYPE); 214 prefix_node, path, AE_TYPE);
230 215
231 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 216 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
232 "Type returned from %s was incorrect: %s, expected Btypes: %X\n", 217 "Type returned from %s was incorrect: %s, expected Btypes: %X\n",
233 path, acpi_ut_get_object_type_name (info.return_object), 218 path,
234 expected_return_btypes)); 219 acpi_ut_get_object_type_name(info.
220 return_object),
221 expected_return_btypes));
235 222
236 /* On error exit, we must delete the return object */ 223 /* On error exit, we must delete the return object */
237 224
238 acpi_ut_remove_reference (info.return_object); 225 acpi_ut_remove_reference(info.return_object);
239 return_ACPI_STATUS (AE_TYPE); 226 return_ACPI_STATUS(AE_TYPE);
240 } 227 }
241 228
242 /* Object type is OK, return it */ 229 /* Object type is OK, return it */
243 230
244 *return_desc = info.return_object; 231 *return_desc = info.return_object;
245 return_ACPI_STATUS (AE_OK); 232 return_ACPI_STATUS(AE_OK);
246} 233}
247 234
248
249/******************************************************************************* 235/*******************************************************************************
250 * 236 *
251 * FUNCTION: acpi_ut_evaluate_numeric_object 237 * FUNCTION: acpi_ut_evaluate_numeric_object
@@ -264,22 +250,19 @@ acpi_ut_evaluate_object (
264 ******************************************************************************/ 250 ******************************************************************************/
265 251
266acpi_status 252acpi_status
267acpi_ut_evaluate_numeric_object ( 253acpi_ut_evaluate_numeric_object(char *object_name,
268 char *object_name, 254 struct acpi_namespace_node *device_node,
269 struct acpi_namespace_node *device_node, 255 acpi_integer * address)
270 acpi_integer *address)
271{ 256{
272 union acpi_operand_object *obj_desc; 257 union acpi_operand_object *obj_desc;
273 acpi_status status; 258 acpi_status status;
274
275 259
276 ACPI_FUNCTION_TRACE ("ut_evaluate_numeric_object"); 260 ACPI_FUNCTION_TRACE("ut_evaluate_numeric_object");
277 261
278 262 status = acpi_ut_evaluate_object(device_node, object_name,
279 status = acpi_ut_evaluate_object (device_node, object_name, 263 ACPI_BTYPE_INTEGER, &obj_desc);
280 ACPI_BTYPE_INTEGER, &obj_desc); 264 if (ACPI_FAILURE(status)) {
281 if (ACPI_FAILURE (status)) { 265 return_ACPI_STATUS(status);
282 return_ACPI_STATUS (status);
283 } 266 }
284 267
285 /* Get the returned Integer */ 268 /* Get the returned Integer */
@@ -288,11 +271,10 @@ acpi_ut_evaluate_numeric_object (
288 271
289 /* On exit, we must delete the return object */ 272 /* On exit, we must delete the return object */
290 273
291 acpi_ut_remove_reference (obj_desc); 274 acpi_ut_remove_reference(obj_desc);
292 return_ACPI_STATUS (status); 275 return_ACPI_STATUS(status);
293} 276}
294 277
295
296/******************************************************************************* 278/*******************************************************************************
297 * 279 *
298 * FUNCTION: acpi_ut_copy_id_string 280 * FUNCTION: acpi_ut_copy_id_string
@@ -310,10 +292,7 @@ acpi_ut_evaluate_numeric_object (
310 ******************************************************************************/ 292 ******************************************************************************/
311 293
312static void 294static void
313acpi_ut_copy_id_string ( 295acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length)
314 char *destination,
315 char *source,
316 acpi_size max_length)
317{ 296{
318 297
319 /* 298 /*
@@ -328,10 +307,9 @@ acpi_ut_copy_id_string (
328 307
329 /* Do the actual copy */ 308 /* Do the actual copy */
330 309
331 ACPI_STRNCPY (destination, source, max_length); 310 ACPI_STRNCPY(destination, source, max_length);
332} 311}
333 312
334
335/******************************************************************************* 313/*******************************************************************************
336 * 314 *
337 * FUNCTION: acpi_ut_execute_HID 315 * FUNCTION: acpi_ut_execute_HID
@@ -349,42 +327,39 @@ acpi_ut_copy_id_string (
349 ******************************************************************************/ 327 ******************************************************************************/
350 328
351acpi_status 329acpi_status
352acpi_ut_execute_HID ( 330acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
353 struct acpi_namespace_node *device_node, 331 struct acpi_device_id *hid)
354 struct acpi_device_id *hid)
355{ 332{
356 union acpi_operand_object *obj_desc; 333 union acpi_operand_object *obj_desc;
357 acpi_status status; 334 acpi_status status;
358
359 335
360 ACPI_FUNCTION_TRACE ("ut_execute_HID"); 336 ACPI_FUNCTION_TRACE("ut_execute_HID");
361 337
362 338 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID,
363 status = acpi_ut_evaluate_object (device_node, METHOD_NAME__HID, 339 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
364 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &obj_desc); 340 &obj_desc);
365 if (ACPI_FAILURE (status)) { 341 if (ACPI_FAILURE(status)) {
366 return_ACPI_STATUS (status); 342 return_ACPI_STATUS(status);
367 } 343 }
368 344
369 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { 345 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
370 /* Convert the Numeric HID to string */ 346 /* Convert the Numeric HID to string */
371 347
372 acpi_ex_eisa_id_to_string ((u32) obj_desc->integer.value, hid->value); 348 acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
373 } 349 hid->value);
374 else { 350 } else {
375 /* Copy the String HID from the returned object */ 351 /* Copy the String HID from the returned object */
376 352
377 acpi_ut_copy_id_string (hid->value, obj_desc->string.pointer, 353 acpi_ut_copy_id_string(hid->value, obj_desc->string.pointer,
378 sizeof (hid->value)); 354 sizeof(hid->value));
379 } 355 }
380 356
381 /* On exit, we must delete the return object */ 357 /* On exit, we must delete the return object */
382 358
383 acpi_ut_remove_reference (obj_desc); 359 acpi_ut_remove_reference(obj_desc);
384 return_ACPI_STATUS (status); 360 return_ACPI_STATUS(status);
385} 361}
386 362
387
388/******************************************************************************* 363/*******************************************************************************
389 * 364 *
390 * FUNCTION: acpi_ut_translate_one_cid 365 * FUNCTION: acpi_ut_translate_one_cid
@@ -403,18 +378,17 @@ acpi_ut_execute_HID (
403 ******************************************************************************/ 378 ******************************************************************************/
404 379
405static acpi_status 380static acpi_status
406acpi_ut_translate_one_cid ( 381acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
407 union acpi_operand_object *obj_desc, 382 struct acpi_compatible_id *one_cid)
408 struct acpi_compatible_id *one_cid)
409{ 383{
410 384
411 385 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
412 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
413 case ACPI_TYPE_INTEGER: 386 case ACPI_TYPE_INTEGER:
414 387
415 /* Convert the Numeric CID to string */ 388 /* Convert the Numeric CID to string */
416 389
417 acpi_ex_eisa_id_to_string ((u32) obj_desc->integer.value, one_cid->value); 390 acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
391 one_cid->value);
418 return (AE_OK); 392 return (AE_OK);
419 393
420 case ACPI_TYPE_STRING: 394 case ACPI_TYPE_STRING:
@@ -425,8 +399,8 @@ acpi_ut_translate_one_cid (
425 399
426 /* Copy the String CID from the returned object */ 400 /* Copy the String CID from the returned object */
427 401
428 acpi_ut_copy_id_string (one_cid->value, obj_desc->string.pointer, 402 acpi_ut_copy_id_string(one_cid->value, obj_desc->string.pointer,
429 ACPI_MAX_CID_LENGTH); 403 ACPI_MAX_CID_LENGTH);
430 return (AE_OK); 404 return (AE_OK);
431 405
432 default: 406 default:
@@ -435,7 +409,6 @@ acpi_ut_translate_one_cid (
435 } 409 }
436} 410}
437 411
438
439/******************************************************************************* 412/*******************************************************************************
440 * 413 *
441 * FUNCTION: acpi_ut_execute_CID 414 * FUNCTION: acpi_ut_execute_CID
@@ -453,45 +426,42 @@ acpi_ut_translate_one_cid (
453 ******************************************************************************/ 426 ******************************************************************************/
454 427
455acpi_status 428acpi_status
456acpi_ut_execute_CID ( 429acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
457 struct acpi_namespace_node *device_node, 430 struct acpi_compatible_id_list ** return_cid_list)
458 struct acpi_compatible_id_list **return_cid_list)
459{ 431{
460 union acpi_operand_object *obj_desc; 432 union acpi_operand_object *obj_desc;
461 acpi_status status; 433 acpi_status status;
462 u32 count; 434 u32 count;
463 u32 size; 435 u32 size;
464 struct acpi_compatible_id_list *cid_list; 436 struct acpi_compatible_id_list *cid_list;
465 acpi_native_uint i; 437 acpi_native_uint i;
466
467
468 ACPI_FUNCTION_TRACE ("ut_execute_CID");
469 438
439 ACPI_FUNCTION_TRACE("ut_execute_CID");
470 440
471 /* Evaluate the _CID method for this device */ 441 /* Evaluate the _CID method for this device */
472 442
473 status = acpi_ut_evaluate_object (device_node, METHOD_NAME__CID, 443 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CID,
474 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, 444 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING
475 &obj_desc); 445 | ACPI_BTYPE_PACKAGE, &obj_desc);
476 if (ACPI_FAILURE (status)) { 446 if (ACPI_FAILURE(status)) {
477 return_ACPI_STATUS (status); 447 return_ACPI_STATUS(status);
478 } 448 }
479 449
480 /* Get the number of _CIDs returned */ 450 /* Get the number of _CIDs returned */
481 451
482 count = 1; 452 count = 1;
483 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_PACKAGE) { 453 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
484 count = obj_desc->package.count; 454 count = obj_desc->package.count;
485 } 455 }
486 456
487 /* Allocate a worst-case buffer for the _CIDs */ 457 /* Allocate a worst-case buffer for the _CIDs */
488 458
489 size = (((count - 1) * sizeof (struct acpi_compatible_id)) + 459 size = (((count - 1) * sizeof(struct acpi_compatible_id)) +
490 sizeof (struct acpi_compatible_id_list)); 460 sizeof(struct acpi_compatible_id_list));
491 461
492 cid_list = ACPI_MEM_CALLOCATE ((acpi_size) size); 462 cid_list = ACPI_MEM_CALLOCATE((acpi_size) size);
493 if (!cid_list) { 463 if (!cid_list) {
494 return_ACPI_STATUS (AE_NO_MEMORY); 464 return_ACPI_STATUS(AE_NO_MEMORY);
495 } 465 }
496 466
497 /* Init CID list */ 467 /* Init CID list */
@@ -508,39 +478,38 @@ acpi_ut_execute_CID (
508 478
509 /* The _CID object can be either a single CID or a package (list) of CIDs */ 479 /* The _CID object can be either a single CID or a package (list) of CIDs */
510 480
511 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_PACKAGE) { 481 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
512 /* Translate each package element */ 482 /* Translate each package element */
513 483
514 for (i = 0; i < count; i++) { 484 for (i = 0; i < count; i++) {
515 status = acpi_ut_translate_one_cid (obj_desc->package.elements[i], 485 status =
516 &cid_list->id[i]); 486 acpi_ut_translate_one_cid(obj_desc->package.
517 if (ACPI_FAILURE (status)) { 487 elements[i],
488 &cid_list->id[i]);
489 if (ACPI_FAILURE(status)) {
518 break; 490 break;
519 } 491 }
520 } 492 }
521 } 493 } else {
522 else {
523 /* Only one CID, translate to a string */ 494 /* Only one CID, translate to a string */
524 495
525 status = acpi_ut_translate_one_cid (obj_desc, cid_list->id); 496 status = acpi_ut_translate_one_cid(obj_desc, cid_list->id);
526 } 497 }
527 498
528 /* Cleanup on error */ 499 /* Cleanup on error */
529 500
530 if (ACPI_FAILURE (status)) { 501 if (ACPI_FAILURE(status)) {
531 ACPI_MEM_FREE (cid_list); 502 ACPI_MEM_FREE(cid_list);
532 } 503 } else {
533 else {
534 *return_cid_list = cid_list; 504 *return_cid_list = cid_list;
535 } 505 }
536 506
537 /* On exit, we must delete the _CID return object */ 507 /* On exit, we must delete the _CID return object */
538 508
539 acpi_ut_remove_reference (obj_desc); 509 acpi_ut_remove_reference(obj_desc);
540 return_ACPI_STATUS (status); 510 return_ACPI_STATUS(status);
541} 511}
542 512
543
544/******************************************************************************* 513/*******************************************************************************
545 * 514 *
546 * FUNCTION: acpi_ut_execute_UID 515 * FUNCTION: acpi_ut_execute_UID
@@ -558,42 +527,39 @@ acpi_ut_execute_CID (
558 ******************************************************************************/ 527 ******************************************************************************/
559 528
560acpi_status 529acpi_status
561acpi_ut_execute_UID ( 530acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
562 struct acpi_namespace_node *device_node, 531 struct acpi_device_id *uid)
563 struct acpi_device_id *uid)
564{ 532{
565 union acpi_operand_object *obj_desc; 533 union acpi_operand_object *obj_desc;
566 acpi_status status; 534 acpi_status status;
567
568
569 ACPI_FUNCTION_TRACE ("ut_execute_UID");
570 535
536 ACPI_FUNCTION_TRACE("ut_execute_UID");
571 537
572 status = acpi_ut_evaluate_object (device_node, METHOD_NAME__UID, 538 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID,
573 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &obj_desc); 539 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
574 if (ACPI_FAILURE (status)) { 540 &obj_desc);
575 return_ACPI_STATUS (status); 541 if (ACPI_FAILURE(status)) {
542 return_ACPI_STATUS(status);
576 } 543 }
577 544
578 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { 545 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
579 /* Convert the Numeric UID to string */ 546 /* Convert the Numeric UID to string */
580 547
581 acpi_ex_unsigned_integer_to_string (obj_desc->integer.value, uid->value); 548 acpi_ex_unsigned_integer_to_string(obj_desc->integer.value,
582 } 549 uid->value);
583 else { 550 } else {
584 /* Copy the String UID from the returned object */ 551 /* Copy the String UID from the returned object */
585 552
586 acpi_ut_copy_id_string (uid->value, obj_desc->string.pointer, 553 acpi_ut_copy_id_string(uid->value, obj_desc->string.pointer,
587 sizeof (uid->value)); 554 sizeof(uid->value));
588 } 555 }
589 556
590 /* On exit, we must delete the return object */ 557 /* On exit, we must delete the return object */
591 558
592 acpi_ut_remove_reference (obj_desc); 559 acpi_ut_remove_reference(obj_desc);
593 return_ACPI_STATUS (status); 560 return_ACPI_STATUS(status);
594} 561}
595 562
596
597/******************************************************************************* 563/*******************************************************************************
598 * 564 *
599 * FUNCTION: acpi_ut_execute_STA 565 * FUNCTION: acpi_ut_execute_STA
@@ -611,30 +577,26 @@ acpi_ut_execute_UID (
611 ******************************************************************************/ 577 ******************************************************************************/
612 578
613acpi_status 579acpi_status
614acpi_ut_execute_STA ( 580acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags)
615 struct acpi_namespace_node *device_node,
616 u32 *flags)
617{ 581{
618 union acpi_operand_object *obj_desc; 582 union acpi_operand_object *obj_desc;
619 acpi_status status; 583 acpi_status status;
620
621 584
622 ACPI_FUNCTION_TRACE ("ut_execute_STA"); 585 ACPI_FUNCTION_TRACE("ut_execute_STA");
623 586
624 587 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA,
625 status = acpi_ut_evaluate_object (device_node, METHOD_NAME__STA, 588 ACPI_BTYPE_INTEGER, &obj_desc);
626 ACPI_BTYPE_INTEGER, &obj_desc); 589 if (ACPI_FAILURE(status)) {
627 if (ACPI_FAILURE (status)) {
628 if (AE_NOT_FOUND == status) { 590 if (AE_NOT_FOUND == status) {
629 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 591 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
630 "_STA on %4.4s was not found, assuming device is present\n", 592 "_STA on %4.4s was not found, assuming device is present\n",
631 acpi_ut_get_node_name (device_node))); 593 acpi_ut_get_node_name(device_node)));
632 594
633 *flags = 0x0F; 595 *flags = 0x0F;
634 status = AE_OK; 596 status = AE_OK;
635 } 597 }
636 598
637 return_ACPI_STATUS (status); 599 return_ACPI_STATUS(status);
638 } 600 }
639 601
640 /* Extract the status flags */ 602 /* Extract the status flags */
@@ -643,11 +605,10 @@ acpi_ut_execute_STA (
643 605
644 /* On exit, we must delete the return object */ 606 /* On exit, we must delete the return object */
645 607
646 acpi_ut_remove_reference (obj_desc); 608 acpi_ut_remove_reference(obj_desc);
647 return_ACPI_STATUS (status); 609 return_ACPI_STATUS(status);
648} 610}
649 611
650
651/******************************************************************************* 612/*******************************************************************************
652 * 613 *
653 * FUNCTION: acpi_ut_execute_Sxds 614 * FUNCTION: acpi_ut_execute_Sxds
@@ -665,44 +626,45 @@ acpi_ut_execute_STA (
665 ******************************************************************************/ 626 ******************************************************************************/
666 627
667acpi_status 628acpi_status
668acpi_ut_execute_sxds ( 629acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest)
669 struct acpi_namespace_node *device_node,
670 u8 *highest)
671{ 630{
672 union acpi_operand_object *obj_desc; 631 union acpi_operand_object *obj_desc;
673 acpi_status status; 632 acpi_status status;
674 u32 i; 633 u32 i;
675
676
677 ACPI_FUNCTION_TRACE ("ut_execute_Sxds");
678 634
635 ACPI_FUNCTION_TRACE("ut_execute_Sxds");
679 636
680 for (i = 0; i < 4; i++) { 637 for (i = 0; i < 4; i++) {
681 highest[i] = 0xFF; 638 highest[i] = 0xFF;
682 status = acpi_ut_evaluate_object (device_node, 639 status = acpi_ut_evaluate_object(device_node,
683 (char *) acpi_gbl_highest_dstate_names[i], 640 (char *)
684 ACPI_BTYPE_INTEGER, &obj_desc); 641 acpi_gbl_highest_dstate_names
685 if (ACPI_FAILURE (status)) { 642 [i], ACPI_BTYPE_INTEGER,
643 &obj_desc);
644 if (ACPI_FAILURE(status)) {
686 if (status != AE_NOT_FOUND) { 645 if (status != AE_NOT_FOUND) {
687 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 646 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
688 "%s on Device %4.4s, %s\n", 647 "%s on Device %4.4s, %s\n",
689 (char *) acpi_gbl_highest_dstate_names[i], 648 (char *)
690 acpi_ut_get_node_name (device_node), 649 acpi_gbl_highest_dstate_names
691 acpi_format_exception (status))); 650 [i],
692 651 acpi_ut_get_node_name
693 return_ACPI_STATUS (status); 652 (device_node),
653 acpi_format_exception
654 (status)));
655
656 return_ACPI_STATUS(status);
694 } 657 }
695 } 658 } else {
696 else {
697 /* Extract the Dstate value */ 659 /* Extract the Dstate value */
698 660
699 highest[i] = (u8) obj_desc->integer.value; 661 highest[i] = (u8) obj_desc->integer.value;
700 662
701 /* Delete the return object */ 663 /* Delete the return object */
702 664
703 acpi_ut_remove_reference (obj_desc); 665 acpi_ut_remove_reference(obj_desc);
704 } 666 }
705 } 667 }
706 668
707 return_ACPI_STATUS (AE_OK); 669 return_ACPI_STATUS(AE_OK);
708} 670}