Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/executer/exconvrt.c
+++ new/usr/src/common/acpica/components/executer/exconvrt.c
1 1 /******************************************************************************
2 2 *
3 3 * Module Name: exconvrt - Object conversion routines
4 4 *
5 5 *****************************************************************************/
6 6
7 7 /*
8 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2014, Intel Corp.
9 9 * All rights reserved.
10 10 *
11 11 * Redistribution and use in source and binary forms, with or without
12 12 * modification, are permitted provided that the following conditions
13 13 * are met:
14 14 * 1. Redistributions of source code must retain the above copyright
15 15 * notice, this list of conditions, and the following disclaimer,
16 16 * without modification.
17 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 18 * substantially similar to the "NO WARRANTY" disclaimer below
19 19 * ("Disclaimer") and any redistribution must be conditioned upon
20 20 * including a substantially similar Disclaimer requirement for further
21 21 * binary redistribution.
22 22 * 3. Neither the names of the above-listed copyright holders nor the names
23 23 * of any contributors may be used to endorse or promote products derived
24 24 * from this software without specific prior written permission.
25 25 *
26 26 * Alternatively, this software may be distributed under the terms of the
27 27 * GNU General Public License ("GPL") version 2 as published by the Free
28 28 * Software Foundation.
29 29 *
30 30 * NO WARRANTY
31 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 41 * POSSIBILITY OF SUCH DAMAGES.
42 42 */
43 43
44 44
45 45 #define __EXCONVRT_C__
46 46
47 47 #include "acpi.h"
48 48 #include "accommon.h"
49 49 #include "acinterp.h"
50 50 #include "amlcode.h"
51 51
52 52
53 53 #define _COMPONENT ACPI_EXECUTER
54 54 ACPI_MODULE_NAME ("exconvrt")
55 55
56 56 /* Local prototypes */
57 57
58 58 static UINT32
59 59 AcpiExConvertToAscii (
60 60 UINT64 Integer,
61 61 UINT16 Base,
62 62 UINT8 *String,
63 63 UINT8 MaxLength);
64 64
65 65
66 66 /*******************************************************************************
67 67 *
68 68 * FUNCTION: AcpiExConvertToInteger
69 69 *
70 70 * PARAMETERS: ObjDesc - Object to be converted. Must be an
71 71 * Integer, Buffer, or String
72 72 * ResultDesc - Where the new Integer object is returned
73 73 * Flags - Used for string conversion
74 74 *
75 75 * RETURN: Status
76 76 *
77 77 * DESCRIPTION: Convert an ACPI Object to an integer.
78 78 *
79 79 ******************************************************************************/
80 80
81 81 ACPI_STATUS
82 82 AcpiExConvertToInteger (
83 83 ACPI_OPERAND_OBJECT *ObjDesc,
84 84 ACPI_OPERAND_OBJECT **ResultDesc,
85 85 UINT32 Flags)
86 86 {
87 87 ACPI_OPERAND_OBJECT *ReturnDesc;
88 88 UINT8 *Pointer;
89 89 UINT64 Result;
90 90 UINT32 i;
91 91 UINT32 Count;
92 92 ACPI_STATUS Status;
93 93
94 94
95 95 ACPI_FUNCTION_TRACE_PTR (ExConvertToInteger, ObjDesc);
96 96
97 97
98 98 switch (ObjDesc->Common.Type)
99 99 {
100 100 case ACPI_TYPE_INTEGER:
101 101
102 102 /* No conversion necessary */
103 103
104 104 *ResultDesc = ObjDesc;
105 105 return_ACPI_STATUS (AE_OK);
106 106
↓ open down ↓ |
88 lines elided |
↑ open up ↑ |
107 107 case ACPI_TYPE_BUFFER:
108 108 case ACPI_TYPE_STRING:
109 109
110 110 /* Note: Takes advantage of common buffer/string fields */
111 111
112 112 Pointer = ObjDesc->Buffer.Pointer;
113 113 Count = ObjDesc->Buffer.Length;
114 114 break;
115 115
116 116 default:
117 +
117 118 return_ACPI_STATUS (AE_TYPE);
118 119 }
119 120
120 121 /*
121 122 * Convert the buffer/string to an integer. Note that both buffers and
122 123 * strings are treated as raw data - we don't convert ascii to hex for
123 124 * strings.
124 125 *
125 126 * There are two terminating conditions for the loop:
126 127 * 1) The size of an integer has been reached, or
127 128 * 2) The end of the buffer or string has been reached
128 129 */
129 130 Result = 0;
130 131
131 132 /* String conversion is different than Buffer conversion */
132 133
133 134 switch (ObjDesc->Common.Type)
134 135 {
135 136 case ACPI_TYPE_STRING:
136 -
137 137 /*
138 138 * Convert string to an integer - for most cases, the string must be
139 139 * hexadecimal as per the ACPI specification. The only exception (as
140 140 * of ACPI 3.0) is that the ToInteger() operator allows both decimal
141 141 * and hexadecimal strings (hex prefixed with "0x").
142 142 */
143 143 Status = AcpiUtStrtoul64 ((char *) Pointer, Flags, &Result);
144 144 if (ACPI_FAILURE (Status))
145 145 {
146 146 return_ACPI_STATUS (Status);
147 147 }
148 148 break;
149 149
150 -
151 150 case ACPI_TYPE_BUFFER:
152 151
153 152 /* Check for zero-length buffer */
154 153
155 154 if (!Count)
156 155 {
157 156 return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
158 157 }
159 158
160 159 /* Transfer no more than an integer's worth of data */
161 160
162 161 if (Count > AcpiGbl_IntegerByteWidth)
163 162 {
164 163 Count = AcpiGbl_IntegerByteWidth;
165 164 }
166 165
167 166 /*
168 167 * Convert buffer to an integer - we simply grab enough raw data
169 168 * from the buffer to fill an integer
170 169 */
171 170 for (i = 0; i < Count; i++)
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
172 171 {
173 172 /*
174 173 * Get next byte and shift it into the Result.
175 174 * Little endian is used, meaning that the first byte of the buffer
176 175 * is the LSB of the integer
177 176 */
178 177 Result |= (((UINT64) Pointer[i]) << (i * 8));
179 178 }
180 179 break;
181 180
182 -
183 181 default:
184 182
185 183 /* No other types can get here */
184 +
186 185 break;
187 186 }
188 187
189 188 /* Create a new integer */
190 189
191 190 ReturnDesc = AcpiUtCreateIntegerObject (Result);
192 191 if (!ReturnDesc)
193 192 {
194 193 return_ACPI_STATUS (AE_NO_MEMORY);
195 194 }
196 195
197 196 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
198 197 ACPI_FORMAT_UINT64 (Result)));
199 198
200 199 /* Save the Result */
201 200
202 - AcpiExTruncateFor32bitTable (ReturnDesc);
201 + (void) AcpiExTruncateFor32bitTable (ReturnDesc);
203 202 *ResultDesc = ReturnDesc;
204 203 return_ACPI_STATUS (AE_OK);
205 204 }
206 205
207 206
208 207 /*******************************************************************************
209 208 *
210 209 * FUNCTION: AcpiExConvertToBuffer
211 210 *
212 211 * PARAMETERS: ObjDesc - Object to be converted. Must be an
213 212 * Integer, Buffer, or String
214 213 * ResultDesc - Where the new buffer object is returned
215 214 *
216 215 * RETURN: Status
217 216 *
218 217 * DESCRIPTION: Convert an ACPI Object to a Buffer
219 218 *
220 219 ******************************************************************************/
221 220
222 221 ACPI_STATUS
223 222 AcpiExConvertToBuffer (
224 223 ACPI_OPERAND_OBJECT *ObjDesc,
225 224 ACPI_OPERAND_OBJECT **ResultDesc)
226 225 {
227 226 ACPI_OPERAND_OBJECT *ReturnDesc;
228 227 UINT8 *NewBuf;
229 228
230 229
231 230 ACPI_FUNCTION_TRACE_PTR (ExConvertToBuffer, ObjDesc);
232 231
233 232
234 233 switch (ObjDesc->Common.Type)
↓ open down ↓ |
22 lines elided |
↑ open up ↑ |
235 234 {
236 235 case ACPI_TYPE_BUFFER:
237 236
238 237 /* No conversion necessary */
239 238
240 239 *ResultDesc = ObjDesc;
241 240 return_ACPI_STATUS (AE_OK);
242 241
243 242
244 243 case ACPI_TYPE_INTEGER:
245 -
246 244 /*
247 245 * Create a new Buffer object.
248 246 * Need enough space for one integer
249 247 */
250 248 ReturnDesc = AcpiUtCreateBufferObject (AcpiGbl_IntegerByteWidth);
251 249 if (!ReturnDesc)
252 250 {
253 251 return_ACPI_STATUS (AE_NO_MEMORY);
254 252 }
255 253
256 254 /* Copy the integer to the buffer, LSB first */
257 255
258 256 NewBuf = ReturnDesc->Buffer.Pointer;
259 257 ACPI_MEMCPY (NewBuf,
260 258 &ObjDesc->Integer.Value,
261 259 AcpiGbl_IntegerByteWidth);
262 260 break;
263 261
264 -
265 262 case ACPI_TYPE_STRING:
266 -
267 263 /*
268 264 * Create a new Buffer object
269 265 * Size will be the string length
270 266 *
271 267 * NOTE: Add one to the string length to include the null terminator.
272 268 * The ACPI spec is unclear on this subject, but there is existing
273 269 * ASL/AML code that depends on the null being transferred to the new
274 270 * buffer.
275 271 */
276 272 ReturnDesc = AcpiUtCreateBufferObject (
277 273 (ACPI_SIZE) ObjDesc->String.Length + 1);
278 274 if (!ReturnDesc)
279 275 {
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
280 276 return_ACPI_STATUS (AE_NO_MEMORY);
281 277 }
282 278
283 279 /* Copy the string to the buffer */
284 280
285 281 NewBuf = ReturnDesc->Buffer.Pointer;
286 282 ACPI_STRNCPY ((char *) NewBuf, (char *) ObjDesc->String.Pointer,
287 283 ObjDesc->String.Length);
288 284 break;
289 285
290 -
291 286 default:
287 +
292 288 return_ACPI_STATUS (AE_TYPE);
293 289 }
294 290
295 291 /* Mark buffer initialized */
296 292
297 293 ReturnDesc->Common.Flags |= AOPOBJ_DATA_VALID;
298 294 *ResultDesc = ReturnDesc;
299 295 return_ACPI_STATUS (AE_OK);
300 296 }
301 297
302 298
303 299 /*******************************************************************************
304 300 *
305 301 * FUNCTION: AcpiExConvertToAscii
306 302 *
307 303 * PARAMETERS: Integer - Value to be converted
308 304 * Base - ACPI_STRING_DECIMAL or ACPI_STRING_HEX
309 305 * String - Where the string is returned
310 306 * DataWidth - Size of data item to be converted, in bytes
311 307 *
312 308 * RETURN: Actual string length
313 309 *
314 310 * DESCRIPTION: Convert an ACPI Integer to a hex or decimal string
315 311 *
316 312 ******************************************************************************/
317 313
318 314 static UINT32
319 315 AcpiExConvertToAscii (
320 316 UINT64 Integer,
321 317 UINT16 Base,
322 318 UINT8 *String,
323 319 UINT8 DataWidth)
324 320 {
325 321 UINT64 Digit;
326 322 UINT32 i;
327 323 UINT32 j;
328 324 UINT32 k = 0;
329 325 UINT32 HexLength;
330 326 UINT32 DecimalLength;
331 327 UINT32 Remainder;
332 328 BOOLEAN SupressZeros;
333 329
334 330
335 331 ACPI_FUNCTION_ENTRY ();
336 332
↓ open down ↓ |
35 lines elided |
↑ open up ↑ |
337 333
338 334 switch (Base)
339 335 {
340 336 case 10:
341 337
342 338 /* Setup max length for the decimal number */
343 339
344 340 switch (DataWidth)
345 341 {
346 342 case 1:
343 +
347 344 DecimalLength = ACPI_MAX8_DECIMAL_DIGITS;
348 345 break;
349 346
350 347 case 4:
348 +
351 349 DecimalLength = ACPI_MAX32_DECIMAL_DIGITS;
352 350 break;
353 351
354 352 case 8:
355 353 default:
354 +
356 355 DecimalLength = ACPI_MAX64_DECIMAL_DIGITS;
357 356 break;
358 357 }
359 358
360 359 SupressZeros = TRUE; /* No leading zeros */
361 360 Remainder = 0;
362 361
363 362 for (i = DecimalLength; i > 0; i--)
364 363 {
365 364 /* Divide by nth factor of 10 */
366 365
367 366 Digit = Integer;
368 367 for (j = 0; j < i; j++)
369 368 {
370 369 (void) AcpiUtShortDivide (Digit, 10, &Digit, &Remainder);
371 370 }
372 371
373 372 /* Handle leading zeros */
374 373
375 374 if (Remainder != 0)
376 375 {
377 376 SupressZeros = FALSE;
378 377 }
379 378
380 379 if (!SupressZeros)
381 380 {
382 381 String[k] = (UINT8) (ACPI_ASCII_ZERO + Remainder);
383 382 k++;
384 383 }
385 384 }
386 385 break;
387 386
388 387 case 16:
389 388
390 389 /* HexLength: 2 ascii hex chars per data byte */
391 390
392 391 HexLength = ACPI_MUL_2 (DataWidth);
393 392 for (i = 0, j = (HexLength-1); i < HexLength; i++, j--)
394 393 {
395 394 /* Get one hex digit, most significant digits first */
396 395
397 396 String[k] = (UINT8) AcpiUtHexToAsciiChar (Integer, ACPI_MUL_4 (j));
398 397 k++;
399 398 }
400 399 break;
401 400
402 401 default:
403 402 return (0);
404 403 }
405 404
406 405 /*
407 406 * Since leading zeros are suppressed, we must check for the case where
408 407 * the integer equals 0
409 408 *
410 409 * Finally, null terminate the string and return the length
411 410 */
412 411 if (!k)
413 412 {
414 413 String [0] = ACPI_ASCII_ZERO;
415 414 k = 1;
416 415 }
417 416
418 417 String [k] = 0;
419 418 return ((UINT32) k);
420 419 }
421 420
422 421
423 422 /*******************************************************************************
424 423 *
425 424 * FUNCTION: AcpiExConvertToString
426 425 *
427 426 * PARAMETERS: ObjDesc - Object to be converted. Must be an
428 427 * Integer, Buffer, or String
429 428 * ResultDesc - Where the string object is returned
430 429 * Type - String flags (base and conversion type)
431 430 *
432 431 * RETURN: Status
433 432 *
434 433 * DESCRIPTION: Convert an ACPI Object to a string
435 434 *
436 435 ******************************************************************************/
437 436
438 437 ACPI_STATUS
439 438 AcpiExConvertToString (
440 439 ACPI_OPERAND_OBJECT *ObjDesc,
441 440 ACPI_OPERAND_OBJECT **ResultDesc,
442 441 UINT32 Type)
443 442 {
444 443 ACPI_OPERAND_OBJECT *ReturnDesc;
445 444 UINT8 *NewBuf;
446 445 UINT32 i;
447 446 UINT32 StringLength = 0;
448 447 UINT16 Base = 16;
449 448 UINT8 Separator = ',';
450 449
451 450
452 451 ACPI_FUNCTION_TRACE_PTR (ExConvertToString, ObjDesc);
453 452
↓ open down ↓ |
88 lines elided |
↑ open up ↑ |
454 453
455 454 switch (ObjDesc->Common.Type)
456 455 {
457 456 case ACPI_TYPE_STRING:
458 457
459 458 /* No conversion necessary */
460 459
461 460 *ResultDesc = ObjDesc;
462 461 return_ACPI_STATUS (AE_OK);
463 462
464 -
465 463 case ACPI_TYPE_INTEGER:
466 464
467 465 switch (Type)
468 466 {
469 467 case ACPI_EXPLICIT_CONVERT_DECIMAL:
470 468
471 469 /* Make room for maximum decimal number */
472 470
473 471 StringLength = ACPI_MAX_DECIMAL_DIGITS;
474 472 Base = 10;
475 473 break;
476 474
477 475 default:
478 476
479 477 /* Two hex string characters for each integer byte */
480 478
481 479 StringLength = ACPI_MUL_2 (AcpiGbl_IntegerByteWidth);
482 480 break;
483 481 }
484 482
485 483 /*
486 484 * Create a new String
487 485 * Need enough space for one ASCII integer (plus null terminator)
488 486 */
489 487 ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength);
490 488 if (!ReturnDesc)
491 489 {
492 490 return_ACPI_STATUS (AE_NO_MEMORY);
493 491 }
494 492
495 493 NewBuf = ReturnDesc->Buffer.Pointer;
496 494
497 495 /* Convert integer to string */
↓ open down ↓ |
23 lines elided |
↑ open up ↑ |
498 496
499 497 StringLength = AcpiExConvertToAscii (ObjDesc->Integer.Value, Base,
500 498 NewBuf, AcpiGbl_IntegerByteWidth);
501 499
502 500 /* Null terminate at the correct place */
503 501
504 502 ReturnDesc->String.Length = StringLength;
505 503 NewBuf [StringLength] = 0;
506 504 break;
507 505
508 -
509 506 case ACPI_TYPE_BUFFER:
510 507
511 508 /* Setup string length, base, and separator */
512 509
513 510 switch (Type)
514 511 {
515 512 case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by ToDecimalString */
516 513 /*
517 514 * From ACPI: "If Data is a buffer, it is converted to a string of
518 515 * decimal values separated by commas."
519 516 */
520 517 Base = 10;
521 518
522 519 /*
523 520 * Calculate the final string length. Individual string values
524 521 * are variable length (include separator for each)
525 522 */
526 523 for (i = 0; i < ObjDesc->Buffer.Length; i++)
527 524 {
528 525 if (ObjDesc->Buffer.Pointer[i] >= 100)
529 526 {
530 527 StringLength += 4;
531 528 }
532 529 else if (ObjDesc->Buffer.Pointer[i] >= 10)
533 530 {
534 531 StringLength += 3;
535 532 }
536 533 else
537 534 {
538 535 StringLength += 2;
539 536 }
540 537 }
541 538 break;
542 539
543 540 case ACPI_IMPLICIT_CONVERT_HEX:
544 541 /*
545 542 * From the ACPI spec:
546 543 *"The entire contents of the buffer are converted to a string of
547 544 * two-character hexadecimal numbers, each separated by a space."
548 545 */
549 546 Separator = ' ';
550 547 StringLength = (ObjDesc->Buffer.Length * 3);
551 548 break;
552 549
553 550 case ACPI_EXPLICIT_CONVERT_HEX: /* Used by ToHexString */
554 551 /*
555 552 * From ACPI: "If Data is a buffer, it is converted to a string of
556 553 * hexadecimal values separated by commas."
557 554 */
558 555 StringLength = (ObjDesc->Buffer.Length * 3);
559 556 break;
560 557
561 558 default:
562 559 return_ACPI_STATUS (AE_BAD_PARAMETER);
563 560 }
564 561
565 562 /*
566 563 * Create a new string object and string buffer
567 564 * (-1 because of extra separator included in StringLength from above)
568 565 * Allow creation of zero-length strings from zero-length buffers.
569 566 */
570 567 if (StringLength)
571 568 {
572 569 StringLength--;
573 570 }
574 571
575 572 ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength);
576 573 if (!ReturnDesc)
577 574 {
578 575 return_ACPI_STATUS (AE_NO_MEMORY);
579 576 }
580 577
581 578 NewBuf = ReturnDesc->Buffer.Pointer;
582 579
583 580 /*
584 581 * Convert buffer bytes to hex or decimal values
585 582 * (separated by commas or spaces)
586 583 */
587 584 for (i = 0; i < ObjDesc->Buffer.Length; i++)
588 585 {
589 586 NewBuf += AcpiExConvertToAscii (
590 587 (UINT64) ObjDesc->Buffer.Pointer[i], Base,
591 588 NewBuf, 1);
592 589 *NewBuf++ = Separator; /* each separated by a comma or space */
593 590 }
594 591
595 592 /*
596 593 * Null terminate the string
↓ open down ↓ |
78 lines elided |
↑ open up ↑ |
597 594 * (overwrites final comma/space from above)
598 595 */
599 596 if (ObjDesc->Buffer.Length)
600 597 {
601 598 NewBuf--;
602 599 }
603 600 *NewBuf = 0;
604 601 break;
605 602
606 603 default:
604 +
607 605 return_ACPI_STATUS (AE_TYPE);
608 606 }
609 607
610 608 *ResultDesc = ReturnDesc;
611 609 return_ACPI_STATUS (AE_OK);
612 610 }
613 611
614 612
615 613 /*******************************************************************************
616 614 *
617 615 * FUNCTION: AcpiExConvertToTargetType
618 616 *
619 617 * PARAMETERS: DestinationType - Current type of the destination
620 618 * SourceDesc - Source object to be converted.
621 619 * ResultDesc - Where the converted object is returned
622 620 * WalkState - Current method state
623 621 *
624 622 * RETURN: Status
625 623 *
626 624 * DESCRIPTION: Implements "implicit conversion" rules for storing an object.
627 625 *
628 626 ******************************************************************************/
629 627
630 628 ACPI_STATUS
631 629 AcpiExConvertToTargetType (
632 630 ACPI_OBJECT_TYPE DestinationType,
633 631 ACPI_OPERAND_OBJECT *SourceDesc,
634 632 ACPI_OPERAND_OBJECT **ResultDesc,
635 633 ACPI_WALK_STATE *WalkState)
636 634 {
637 635 ACPI_STATUS Status = AE_OK;
638 636
639 637
640 638 ACPI_FUNCTION_TRACE (ExConvertToTargetType);
641 639
642 640
643 641 /* Default behavior */
644 642
645 643 *ResultDesc = SourceDesc;
646 644
647 645 /*
648 646 * If required by the target,
649 647 * perform implicit conversion on the source before we store it.
650 648 */
651 649 switch (GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs))
652 650 {
653 651 case ARGI_SIMPLE_TARGET:
654 652 case ARGI_FIXED_TARGET:
655 653 case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */
↓ open down ↓ |
39 lines elided |
↑ open up ↑ |
656 654
657 655 switch (DestinationType)
658 656 {
659 657 case ACPI_TYPE_LOCAL_REGION_FIELD:
660 658 /*
661 659 * Named field can always handle conversions
662 660 */
663 661 break;
664 662
665 663 default:
664 +
666 665 /* No conversion allowed for these types */
667 666
668 667 if (DestinationType != SourceDesc->Common.Type)
669 668 {
670 669 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
671 670 "Explicit operator, will store (%s) over existing type (%s)\n",
672 671 AcpiUtGetObjectTypeName (SourceDesc),
673 672 AcpiUtGetTypeName (DestinationType)));
674 673 Status = AE_TYPE;
675 674 }
676 675 }
677 676 break;
678 677
679 -
680 678 case ARGI_TARGETREF:
681 679
682 680 switch (DestinationType)
683 681 {
684 682 case ACPI_TYPE_INTEGER:
685 683 case ACPI_TYPE_BUFFER_FIELD:
686 684 case ACPI_TYPE_LOCAL_BANK_FIELD:
687 685 case ACPI_TYPE_LOCAL_INDEX_FIELD:
688 686 /*
689 687 * These types require an Integer operand. We can convert
690 688 * a Buffer or a String to an Integer if necessary.
691 689 */
692 690 Status = AcpiExConvertToInteger (SourceDesc, ResultDesc,
693 691 16);
694 692 break;
695 693
696 -
697 694 case ACPI_TYPE_STRING:
698 695 /*
699 696 * The operand must be a String. We can convert an
700 697 * Integer or Buffer if necessary
701 698 */
702 699 Status = AcpiExConvertToString (SourceDesc, ResultDesc,
703 700 ACPI_IMPLICIT_CONVERT_HEX);
704 701 break;
705 702
706 -
707 703 case ACPI_TYPE_BUFFER:
708 704 /*
709 705 * The operand must be a Buffer. We can convert an
710 706 * Integer or String if necessary
711 707 */
712 708 Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc);
713 709 break;
714 710
715 -
716 711 default:
712 +
717 713 ACPI_ERROR ((AE_INFO, "Bad destination type during conversion: 0x%X",
718 714 DestinationType));
719 715 Status = AE_AML_INTERNAL;
720 716 break;
721 717 }
722 718 break;
723 719
724 -
725 720 case ARGI_REFERENCE:
726 721 /*
727 722 * CreateXxxxField cases - we are storing the field object into the name
728 723 */
729 724 break;
730 725
731 -
732 726 default:
727 +
733 728 ACPI_ERROR ((AE_INFO,
734 729 "Unknown Target type ID 0x%X AmlOpcode 0x%X DestType %s",
735 730 GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs),
736 731 WalkState->Opcode, AcpiUtGetTypeName (DestinationType)));
737 732 Status = AE_AML_INTERNAL;
738 733 }
739 734
740 735 /*
741 736 * Source-to-Target conversion semantics:
742 737 *
743 738 * If conversion to the target type cannot be performed, then simply
744 739 * overwrite the target with the new object and type.
745 740 */
746 741 if (Status == AE_TYPE)
747 742 {
748 743 Status = AE_OK;
749 744 }
750 745
751 746 return_ACPI_STATUS (Status);
752 747 }
753 -
754 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX