diff options
Diffstat (limited to 'drivers/acpi/executer/exconvrt.c')
-rw-r--r-- | drivers/acpi/executer/exconvrt.c | 311 |
1 files changed, 141 insertions, 170 deletions
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index 21331625e66e..04e5194989a6 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -41,24 +41,17 @@ | |||
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/acinterp.h> | 45 | #include <acpi/acinterp.h> |
47 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
48 | 47 | ||
49 | |||
50 | #define _COMPONENT ACPI_EXECUTER | 48 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME ("exconvrt") | 49 | ACPI_MODULE_NAME("exconvrt") |
52 | 50 | ||
53 | /* Local prototypes */ | 51 | /* Local prototypes */ |
54 | |||
55 | static u32 | 52 | static u32 |
56 | acpi_ex_convert_to_ascii ( | 53 | acpi_ex_convert_to_ascii(acpi_integer integer, |
57 | acpi_integer integer, | 54 | u16 base, u8 * string, u8 max_length); |
58 | u16 base, | ||
59 | u8 *string, | ||
60 | u8 max_length); | ||
61 | |||
62 | 55 | ||
63 | /******************************************************************************* | 56 | /******************************************************************************* |
64 | * | 57 | * |
@@ -76,29 +69,25 @@ acpi_ex_convert_to_ascii ( | |||
76 | ******************************************************************************/ | 69 | ******************************************************************************/ |
77 | 70 | ||
78 | acpi_status | 71 | acpi_status |
79 | acpi_ex_convert_to_integer ( | 72 | acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, |
80 | union acpi_operand_object *obj_desc, | 73 | union acpi_operand_object **result_desc, u32 flags) |
81 | union acpi_operand_object **result_desc, | ||
82 | u32 flags) | ||
83 | { | 74 | { |
84 | union acpi_operand_object *return_desc; | 75 | union acpi_operand_object *return_desc; |
85 | u8 *pointer; | 76 | u8 *pointer; |
86 | acpi_integer result; | 77 | acpi_integer result; |
87 | u32 i; | 78 | u32 i; |
88 | u32 count; | 79 | u32 count; |
89 | acpi_status status; | 80 | acpi_status status; |
90 | |||
91 | 81 | ||
92 | ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_integer", obj_desc); | 82 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_integer", obj_desc); |
93 | 83 | ||
94 | 84 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | |
95 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | ||
96 | case ACPI_TYPE_INTEGER: | 85 | case ACPI_TYPE_INTEGER: |
97 | 86 | ||
98 | /* No conversion necessary */ | 87 | /* No conversion necessary */ |
99 | 88 | ||
100 | *result_desc = obj_desc; | 89 | *result_desc = obj_desc; |
101 | return_ACPI_STATUS (AE_OK); | 90 | return_ACPI_STATUS(AE_OK); |
102 | 91 | ||
103 | case ACPI_TYPE_BUFFER: | 92 | case ACPI_TYPE_BUFFER: |
104 | case ACPI_TYPE_STRING: | 93 | case ACPI_TYPE_STRING: |
@@ -106,11 +95,11 @@ acpi_ex_convert_to_integer ( | |||
106 | /* Note: Takes advantage of common buffer/string fields */ | 95 | /* Note: Takes advantage of common buffer/string fields */ |
107 | 96 | ||
108 | pointer = obj_desc->buffer.pointer; | 97 | pointer = obj_desc->buffer.pointer; |
109 | count = obj_desc->buffer.length; | 98 | count = obj_desc->buffer.length; |
110 | break; | 99 | break; |
111 | 100 | ||
112 | default: | 101 | default: |
113 | return_ACPI_STATUS (AE_TYPE); | 102 | return_ACPI_STATUS(AE_TYPE); |
114 | } | 103 | } |
115 | 104 | ||
116 | /* | 105 | /* |
@@ -126,7 +115,7 @@ acpi_ex_convert_to_integer ( | |||
126 | 115 | ||
127 | /* String conversion is different than Buffer conversion */ | 116 | /* String conversion is different than Buffer conversion */ |
128 | 117 | ||
129 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 118 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
130 | case ACPI_TYPE_STRING: | 119 | case ACPI_TYPE_STRING: |
131 | 120 | ||
132 | /* | 121 | /* |
@@ -135,19 +124,18 @@ acpi_ex_convert_to_integer ( | |||
135 | * of ACPI 3.0) is that the to_integer() operator allows both decimal | 124 | * of ACPI 3.0) is that the to_integer() operator allows both decimal |
136 | * and hexadecimal strings (hex prefixed with "0x"). | 125 | * and hexadecimal strings (hex prefixed with "0x"). |
137 | */ | 126 | */ |
138 | status = acpi_ut_strtoul64 ((char *) pointer, flags, &result); | 127 | status = acpi_ut_strtoul64((char *)pointer, flags, &result); |
139 | if (ACPI_FAILURE (status)) { | 128 | if (ACPI_FAILURE(status)) { |
140 | return_ACPI_STATUS (status); | 129 | return_ACPI_STATUS(status); |
141 | } | 130 | } |
142 | break; | 131 | break; |
143 | 132 | ||
144 | |||
145 | case ACPI_TYPE_BUFFER: | 133 | case ACPI_TYPE_BUFFER: |
146 | 134 | ||
147 | /* Check for zero-length buffer */ | 135 | /* Check for zero-length buffer */ |
148 | 136 | ||
149 | if (!count) { | 137 | if (!count) { |
150 | return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); | 138 | return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); |
151 | } | 139 | } |
152 | 140 | ||
153 | /* Transfer no more than an integer's worth of data */ | 141 | /* Transfer no more than an integer's worth of data */ |
@@ -170,7 +158,6 @@ acpi_ex_convert_to_integer ( | |||
170 | } | 158 | } |
171 | break; | 159 | break; |
172 | 160 | ||
173 | |||
174 | default: | 161 | default: |
175 | /* No other types can get here */ | 162 | /* No other types can get here */ |
176 | break; | 163 | break; |
@@ -178,20 +165,19 @@ acpi_ex_convert_to_integer ( | |||
178 | 165 | ||
179 | /* Create a new integer */ | 166 | /* Create a new integer */ |
180 | 167 | ||
181 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 168 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
182 | if (!return_desc) { | 169 | if (!return_desc) { |
183 | return_ACPI_STATUS (AE_NO_MEMORY); | 170 | return_ACPI_STATUS(AE_NO_MEMORY); |
184 | } | 171 | } |
185 | 172 | ||
186 | /* Save the Result */ | 173 | /* Save the Result */ |
187 | 174 | ||
188 | return_desc->integer.value = result; | 175 | return_desc->integer.value = result; |
189 | acpi_ex_truncate_for32bit_table (return_desc); | 176 | acpi_ex_truncate_for32bit_table(return_desc); |
190 | *result_desc = return_desc; | 177 | *result_desc = return_desc; |
191 | return_ACPI_STATUS (AE_OK); | 178 | return_ACPI_STATUS(AE_OK); |
192 | } | 179 | } |
193 | 180 | ||
194 | |||
195 | /******************************************************************************* | 181 | /******************************************************************************* |
196 | * | 182 | * |
197 | * FUNCTION: acpi_ex_convert_to_buffer | 183 | * FUNCTION: acpi_ex_convert_to_buffer |
@@ -207,25 +193,21 @@ acpi_ex_convert_to_integer ( | |||
207 | ******************************************************************************/ | 193 | ******************************************************************************/ |
208 | 194 | ||
209 | acpi_status | 195 | acpi_status |
210 | acpi_ex_convert_to_buffer ( | 196 | acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, |
211 | union acpi_operand_object *obj_desc, | 197 | union acpi_operand_object **result_desc) |
212 | union acpi_operand_object **result_desc) | ||
213 | { | 198 | { |
214 | union acpi_operand_object *return_desc; | 199 | union acpi_operand_object *return_desc; |
215 | u8 *new_buf; | 200 | u8 *new_buf; |
216 | 201 | ||
202 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_buffer", obj_desc); | ||
217 | 203 | ||
218 | ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_buffer", obj_desc); | 204 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
219 | |||
220 | |||
221 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | ||
222 | case ACPI_TYPE_BUFFER: | 205 | case ACPI_TYPE_BUFFER: |
223 | 206 | ||
224 | /* No conversion necessary */ | 207 | /* No conversion necessary */ |
225 | 208 | ||
226 | *result_desc = obj_desc; | 209 | *result_desc = obj_desc; |
227 | return_ACPI_STATUS (AE_OK); | 210 | return_ACPI_STATUS(AE_OK); |
228 | |||
229 | 211 | ||
230 | case ACPI_TYPE_INTEGER: | 212 | case ACPI_TYPE_INTEGER: |
231 | 213 | ||
@@ -233,20 +215,20 @@ acpi_ex_convert_to_buffer ( | |||
233 | * Create a new Buffer object. | 215 | * Create a new Buffer object. |
234 | * Need enough space for one integer | 216 | * Need enough space for one integer |
235 | */ | 217 | */ |
236 | return_desc = acpi_ut_create_buffer_object (acpi_gbl_integer_byte_width); | 218 | return_desc = |
219 | acpi_ut_create_buffer_object(acpi_gbl_integer_byte_width); | ||
237 | if (!return_desc) { | 220 | if (!return_desc) { |
238 | return_ACPI_STATUS (AE_NO_MEMORY); | 221 | return_ACPI_STATUS(AE_NO_MEMORY); |
239 | } | 222 | } |
240 | 223 | ||
241 | /* Copy the integer to the buffer, LSB first */ | 224 | /* Copy the integer to the buffer, LSB first */ |
242 | 225 | ||
243 | new_buf = return_desc->buffer.pointer; | 226 | new_buf = return_desc->buffer.pointer; |
244 | ACPI_MEMCPY (new_buf, | 227 | ACPI_MEMCPY(new_buf, |
245 | &obj_desc->integer.value, | 228 | &obj_desc->integer.value, |
246 | acpi_gbl_integer_byte_width); | 229 | acpi_gbl_integer_byte_width); |
247 | break; | 230 | break; |
248 | 231 | ||
249 | |||
250 | case ACPI_TYPE_STRING: | 232 | case ACPI_TYPE_STRING: |
251 | 233 | ||
252 | /* | 234 | /* |
@@ -258,32 +240,31 @@ acpi_ex_convert_to_buffer ( | |||
258 | * ASL/AML code that depends on the null being transferred to the new | 240 | * ASL/AML code that depends on the null being transferred to the new |
259 | * buffer. | 241 | * buffer. |
260 | */ | 242 | */ |
261 | return_desc = acpi_ut_create_buffer_object ( | 243 | return_desc = acpi_ut_create_buffer_object((acpi_size) |
262 | (acpi_size) obj_desc->string.length + 1); | 244 | obj_desc->string. |
245 | length + 1); | ||
263 | if (!return_desc) { | 246 | if (!return_desc) { |
264 | return_ACPI_STATUS (AE_NO_MEMORY); | 247 | return_ACPI_STATUS(AE_NO_MEMORY); |
265 | } | 248 | } |
266 | 249 | ||
267 | /* Copy the string to the buffer */ | 250 | /* Copy the string to the buffer */ |
268 | 251 | ||
269 | new_buf = return_desc->buffer.pointer; | 252 | new_buf = return_desc->buffer.pointer; |
270 | ACPI_STRNCPY ((char *) new_buf, (char *) obj_desc->string.pointer, | 253 | ACPI_STRNCPY((char *)new_buf, (char *)obj_desc->string.pointer, |
271 | obj_desc->string.length); | 254 | obj_desc->string.length); |
272 | break; | 255 | break; |
273 | 256 | ||
274 | |||
275 | default: | 257 | default: |
276 | return_ACPI_STATUS (AE_TYPE); | 258 | return_ACPI_STATUS(AE_TYPE); |
277 | } | 259 | } |
278 | 260 | ||
279 | /* Mark buffer initialized */ | 261 | /* Mark buffer initialized */ |
280 | 262 | ||
281 | return_desc->common.flags |= AOPOBJ_DATA_VALID; | 263 | return_desc->common.flags |= AOPOBJ_DATA_VALID; |
282 | *result_desc = return_desc; | 264 | *result_desc = return_desc; |
283 | return_ACPI_STATUS (AE_OK); | 265 | return_ACPI_STATUS(AE_OK); |
284 | } | 266 | } |
285 | 267 | ||
286 | |||
287 | /******************************************************************************* | 268 | /******************************************************************************* |
288 | * | 269 | * |
289 | * FUNCTION: acpi_ex_convert_to_ascii | 270 | * FUNCTION: acpi_ex_convert_to_ascii |
@@ -300,24 +281,19 @@ acpi_ex_convert_to_buffer ( | |||
300 | ******************************************************************************/ | 281 | ******************************************************************************/ |
301 | 282 | ||
302 | static u32 | 283 | static u32 |
303 | acpi_ex_convert_to_ascii ( | 284 | acpi_ex_convert_to_ascii(acpi_integer integer, |
304 | acpi_integer integer, | 285 | u16 base, u8 * string, u8 data_width) |
305 | u16 base, | ||
306 | u8 *string, | ||
307 | u8 data_width) | ||
308 | { | 286 | { |
309 | acpi_integer digit; | 287 | acpi_integer digit; |
310 | acpi_native_uint i; | 288 | acpi_native_uint i; |
311 | acpi_native_uint j; | 289 | acpi_native_uint j; |
312 | acpi_native_uint k = 0; | 290 | acpi_native_uint k = 0; |
313 | acpi_native_uint hex_length; | 291 | acpi_native_uint hex_length; |
314 | acpi_native_uint decimal_length; | 292 | acpi_native_uint decimal_length; |
315 | u32 remainder; | 293 | u32 remainder; |
316 | u8 supress_zeros; | 294 | u8 supress_zeros; |
317 | |||
318 | |||
319 | ACPI_FUNCTION_ENTRY (); | ||
320 | 295 | ||
296 | ACPI_FUNCTION_ENTRY(); | ||
321 | 297 | ||
322 | switch (base) { | 298 | switch (base) { |
323 | case 10: | 299 | case 10: |
@@ -339,7 +315,7 @@ acpi_ex_convert_to_ascii ( | |||
339 | break; | 315 | break; |
340 | } | 316 | } |
341 | 317 | ||
342 | supress_zeros = TRUE; /* No leading zeros */ | 318 | supress_zeros = TRUE; /* No leading zeros */ |
343 | remainder = 0; | 319 | remainder = 0; |
344 | 320 | ||
345 | for (i = decimal_length; i > 0; i--) { | 321 | for (i = decimal_length; i > 0; i--) { |
@@ -347,7 +323,8 @@ acpi_ex_convert_to_ascii ( | |||
347 | 323 | ||
348 | digit = integer; | 324 | digit = integer; |
349 | for (j = 0; j < i; j++) { | 325 | for (j = 0; j < i; j++) { |
350 | (void) acpi_ut_short_divide (digit, 10, &digit, &remainder); | 326 | (void)acpi_ut_short_divide(digit, 10, &digit, |
327 | &remainder); | ||
351 | } | 328 | } |
352 | 329 | ||
353 | /* Handle leading zeros */ | 330 | /* Handle leading zeros */ |
@@ -367,11 +344,13 @@ acpi_ex_convert_to_ascii ( | |||
367 | 344 | ||
368 | /* hex_length: 2 ascii hex chars per data byte */ | 345 | /* hex_length: 2 ascii hex chars per data byte */ |
369 | 346 | ||
370 | hex_length = (acpi_native_uint) ACPI_MUL_2 (data_width); | 347 | hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); |
371 | for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) { | 348 | for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { |
372 | /* Get one hex digit, most significant digits first */ | 349 | /* Get one hex digit, most significant digits first */ |
373 | 350 | ||
374 | string[k] = (u8) acpi_ut_hex_to_ascii_char (integer, ACPI_MUL_4 (j)); | 351 | string[k] = |
352 | (u8) acpi_ut_hex_to_ascii_char(integer, | ||
353 | ACPI_MUL_4(j)); | ||
375 | k++; | 354 | k++; |
376 | } | 355 | } |
377 | break; | 356 | break; |
@@ -387,15 +366,14 @@ acpi_ex_convert_to_ascii ( | |||
387 | * Finally, null terminate the string and return the length | 366 | * Finally, null terminate the string and return the length |
388 | */ | 367 | */ |
389 | if (!k) { | 368 | if (!k) { |
390 | string [0] = ACPI_ASCII_ZERO; | 369 | string[0] = ACPI_ASCII_ZERO; |
391 | k = 1; | 370 | k = 1; |
392 | } | 371 | } |
393 | 372 | ||
394 | string [k] = 0; | 373 | string[k] = 0; |
395 | return ((u32) k); | 374 | return ((u32) k); |
396 | } | 375 | } |
397 | 376 | ||
398 | |||
399 | /******************************************************************************* | 377 | /******************************************************************************* |
400 | * | 378 | * |
401 | * FUNCTION: acpi_ex_convert_to_string | 379 | * FUNCTION: acpi_ex_convert_to_string |
@@ -412,30 +390,25 @@ acpi_ex_convert_to_ascii ( | |||
412 | ******************************************************************************/ | 390 | ******************************************************************************/ |
413 | 391 | ||
414 | acpi_status | 392 | acpi_status |
415 | acpi_ex_convert_to_string ( | 393 | acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, |
416 | union acpi_operand_object *obj_desc, | 394 | union acpi_operand_object ** result_desc, u32 type) |
417 | union acpi_operand_object **result_desc, | ||
418 | u32 type) | ||
419 | { | 395 | { |
420 | union acpi_operand_object *return_desc; | 396 | union acpi_operand_object *return_desc; |
421 | u8 *new_buf; | 397 | u8 *new_buf; |
422 | u32 i; | 398 | u32 i; |
423 | u32 string_length = 0; | 399 | u32 string_length = 0; |
424 | u16 base = 16; | 400 | u16 base = 16; |
425 | u8 separator = ','; | 401 | u8 separator = ','; |
426 | 402 | ||
403 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_string", obj_desc); | ||
427 | 404 | ||
428 | ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_string", obj_desc); | 405 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
429 | |||
430 | |||
431 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | ||
432 | case ACPI_TYPE_STRING: | 406 | case ACPI_TYPE_STRING: |
433 | 407 | ||
434 | /* No conversion necessary */ | 408 | /* No conversion necessary */ |
435 | 409 | ||
436 | *result_desc = obj_desc; | 410 | *result_desc = obj_desc; |
437 | return_ACPI_STATUS (AE_OK); | 411 | return_ACPI_STATUS(AE_OK); |
438 | |||
439 | 412 | ||
440 | case ACPI_TYPE_INTEGER: | 413 | case ACPI_TYPE_INTEGER: |
441 | 414 | ||
@@ -452,7 +425,7 @@ acpi_ex_convert_to_string ( | |||
452 | 425 | ||
453 | /* Two hex string characters for each integer byte */ | 426 | /* Two hex string characters for each integer byte */ |
454 | 427 | ||
455 | string_length = ACPI_MUL_2 (acpi_gbl_integer_byte_width); | 428 | string_length = ACPI_MUL_2(acpi_gbl_integer_byte_width); |
456 | break; | 429 | break; |
457 | } | 430 | } |
458 | 431 | ||
@@ -460,31 +433,33 @@ acpi_ex_convert_to_string ( | |||
460 | * Create a new String | 433 | * Create a new String |
461 | * Need enough space for one ASCII integer (plus null terminator) | 434 | * Need enough space for one ASCII integer (plus null terminator) |
462 | */ | 435 | */ |
463 | return_desc = acpi_ut_create_string_object ((acpi_size) string_length); | 436 | return_desc = |
437 | acpi_ut_create_string_object((acpi_size) string_length); | ||
464 | if (!return_desc) { | 438 | if (!return_desc) { |
465 | return_ACPI_STATUS (AE_NO_MEMORY); | 439 | return_ACPI_STATUS(AE_NO_MEMORY); |
466 | } | 440 | } |
467 | 441 | ||
468 | new_buf = return_desc->buffer.pointer; | 442 | new_buf = return_desc->buffer.pointer; |
469 | 443 | ||
470 | /* Convert integer to string */ | 444 | /* Convert integer to string */ |
471 | 445 | ||
472 | string_length = acpi_ex_convert_to_ascii (obj_desc->integer.value, base, | 446 | string_length = |
473 | new_buf, acpi_gbl_integer_byte_width); | 447 | acpi_ex_convert_to_ascii(obj_desc->integer.value, base, |
448 | new_buf, | ||
449 | acpi_gbl_integer_byte_width); | ||
474 | 450 | ||
475 | /* Null terminate at the correct place */ | 451 | /* Null terminate at the correct place */ |
476 | 452 | ||
477 | return_desc->string.length = string_length; | 453 | return_desc->string.length = string_length; |
478 | new_buf [string_length] = 0; | 454 | new_buf[string_length] = 0; |
479 | break; | 455 | break; |
480 | 456 | ||
481 | |||
482 | case ACPI_TYPE_BUFFER: | 457 | case ACPI_TYPE_BUFFER: |
483 | 458 | ||
484 | /* Setup string length, base, and separator */ | 459 | /* Setup string length, base, and separator */ |
485 | 460 | ||
486 | switch (type) { | 461 | switch (type) { |
487 | case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */ | 462 | case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */ |
488 | /* | 463 | /* |
489 | * From ACPI: "If Data is a buffer, it is converted to a string of | 464 | * From ACPI: "If Data is a buffer, it is converted to a string of |
490 | * decimal values separated by commas." | 465 | * decimal values separated by commas." |
@@ -498,11 +473,9 @@ acpi_ex_convert_to_string ( | |||
498 | for (i = 0; i < obj_desc->buffer.length; i++) { | 473 | for (i = 0; i < obj_desc->buffer.length; i++) { |
499 | if (obj_desc->buffer.pointer[i] >= 100) { | 474 | if (obj_desc->buffer.pointer[i] >= 100) { |
500 | string_length += 4; | 475 | string_length += 4; |
501 | } | 476 | } else if (obj_desc->buffer.pointer[i] >= 10) { |
502 | else if (obj_desc->buffer.pointer[i] >= 10) { | ||
503 | string_length += 3; | 477 | string_length += 3; |
504 | } | 478 | } else { |
505 | else { | ||
506 | string_length += 2; | 479 | string_length += 2; |
507 | } | 480 | } |
508 | } | 481 | } |
@@ -518,7 +491,7 @@ acpi_ex_convert_to_string ( | |||
518 | string_length = (obj_desc->buffer.length * 3); | 491 | string_length = (obj_desc->buffer.length * 3); |
519 | break; | 492 | break; |
520 | 493 | ||
521 | case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */ | 494 | case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */ |
522 | /* | 495 | /* |
523 | * From ACPI: "If Data is a buffer, it is converted to a string of | 496 | * From ACPI: "If Data is a buffer, it is converted to a string of |
524 | * hexadecimal values separated by commas." | 497 | * hexadecimal values separated by commas." |
@@ -527,7 +500,7 @@ acpi_ex_convert_to_string ( | |||
527 | break; | 500 | break; |
528 | 501 | ||
529 | default: | 502 | default: |
530 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 503 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
531 | } | 504 | } |
532 | 505 | ||
533 | /* | 506 | /* |
@@ -535,15 +508,16 @@ acpi_ex_convert_to_string ( | |||
535 | * (-1 because of extra separator included in string_length from above) | 508 | * (-1 because of extra separator included in string_length from above) |
536 | */ | 509 | */ |
537 | string_length--; | 510 | string_length--; |
538 | if (string_length > ACPI_MAX_STRING_CONVERSION) /* ACPI limit */ { | 511 | if (string_length > ACPI_MAX_STRING_CONVERSION) { /* ACPI limit */ |
539 | return_ACPI_STATUS (AE_AML_STRING_LIMIT); | 512 | return_ACPI_STATUS(AE_AML_STRING_LIMIT); |
540 | } | 513 | } |
541 | 514 | ||
542 | /* Create a new string object and string buffer */ | 515 | /* Create a new string object and string buffer */ |
543 | 516 | ||
544 | return_desc = acpi_ut_create_string_object ((acpi_size) string_length); | 517 | return_desc = |
518 | acpi_ut_create_string_object((acpi_size) string_length); | ||
545 | if (!return_desc) { | 519 | if (!return_desc) { |
546 | return_ACPI_STATUS (AE_NO_MEMORY); | 520 | return_ACPI_STATUS(AE_NO_MEMORY); |
547 | } | 521 | } |
548 | 522 | ||
549 | new_buf = return_desc->buffer.pointer; | 523 | new_buf = return_desc->buffer.pointer; |
@@ -553,10 +527,11 @@ acpi_ex_convert_to_string ( | |||
553 | * (separated by commas or spaces) | 527 | * (separated by commas or spaces) |
554 | */ | 528 | */ |
555 | for (i = 0; i < obj_desc->buffer.length; i++) { | 529 | for (i = 0; i < obj_desc->buffer.length; i++) { |
556 | new_buf += acpi_ex_convert_to_ascii ( | 530 | new_buf += acpi_ex_convert_to_ascii((acpi_integer) |
557 | (acpi_integer) obj_desc->buffer.pointer[i], base, | 531 | obj_desc->buffer. |
558 | new_buf, 1); | 532 | pointer[i], base, |
559 | *new_buf++ = separator; /* each separated by a comma or space */ | 533 | new_buf, 1); |
534 | *new_buf++ = separator; /* each separated by a comma or space */ | ||
560 | } | 535 | } |
561 | 536 | ||
562 | /* | 537 | /* |
@@ -568,14 +543,13 @@ acpi_ex_convert_to_string ( | |||
568 | break; | 543 | break; |
569 | 544 | ||
570 | default: | 545 | default: |
571 | return_ACPI_STATUS (AE_TYPE); | 546 | return_ACPI_STATUS(AE_TYPE); |
572 | } | 547 | } |
573 | 548 | ||
574 | *result_desc = return_desc; | 549 | *result_desc = return_desc; |
575 | return_ACPI_STATUS (AE_OK); | 550 | return_ACPI_STATUS(AE_OK); |
576 | } | 551 | } |
577 | 552 | ||
578 | |||
579 | /******************************************************************************* | 553 | /******************************************************************************* |
580 | * | 554 | * |
581 | * FUNCTION: acpi_ex_convert_to_target_type | 555 | * FUNCTION: acpi_ex_convert_to_target_type |
@@ -592,17 +566,14 @@ acpi_ex_convert_to_string ( | |||
592 | ******************************************************************************/ | 566 | ******************************************************************************/ |
593 | 567 | ||
594 | acpi_status | 568 | acpi_status |
595 | acpi_ex_convert_to_target_type ( | 569 | acpi_ex_convert_to_target_type(acpi_object_type destination_type, |
596 | acpi_object_type destination_type, | 570 | union acpi_operand_object *source_desc, |
597 | union acpi_operand_object *source_desc, | 571 | union acpi_operand_object **result_desc, |
598 | union acpi_operand_object **result_desc, | 572 | struct acpi_walk_state *walk_state) |
599 | struct acpi_walk_state *walk_state) | ||
600 | { | 573 | { |
601 | acpi_status status = AE_OK; | 574 | acpi_status status = AE_OK; |
602 | |||
603 | |||
604 | ACPI_FUNCTION_TRACE ("ex_convert_to_target_type"); | ||
605 | 575 | ||
576 | ACPI_FUNCTION_TRACE("ex_convert_to_target_type"); | ||
606 | 577 | ||
607 | /* Default behavior */ | 578 | /* Default behavior */ |
608 | 579 | ||
@@ -612,10 +583,10 @@ acpi_ex_convert_to_target_type ( | |||
612 | * If required by the target, | 583 | * If required by the target, |
613 | * perform implicit conversion on the source before we store it. | 584 | * perform implicit conversion on the source before we store it. |
614 | */ | 585 | */ |
615 | switch (GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args)) { | 586 | switch (GET_CURRENT_ARG_TYPE(walk_state->op_info->runtime_args)) { |
616 | case ARGI_SIMPLE_TARGET: | 587 | case ARGI_SIMPLE_TARGET: |
617 | case ARGI_FIXED_TARGET: | 588 | case ARGI_FIXED_TARGET: |
618 | case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */ | 589 | case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */ |
619 | 590 | ||
620 | switch (destination_type) { | 591 | switch (destination_type) { |
621 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 592 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
@@ -627,17 +598,19 @@ acpi_ex_convert_to_target_type ( | |||
627 | default: | 598 | default: |
628 | /* No conversion allowed for these types */ | 599 | /* No conversion allowed for these types */ |
629 | 600 | ||
630 | if (destination_type != ACPI_GET_OBJECT_TYPE (source_desc)) { | 601 | if (destination_type != |
631 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 602 | ACPI_GET_OBJECT_TYPE(source_desc)) { |
632 | "Explicit operator, will store (%s) over existing type (%s)\n", | 603 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
633 | acpi_ut_get_object_type_name (source_desc), | 604 | "Explicit operator, will store (%s) over existing type (%s)\n", |
634 | acpi_ut_get_type_name (destination_type))); | 605 | acpi_ut_get_object_type_name |
606 | (source_desc), | ||
607 | acpi_ut_get_type_name | ||
608 | (destination_type))); | ||
635 | status = AE_TYPE; | 609 | status = AE_TYPE; |
636 | } | 610 | } |
637 | } | 611 | } |
638 | break; | 612 | break; |
639 | 613 | ||
640 | |||
641 | case ARGI_TARGETREF: | 614 | case ARGI_TARGETREF: |
642 | 615 | ||
643 | switch (destination_type) { | 616 | switch (destination_type) { |
@@ -649,55 +622,55 @@ acpi_ex_convert_to_target_type ( | |||
649 | * These types require an Integer operand. We can convert | 622 | * These types require an Integer operand. We can convert |
650 | * a Buffer or a String to an Integer if necessary. | 623 | * a Buffer or a String to an Integer if necessary. |
651 | */ | 624 | */ |
652 | status = acpi_ex_convert_to_integer (source_desc, result_desc, | 625 | status = |
653 | 16); | 626 | acpi_ex_convert_to_integer(source_desc, result_desc, |
627 | 16); | ||
654 | break; | 628 | break; |
655 | 629 | ||
656 | |||
657 | case ACPI_TYPE_STRING: | 630 | case ACPI_TYPE_STRING: |
658 | /* | 631 | /* |
659 | * The operand must be a String. We can convert an | 632 | * The operand must be a String. We can convert an |
660 | * Integer or Buffer if necessary | 633 | * Integer or Buffer if necessary |
661 | */ | 634 | */ |
662 | status = acpi_ex_convert_to_string (source_desc, result_desc, | 635 | status = |
663 | ACPI_IMPLICIT_CONVERT_HEX); | 636 | acpi_ex_convert_to_string(source_desc, result_desc, |
637 | ACPI_IMPLICIT_CONVERT_HEX); | ||
664 | break; | 638 | break; |
665 | 639 | ||
666 | |||
667 | case ACPI_TYPE_BUFFER: | 640 | case ACPI_TYPE_BUFFER: |
668 | /* | 641 | /* |
669 | * The operand must be a Buffer. We can convert an | 642 | * The operand must be a Buffer. We can convert an |
670 | * Integer or String if necessary | 643 | * Integer or String if necessary |
671 | */ | 644 | */ |
672 | status = acpi_ex_convert_to_buffer (source_desc, result_desc); | 645 | status = |
646 | acpi_ex_convert_to_buffer(source_desc, result_desc); | ||
673 | break; | 647 | break; |
674 | 648 | ||
675 | |||
676 | default: | 649 | default: |
677 | ACPI_REPORT_ERROR (("Bad destination type during conversion: %X\n", | 650 | ACPI_REPORT_ERROR(("Bad destination type during conversion: %X\n", destination_type)); |
678 | destination_type)); | ||
679 | status = AE_AML_INTERNAL; | 651 | status = AE_AML_INTERNAL; |
680 | break; | 652 | break; |
681 | } | 653 | } |
682 | break; | 654 | break; |
683 | 655 | ||
684 | |||
685 | case ARGI_REFERENCE: | 656 | case ARGI_REFERENCE: |
686 | /* | 657 | /* |
687 | * create_xxxx_field cases - we are storing the field object into the name | 658 | * create_xxxx_field cases - we are storing the field object into the name |
688 | */ | 659 | */ |
689 | break; | 660 | break; |
690 | 661 | ||
691 | |||
692 | default: | 662 | default: |
693 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 663 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
694 | "Unknown Target type ID 0x%X Op %s dest_type %s\n", | 664 | "Unknown Target type ID 0x%X Op %s dest_type %s\n", |
695 | GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args), | 665 | GET_CURRENT_ARG_TYPE(walk_state->op_info-> |
696 | walk_state->op_info->name, acpi_ut_get_type_name (destination_type))); | 666 | runtime_args), |
697 | 667 | walk_state->op_info->name, | |
698 | ACPI_REPORT_ERROR (("Bad Target Type (ARGI): %X\n", | 668 | acpi_ut_get_type_name(destination_type))); |
699 | GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args))) | 669 | |
700 | status = AE_AML_INTERNAL; | 670 | ACPI_REPORT_ERROR(("Bad Target Type (ARGI): %X\n", |
671 | GET_CURRENT_ARG_TYPE(walk_state->op_info-> | ||
672 | runtime_args))) | ||
673 | status = AE_AML_INTERNAL; | ||
701 | } | 674 | } |
702 | 675 | ||
703 | /* | 676 | /* |
@@ -710,7 +683,5 @@ acpi_ex_convert_to_target_type ( | |||
710 | status = AE_OK; | 683 | status = AE_OK; |
711 | } | 684 | } |
712 | 685 | ||
713 | return_ACPI_STATUS (status); | 686 | return_ACPI_STATUS(status); |
714 | } | 687 | } |
715 | |||
716 | |||