Deleted Added
full compact
exconvrt.c (151937) exconvrt.c (167802)
1/******************************************************************************
2 *
3 * Module Name: exconvrt - Object conversion routines
1/******************************************************************************
2 *
3 * Module Name: exconvrt - Object conversion routines
4 * $Revision: 1.67 $
4 * $Revision: 1.74 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
12 * Some or all of this work - Copyright (c) 1999 - 2007, 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.

--- 138 unchanged lines hidden (view full) ---

159 ACPI_OPERAND_OBJECT *ReturnDesc;
160 UINT8 *Pointer;
161 ACPI_INTEGER Result;
162 UINT32 i;
163 UINT32 Count;
164 ACPI_STATUS Status;
165
166
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.

--- 138 unchanged lines hidden (view full) ---

159 ACPI_OPERAND_OBJECT *ReturnDesc;
160 UINT8 *Pointer;
161 ACPI_INTEGER Result;
162 UINT32 i;
163 UINT32 Count;
164 ACPI_STATUS Status;
165
166
167 ACPI_FUNCTION_TRACE_PTR ("ExConvertToInteger", ObjDesc);
167 ACPI_FUNCTION_TRACE_PTR (ExConvertToInteger, ObjDesc);
168
169
170 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
171 {
172 case ACPI_TYPE_INTEGER:
173
174 /* No conversion necessary */
175

--- 84 unchanged lines hidden (view full) ---

260 /* Create a new integer */
261
262 ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
263 if (!ReturnDesc)
264 {
265 return_ACPI_STATUS (AE_NO_MEMORY);
266 }
267
168
169
170 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
171 {
172 case ACPI_TYPE_INTEGER:
173
174 /* No conversion necessary */
175

--- 84 unchanged lines hidden (view full) ---

260 /* Create a new integer */
261
262 ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
263 if (!ReturnDesc)
264 {
265 return_ACPI_STATUS (AE_NO_MEMORY);
266 }
267
268 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
269 ACPI_FORMAT_UINT64 (Result)));
270
268 /* Save the Result */
269
270 ReturnDesc->Integer.Value = Result;
271 AcpiExTruncateFor32bitTable (ReturnDesc);
272 *ResultDesc = ReturnDesc;
273 return_ACPI_STATUS (AE_OK);
274}
275

--- 16 unchanged lines hidden (view full) ---

292AcpiExConvertToBuffer (
293 ACPI_OPERAND_OBJECT *ObjDesc,
294 ACPI_OPERAND_OBJECT **ResultDesc)
295{
296 ACPI_OPERAND_OBJECT *ReturnDesc;
297 UINT8 *NewBuf;
298
299
271 /* Save the Result */
272
273 ReturnDesc->Integer.Value = Result;
274 AcpiExTruncateFor32bitTable (ReturnDesc);
275 *ResultDesc = ReturnDesc;
276 return_ACPI_STATUS (AE_OK);
277}
278

--- 16 unchanged lines hidden (view full) ---

295AcpiExConvertToBuffer (
296 ACPI_OPERAND_OBJECT *ObjDesc,
297 ACPI_OPERAND_OBJECT **ResultDesc)
298{
299 ACPI_OPERAND_OBJECT *ReturnDesc;
300 UINT8 *NewBuf;
301
302
300 ACPI_FUNCTION_TRACE_PTR ("ExConvertToBuffer", ObjDesc);
303 ACPI_FUNCTION_TRACE_PTR (ExConvertToBuffer, ObjDesc);
301
302
303 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
304 {
305 case ACPI_TYPE_BUFFER:
306
307 /* No conversion necessary */
308

--- 204 unchanged lines hidden (view full) ---

513 ACPI_OPERAND_OBJECT *ReturnDesc;
514 UINT8 *NewBuf;
515 UINT32 i;
516 UINT32 StringLength = 0;
517 UINT16 Base = 16;
518 UINT8 Separator = ',';
519
520
304
305
306 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
307 {
308 case ACPI_TYPE_BUFFER:
309
310 /* No conversion necessary */
311

--- 204 unchanged lines hidden (view full) ---

516 ACPI_OPERAND_OBJECT *ReturnDesc;
517 UINT8 *NewBuf;
518 UINT32 i;
519 UINT32 StringLength = 0;
520 UINT16 Base = 16;
521 UINT8 Separator = ',';
522
523
521 ACPI_FUNCTION_TRACE_PTR ("ExConvertToString", ObjDesc);
524 ACPI_FUNCTION_TRACE_PTR (ExConvertToString, ObjDesc);
522
523
524 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
525 {
526 case ACPI_TYPE_STRING:
527
528 /* No conversion necessary */
529

--- 97 unchanged lines hidden (view full) ---

627 StringLength = (ObjDesc->Buffer.Length * 3);
628 break;
629
630 default:
631 return_ACPI_STATUS (AE_BAD_PARAMETER);
632 }
633
634 /*
525
526
527 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
528 {
529 case ACPI_TYPE_STRING:
530
531 /* No conversion necessary */
532

--- 97 unchanged lines hidden (view full) ---

630 StringLength = (ObjDesc->Buffer.Length * 3);
631 break;
632
633 default:
634 return_ACPI_STATUS (AE_BAD_PARAMETER);
635 }
636
637 /*
635 * Perform the conversion.
638 * Create a new string object and string buffer
636 * (-1 because of extra separator included in StringLength from above)
637 */
639 * (-1 because of extra separator included in StringLength from above)
640 */
638 StringLength--;
639 if (StringLength > ACPI_MAX_STRING_CONVERSION) /* ACPI limit */
640 {
641 return_ACPI_STATUS (AE_AML_STRING_LIMIT);
642 }
643
644 /* Create a new string object and string buffer */
645
646 ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength);
641 ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) (StringLength - 1));
647 if (!ReturnDesc)
648 {
649 return_ACPI_STATUS (AE_NO_MEMORY);
650 }
651
652 NewBuf = ReturnDesc->Buffer.Pointer;
653
654 /*

--- 45 unchanged lines hidden (view full) ---

700 ACPI_OBJECT_TYPE DestinationType,
701 ACPI_OPERAND_OBJECT *SourceDesc,
702 ACPI_OPERAND_OBJECT **ResultDesc,
703 ACPI_WALK_STATE *WalkState)
704{
705 ACPI_STATUS Status = AE_OK;
706
707
642 if (!ReturnDesc)
643 {
644 return_ACPI_STATUS (AE_NO_MEMORY);
645 }
646
647 NewBuf = ReturnDesc->Buffer.Pointer;
648
649 /*

--- 45 unchanged lines hidden (view full) ---

695 ACPI_OBJECT_TYPE DestinationType,
696 ACPI_OPERAND_OBJECT *SourceDesc,
697 ACPI_OPERAND_OBJECT **ResultDesc,
698 ACPI_WALK_STATE *WalkState)
699{
700 ACPI_STATUS Status = AE_OK;
701
702
708 ACPI_FUNCTION_TRACE ("ExConvertToTargetType");
703 ACPI_FUNCTION_TRACE (ExConvertToTargetType);
709
710
711 /* Default behavior */
712
713 *ResultDesc = SourceDesc;
714
715 /*
716 * If required by the target,

--- 60 unchanged lines hidden (view full) ---

777 * The operand must be a Buffer. We can convert an
778 * Integer or String if necessary
779 */
780 Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc);
781 break;
782
783
784 default:
704
705
706 /* Default behavior */
707
708 *ResultDesc = SourceDesc;
709
710 /*
711 * If required by the target,

--- 60 unchanged lines hidden (view full) ---

772 * The operand must be a Buffer. We can convert an
773 * Integer or String if necessary
774 */
775 Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc);
776 break;
777
778
779 default:
785 ACPI_REPORT_ERROR (("Bad destination type during conversion: %X\n",
780 ACPI_ERROR ((AE_INFO, "Bad destination type during conversion: %X",
786 DestinationType));
787 Status = AE_AML_INTERNAL;
788 break;
789 }
790 break;
791
792
793 case ARGI_REFERENCE:
794 /*
795 * CreateXxxxField cases - we are storing the field object into the name
796 */
797 break;
798
799
800 default:
781 DestinationType));
782 Status = AE_AML_INTERNAL;
783 break;
784 }
785 break;
786
787
788 case ARGI_REFERENCE:
789 /*
790 * CreateXxxxField cases - we are storing the field object into the name
791 */
792 break;
793
794
795 default:
801 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
802 "Unknown Target type ID 0x%X Op %s DestType %s\n",
796 ACPI_ERROR ((AE_INFO,
797 "Unknown Target type ID 0x%X AmlOpcode %X DestType %s",
803 GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs),
798 GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs),
804 WalkState->OpInfo->Name, AcpiUtGetTypeName (DestinationType)));
805
806 ACPI_REPORT_ERROR (("Bad Target Type (ARGI): %X\n",
807 GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs)))
799 WalkState->Opcode, AcpiUtGetTypeName (DestinationType)));
808 Status = AE_AML_INTERNAL;
809 }
810
811 /*
812 * Source-to-Target conversion semantics:
813 *
814 * If conversion to the target type cannot be performed, then simply
815 * overwrite the target with the new object and type.
816 */
817 if (Status == AE_TYPE)
818 {
819 Status = AE_OK;
820 }
821
822 return_ACPI_STATUS (Status);
823}
824
825
800 Status = AE_AML_INTERNAL;
801 }
802
803 /*
804 * Source-to-Target conversion semantics:
805 *
806 * If conversion to the target type cannot be performed, then simply
807 * overwrite the target with the new object and type.
808 */
809 if (Status == AE_TYPE)
810 {
811 Status = AE_OK;
812 }
813
814 return_ACPI_STATUS (Status);
815}
816
817