Deleted Added
sdiff udiff text old ( 99146 ) new ( 99679 )
full compact
1/******************************************************************************
2 *
3 * Module Name: exconvrt - Object conversion routines
4 * $Revision: 32 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
21 *
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
28 *
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
37 *
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
40 *
41 * 3. Conditions
42 *
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
54 *
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
66 *
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
75 *
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
80 *
81 * 4. Disclaimer and Export Compliance
82 *
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
90 *
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
99 *
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117
118#define __EXCONVRT_C__
119
120#include "acpi.h"
121#include "acparser.h"
122#include "acnamesp.h"
123#include "acinterp.h"
124#include "acevents.h"
125#include "amlcode.h"
126#include "acdispat.h"
127
128
129#define _COMPONENT ACPI_EXECUTER
130 ACPI_MODULE_NAME ("exconvrt")
131
132
133/*******************************************************************************
134 *
135 * FUNCTION: AcpiExConvertToInteger
136 *
137 * PARAMETERS: *ObjDesc - Object to be converted. Must be an
138 * Integer, Buffer, or String
139 * WalkState - Current method state
140 *
141 * RETURN: Status
142 *
143 * DESCRIPTION: Convert an ACPI Object to an integer.
144 *
145 ******************************************************************************/
146
147ACPI_STATUS
148AcpiExConvertToInteger (
149 ACPI_OPERAND_OBJECT *ObjDesc,
150 ACPI_OPERAND_OBJECT **ResultDesc,
151 ACPI_WALK_STATE *WalkState)
152{
153 UINT32 i;
154 ACPI_OPERAND_OBJECT *RetDesc;
155 UINT32 Count;
156 char *Pointer;
157 ACPI_INTEGER Result;
158 UINT32 IntegerSize = sizeof (ACPI_INTEGER);
159
160
161 ACPI_FUNCTION_TRACE_PTR ("ExConvertToInteger", ObjDesc);
162
163
164 switch (ObjDesc->Common.Type)
165 {
166 case ACPI_TYPE_INTEGER:
167 *ResultDesc = ObjDesc;
168 return_ACPI_STATUS (AE_OK);
169
170 case ACPI_TYPE_STRING:
171 Pointer = ObjDesc->String.Pointer;
172 Count = ObjDesc->String.Length;
173 break;
174
175 case ACPI_TYPE_BUFFER:
176 Pointer = (char *) ObjDesc->Buffer.Pointer;
177 Count = ObjDesc->Buffer.Length;
178 break;
179
180 default:
181 return_ACPI_STATUS (AE_TYPE);
182 }
183
184 /*
185 * Create a new integer
186 */
187 RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
188 if (!RetDesc)
189 {
190 return_ACPI_STATUS (AE_NO_MEMORY);
191 }
192
193 /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
194
195 if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
196 {
197 /*
198 * We are running a method that exists in a 32-bit ACPI table.
199 * Truncate the value to 32 bits by zeroing out the upper 32-bit field
200 */
201 IntegerSize = sizeof (UINT32);
202 }
203
204 /*
205 * Convert the buffer/string to an integer. Note that both buffers and
206 * strings are treated as raw data - we don't convert ascii to hex for
207 * strings.
208 *
209 * There are two terminating conditions for the loop:
210 * 1) The size of an integer has been reached, or
211 * 2) The end of the buffer or string has been reached
212 */
213 Result = 0;
214
215 /* Transfer no more than an integer's worth of data */
216
217 if (Count > IntegerSize)
218 {
219 Count = IntegerSize;
220 }
221
222 /*
223 * String conversion is different than Buffer conversion
224 */
225 switch (ObjDesc->Common.Type)
226 {
227 case ACPI_TYPE_STRING:
228
229 /* TBD: Need to use 64-bit ACPI_STRTOUL */
230
231 /*
232 * Convert string to an integer
233 * String must be hexadecimal as per the ACPI specification
234 */
235 Result = ACPI_STRTOUL (Pointer, NULL, 16);
236 break;
237
238
239 case ACPI_TYPE_BUFFER:
240
241 /*
242 * Buffer conversion - we simply grab enough raw data from the
243 * buffer to fill an integer
244 */
245 for (i = 0; i < Count; i++)
246 {
247 /*
248 * Get next byte and shift it into the Result.
249 * Little endian is used, meaning that the first byte of the buffer
250 * is the LSB of the integer
251 */
252 Result |= (((ACPI_INTEGER) Pointer[i]) << (i * 8));
253 }
254 break;
255 }
256
257 /* Save the Result, delete original descriptor, store new descriptor */
258
259 RetDesc->Integer.Value = Result;
260
261 if (*ResultDesc == ObjDesc)
262 {
263 if (WalkState->Opcode != AML_STORE_OP)
264 {
265 AcpiUtRemoveReference (ObjDesc);
266 }
267 }
268
269 *ResultDesc = RetDesc;
270 return_ACPI_STATUS (AE_OK);
271}
272
273
274/*******************************************************************************
275 *
276 * FUNCTION: AcpiExConvertToBuffer
277 *
278 * PARAMETERS: *ObjDesc - Object to be converted. Must be an
279 * Integer, Buffer, or String
280 * WalkState - Current method state
281 *
282 * RETURN: Status
283 *
284 * DESCRIPTION: Convert an ACPI Object to an Buffer
285 *
286 ******************************************************************************/
287
288ACPI_STATUS
289AcpiExConvertToBuffer (
290 ACPI_OPERAND_OBJECT *ObjDesc,
291 ACPI_OPERAND_OBJECT **ResultDesc,
292 ACPI_WALK_STATE *WalkState)
293{
294 ACPI_OPERAND_OBJECT *RetDesc;
295 UINT32 i;
296 UINT32 IntegerSize = sizeof (ACPI_INTEGER);
297 UINT8 *NewBuf;
298
299
300 ACPI_FUNCTION_TRACE_PTR ("ExConvertToBuffer", ObjDesc);
301
302
303 switch (ObjDesc->Common.Type)
304 {
305 case ACPI_TYPE_INTEGER:
306
307 /*
308 * Create a new Buffer
309 */
310 RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
311 if (!RetDesc)
312 {
313 return_ACPI_STATUS (AE_NO_MEMORY);
314 }
315
316 /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
317
318 if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
319 {
320 /*
321 * We are running a method that exists in a 32-bit ACPI table.
322 * Use only 32 bits of the Integer for conversion.
323 */
324 IntegerSize = sizeof (UINT32);
325 }
326
327 /* Need enough space for one integer */
328
329 RetDesc->Buffer.Length = IntegerSize;
330 NewBuf = ACPI_MEM_CALLOCATE (IntegerSize);
331 if (!NewBuf)
332 {
333 ACPI_REPORT_ERROR
334 (("ExConvertToBuffer: Buffer allocation failure\n"));
335 AcpiUtRemoveReference (RetDesc);
336 return_ACPI_STATUS (AE_NO_MEMORY);
337 }
338
339 /* Copy the integer to the buffer */
340
341 for (i = 0; i < IntegerSize; i++)
342 {
343 NewBuf[i] = (UINT8) (ObjDesc->Integer.Value >> (i * 8));
344 }
345 RetDesc->Buffer.Pointer = NewBuf;
346
347 /* Return the new buffer descriptor */
348
349 *ResultDesc = RetDesc;
350 break;
351
352
353 case ACPI_TYPE_STRING:
354 *ResultDesc = ObjDesc;
355 break;
356
357
358 case ACPI_TYPE_BUFFER:
359 *ResultDesc = ObjDesc;
360 break;
361
362
363 default:
364 return_ACPI_STATUS (AE_TYPE);
365 }
366
367 /* Mark buffer initialized */
368
369 (*ResultDesc)->Common.Flags |= AOPOBJ_DATA_VALID;
370 return_ACPI_STATUS (AE_OK);
371}
372
373
374/*******************************************************************************
375 *
376 * FUNCTION: AcpiExConvertAscii
377 *
378 * PARAMETERS: Integer
379 *
380 * RETURN: Actual string length
381 *
382 * DESCRIPTION: Convert an ACPI Integer to a hex string
383 *
384 ******************************************************************************/
385
386UINT32
387AcpiExConvertToAscii (
388 ACPI_INTEGER Integer,
389 UINT32 Base,
390 UINT8 *String)
391{
392 UINT32 i;
393 UINT32 j;
394 UINT32 k = 0;
395 UINT8 HexDigit;
396 ACPI_INTEGER Digit;
397 UINT32 Remainder;
398 UINT32 Length = sizeof (ACPI_INTEGER);
399 BOOLEAN LeadingZero = TRUE;
400
401
402 ACPI_FUNCTION_ENTRY ();
403
404
405 switch (Base)
406 {
407 case 10:
408
409 Remainder = 0;
410 for (i = ACPI_MAX_DECIMAL_DIGITS; i > 0 ; i--)
411 {
412 /* Divide by nth factor of 10 */
413
414 Digit = Integer;
415 for (j = 1; j < i; j++)
416 {
417 AcpiUtShortDivide (&Digit, 10, &Digit, &Remainder);
418 }
419
420 /* Create the decimal digit */
421
422 if (Digit != 0)
423 {
424 LeadingZero = FALSE;
425 }
426
427 if (!LeadingZero)
428 {
429 String[k] = (UINT8) (ACPI_ASCII_ZERO + Remainder);
430 k++;
431 }
432 }
433 break;
434
435 case 16:
436
437 /* Copy the integer to the buffer */
438
439 for (i = 0, j = ((Length * 2) -1); i < (Length * 2); i++, j--)
440 {
441
442 HexDigit = AcpiUtHexToAsciiChar (Integer, (j * 4));
443 if (HexDigit != ACPI_ASCII_ZERO)
444 {
445 LeadingZero = FALSE;
446 }
447
448 if (!LeadingZero)
449 {
450 String[k] = HexDigit;
451 k++;
452 }
453 }
454 break;
455
456 default:
457 break;
458 }
459
460 /*
461 * Since leading zeros are supressed, we must check for the case where
462 * the integer equals 0.
463 *
464 * Finally, null terminate the string and return the length
465 */
466 if (!k)
467 {
468 String [0] = ACPI_ASCII_ZERO;
469 k = 1;
470 }
471 String [k] = 0;
472
473 return (k);
474}
475
476
477/*******************************************************************************
478 *
479 * FUNCTION: AcpiExConvertToString
480 *
481 * PARAMETERS: *ObjDesc - Object to be converted. Must be an
482 * Integer, Buffer, or String
483 * WalkState - Current method state
484 *
485 * RETURN: Status
486 *
487 * DESCRIPTION: Convert an ACPI Object to a string
488 *
489 ******************************************************************************/
490
491ACPI_STATUS
492AcpiExConvertToString (
493 ACPI_OPERAND_OBJECT *ObjDesc,
494 ACPI_OPERAND_OBJECT **ResultDesc,
495 UINT32 Base,
496 UINT32 MaxLength,
497 ACPI_WALK_STATE *WalkState)
498{
499 ACPI_OPERAND_OBJECT *RetDesc;
500 UINT32 i;
501 UINT32 Index;
502 UINT32 StringLength;
503 UINT32 IntegerSize = sizeof (ACPI_INTEGER);
504 UINT8 *NewBuf;
505 UINT8 *Pointer;
506
507
508 ACPI_FUNCTION_TRACE_PTR ("ExConvertToString", ObjDesc);
509
510
511 switch (ObjDesc->Common.Type)
512 {
513 case ACPI_TYPE_INTEGER:
514
515 /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
516
517 if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
518 {
519 /*
520 * We are running a method that exists in a 32-bit ACPI table.
521 * Use only 32 bits of the Integer
522 */
523 IntegerSize = sizeof (UINT32);
524 }
525
526 StringLength = IntegerSize * 2;
527 if (Base == 10)
528 {
529 StringLength = ACPI_MAX_DECIMAL_DIGITS;
530 }
531
532 /*
533 * Create a new String
534 */
535 RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING);
536 if (!RetDesc)
537 {
538 return_ACPI_STATUS (AE_NO_MEMORY);
539 }
540
541 /* Need enough space for one ASCII integer plus null terminator */
542
543 NewBuf = ACPI_MEM_CALLOCATE (StringLength + 1);
544 if (!NewBuf)
545 {
546 ACPI_REPORT_ERROR
547 (("ExConvertToString: Buffer allocation failure\n"));
548 AcpiUtRemoveReference (RetDesc);
549 return_ACPI_STATUS (AE_NO_MEMORY);
550 }
551
552
553 /* Convert */
554
555 i = AcpiExConvertToAscii (ObjDesc->Integer.Value, Base, NewBuf);
556
557 /* Null terminate at the correct place */
558
559 if (MaxLength < i)
560 {
561 NewBuf[MaxLength] = 0;
562 RetDesc->String.Length = MaxLength;
563 }
564 else
565 {
566 NewBuf [i] = 0;
567 RetDesc->String.Length = i;
568 }
569
570 RetDesc->Buffer.Pointer = NewBuf;
571
572 /* Return the new buffer descriptor */
573
574 if (*ResultDesc == ObjDesc)
575 {
576 if (WalkState->Opcode != AML_STORE_OP)
577 {
578 AcpiUtRemoveReference (ObjDesc);
579 }
580 }
581
582 *ResultDesc = RetDesc;
583 break;
584
585
586 case ACPI_TYPE_BUFFER:
587
588 StringLength = ObjDesc->Buffer.Length * 3;
589 if (Base == 10)
590 {
591 StringLength = ObjDesc->Buffer.Length * 4;
592 }
593
594 if (MaxLength > ACPI_MAX_STRING_CONVERSION)
595 {
596 if (StringLength > ACPI_MAX_STRING_CONVERSION)
597 {
598 return_ACPI_STATUS (AE_AML_STRING_LIMIT);
599 }
600 }
601
602 /*
603 * Create a new string object
604 */
605 RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING);
606 if (!RetDesc)
607 {
608 return_ACPI_STATUS (AE_NO_MEMORY);
609 }
610
611 /* String length is the lesser of the Max or the actual length */
612
613 if (MaxLength < StringLength)
614 {
615 StringLength = MaxLength;
616 }
617
618 NewBuf = ACPI_MEM_CALLOCATE (StringLength + 1);
619 if (!NewBuf)
620 {
621 ACPI_REPORT_ERROR
622 (("ExConvertToString: Buffer allocation failure\n"));
623 AcpiUtRemoveReference (RetDesc);
624 return_ACPI_STATUS (AE_NO_MEMORY);
625 }
626
627 /*
628 * Convert each byte of the buffer to two ASCII characters plus a space.
629 */
630 Pointer = ObjDesc->Buffer.Pointer;
631 Index = 0;
632 for (i = 0, Index = 0; i < ObjDesc->Buffer.Length; i++)
633 {
634 Index = AcpiExConvertToAscii (Pointer[i], Base, &NewBuf[Index]);
635
636 NewBuf[Index] = ' ';
637 Index++;
638 }
639
640 /* Null terminate */
641
642 NewBuf [Index-1] = 0;
643 RetDesc->Buffer.Pointer = NewBuf;
644 RetDesc->String.Length = ACPI_STRLEN ((char *) NewBuf);
645
646
647 /* Return the new buffer descriptor */
648
649 if (*ResultDesc == ObjDesc)
650 {
651 if (WalkState->Opcode != AML_STORE_OP)
652 {
653 AcpiUtRemoveReference (ObjDesc);
654 }
655 }
656
657 *ResultDesc = RetDesc;
658 break;
659
660
661 case ACPI_TYPE_STRING:
662
663 if (MaxLength >= ObjDesc->String.Length)
664 {
665 *ResultDesc = ObjDesc;
666 }
667
668 else
669 {
670 /* Must copy the string first and then truncate it */
671
672 return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
673 }
674 break;
675
676
677 default:
678 return_ACPI_STATUS (AE_TYPE);
679 }
680
681 return_ACPI_STATUS (AE_OK);
682}
683
684
685/*******************************************************************************
686 *
687 * FUNCTION: AcpiExConvertToTargetType
688 *
689 * PARAMETERS: DestinationType - Current type of the destination
690 * SourceDesc - Source object to be converted.
691 * WalkState - Current method state
692 *
693 * RETURN: Status
694 *
695 * DESCRIPTION: Implements "implicit conversion" rules for storing an object.
696 *
697 ******************************************************************************/
698
699ACPI_STATUS
700AcpiExConvertToTargetType (
701 ACPI_OBJECT_TYPE DestinationType,
702 ACPI_OPERAND_OBJECT *SourceDesc,
703 ACPI_OPERAND_OBJECT **ResultDesc,
704 ACPI_WALK_STATE *WalkState)
705{
706 ACPI_STATUS Status = AE_OK;
707
708
709 ACPI_FUNCTION_TRACE ("ExConvertToTargetType");
710
711
712 /* Default behavior */
713
714 *ResultDesc = SourceDesc;
715
716 /*
717 * If required by the target,
718 * perform implicit conversion on the source before we store it.
719 */
720 switch (GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs))
721 {
722 case ARGI_SIMPLE_TARGET:
723 case ARGI_FIXED_TARGET:
724 case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */
725
726 switch (DestinationType)
727 {
728 case INTERNAL_TYPE_REGION_FIELD:
729 /*
730 * Named field can always handle conversions
731 */
732 break;
733
734 default:
735 /* No conversion allowed for these types */
736
737 if (DestinationType != SourceDesc->Common.Type)
738 {
739 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
740 "Target does not allow conversion of type %s to %s\n",
741 AcpiUtGetTypeName ((SourceDesc)->Common.Type),
742 AcpiUtGetTypeName (DestinationType)));
743 Status = AE_TYPE;
744 }
745 }
746 break;
747
748
749 case ARGI_TARGETREF:
750
751 switch (DestinationType)
752 {
753 case ACPI_TYPE_INTEGER:
754 case ACPI_TYPE_BUFFER_FIELD:
755 case INTERNAL_TYPE_BANK_FIELD:
756 case INTERNAL_TYPE_INDEX_FIELD:
757 /*
758 * These types require an Integer operand. We can convert
759 * a Buffer or a String to an Integer if necessary.
760 */
761 Status = AcpiExConvertToInteger (SourceDesc, ResultDesc, WalkState);
762 break;
763
764
765 case ACPI_TYPE_STRING:
766
767 /*
768 * The operand must be a String. We can convert an
769 * Integer or Buffer if necessary
770 */
771 Status = AcpiExConvertToString (SourceDesc, ResultDesc, 16, ACPI_UINT32_MAX, WalkState);
772 break;
773
774
775 case ACPI_TYPE_BUFFER:
776
777 /*
778 * The operand must be a Buffer. We can convert an
779 * Integer or String if necessary
780 */
781 Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc, WalkState);
782 break;
783 }
784 break;
785
786
787 case ARGI_REFERENCE:
788 /*
789 * CreateXxxxField cases - we are storing the field object into the name
790 */
791 break;
792
793
794 default:
795 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
796 "Unknown Target type ID 0x%X Op %s DestType %s\n",
797 GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs),
798 WalkState->OpInfo->Name, AcpiUtGetTypeName (DestinationType)));
799
800 Status = AE_AML_INTERNAL;
801 }
802
803
804 /*
805 * Source-to-Target conversion semantics:
806 *
807 * If conversion to the target type cannot be performed, then simply
808 * overwrite the target with the new object and type.
809 */
810 if (Status == AE_TYPE)
811 {
812 Status = AE_OK;
813 }
814
815 return_ACPI_STATUS (Status);
816}
817
818