Deleted Added
full compact
exoparg1.c (87031) exoparg1.c (91116)
1
2/******************************************************************************
3 *
4 * Module Name: exoparg1 - AML execution - opcodes with 1 argument
1
2/******************************************************************************
3 *
4 * Module Name: exoparg1 - AML execution - opcodes with 1 argument
5 * $Revision: 124 $
5 * $Revision: 134 $
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
13 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
14 * All rights reserved.
15 *
16 * 2. License
17 *
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights. You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
21 * property rights.

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

121#include "acparser.h"
122#include "acdispat.h"
123#include "acinterp.h"
124#include "amlcode.h"
125#include "acnamesp.h"
126
127
128#define _COMPONENT ACPI_EXECUTER
14 * All rights reserved.
15 *
16 * 2. License
17 *
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights. You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
21 * property rights.

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

121#include "acparser.h"
122#include "acdispat.h"
123#include "acinterp.h"
124#include "amlcode.h"
125#include "acnamesp.h"
126
127
128#define _COMPONENT ACPI_EXECUTER
129 MODULE_NAME ("exoparg1")
129 ACPI_MODULE_NAME ("exoparg1")
130
131
132/*!
133 * Naming convention for AML interpreter execution routines.
134 *
135 * The routines that begin execution of AML opcodes are named with a common
136 * convention based upon the number of arguments, the number of target operands,
137 * and whether or not a value is returned:

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

168ACPI_STATUS
169AcpiExOpcode_1A_0T_0R (
170 ACPI_WALK_STATE *WalkState)
171{
172 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
173 ACPI_STATUS Status = AE_OK;
174
175
130
131
132/*!
133 * Naming convention for AML interpreter execution routines.
134 *
135 * The routines that begin execution of AML opcodes are named with a common
136 * convention based upon the number of arguments, the number of target operands,
137 * and whether or not a value is returned:

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

168ACPI_STATUS
169AcpiExOpcode_1A_0T_0R (
170 ACPI_WALK_STATE *WalkState)
171{
172 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
173 ACPI_STATUS Status = AE_OK;
174
175
176 FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
176 ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
177
178
179 /* Examine the AML opcode */
180
181 switch (WalkState->Opcode)
182 {
183 case AML_RELEASE_OP: /* Release (MutexObject) */
184

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

195 case AML_SIGNAL_OP: /* Signal (EventObject) */
196
197 Status = AcpiExSystemSignalEvent (Operand[0]);
198 break;
199
200
201 case AML_SLEEP_OP: /* Sleep (MsecTime) */
202
177
178
179 /* Examine the AML opcode */
180
181 switch (WalkState->Opcode)
182 {
183 case AML_RELEASE_OP: /* Release (MutexObject) */
184

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

195 case AML_SIGNAL_OP: /* Signal (EventObject) */
196
197 Status = AcpiExSystemSignalEvent (Operand[0]);
198 break;
199
200
201 case AML_SLEEP_OP: /* Sleep (MsecTime) */
202
203 AcpiExSystemDoSuspend ((UINT32) Operand[0]->Integer.Value);
203 Status = AcpiExSystemDoSuspend ((UINT32) Operand[0]->Integer.Value);
204 break;
205
206
207 case AML_STALL_OP: /* Stall (UsecTime) */
208
204 break;
205
206
207 case AML_STALL_OP: /* Stall (UsecTime) */
208
209 AcpiExSystemDoStall ((UINT32) Operand[0]->Integer.Value);
209 Status = AcpiExSystemDoStall ((UINT32) Operand[0]->Integer.Value);
210 break;
211
212
213 case AML_UNLOAD_OP: /* Unload (Handle) */
214
215 Status = AcpiExUnloadTable (Operand[0]);
216 break;
217
218
219 default: /* Unknown opcode */
220
210 break;
211
212
213 case AML_UNLOAD_OP: /* Unload (Handle) */
214
215 Status = AcpiExUnloadTable (Operand[0]);
216 break;
217
218
219 default: /* Unknown opcode */
220
221 REPORT_ERROR (("AcpiExOpcode_1A_0T_0R: Unknown opcode %X\n",
221 ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_0R: Unknown opcode %X\n",
222 WalkState->Opcode));
223 Status = AE_AML_BAD_OPCODE;
224 break;
225 }
226
227 return_ACPI_STATUS (Status);
228}
229

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

244ACPI_STATUS
245AcpiExOpcode_1A_1T_0R (
246 ACPI_WALK_STATE *WalkState)
247{
248 ACPI_STATUS Status = AE_OK;
249 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
250
251
222 WalkState->Opcode));
223 Status = AE_AML_BAD_OPCODE;
224 break;
225 }
226
227 return_ACPI_STATUS (Status);
228}
229

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

244ACPI_STATUS
245AcpiExOpcode_1A_1T_0R (
246 ACPI_WALK_STATE *WalkState)
247{
248 ACPI_STATUS Status = AE_OK;
249 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
250
251
252 FUNCTION_TRACE_STR ("ExOpcode_1A_1T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
252 ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_1T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
253
254
255 /* Examine the AML opcode */
256
257 switch (WalkState->Opcode)
258 {
259 case AML_LOAD_OP:
260
253
254
255 /* Examine the AML opcode */
256
257 switch (WalkState->Opcode)
258 {
259 case AML_LOAD_OP:
260
261 Status = AcpiExLoadOp (Operand[0], Operand[1]);
261 Status = AcpiExLoadOp (Operand[0], Operand[1], WalkState);
262 break;
263
264 default: /* Unknown opcode */
265
262 break;
263
264 default: /* Unknown opcode */
265
266 REPORT_ERROR (("AcpiExOpcode_1A_1T_0R: Unknown opcode %X\n",
266 ACPI_REPORT_ERROR (("AcpiExOpcode_1A_1T_0R: Unknown opcode %X\n",
267 WalkState->Opcode));
268 Status = AE_AML_BAD_OPCODE;
269 goto Cleanup;
270 }
271
272
273Cleanup:
274

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

298 ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
299 ACPI_OPERAND_OBJECT *ReturnDesc2 = NULL;
300 UINT32 Temp32;
301 UINT32 i;
302 UINT32 j;
303 ACPI_INTEGER Digit;
304
305
267 WalkState->Opcode));
268 Status = AE_AML_BAD_OPCODE;
269 goto Cleanup;
270 }
271
272
273Cleanup:
274

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

298 ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
299 ACPI_OPERAND_OBJECT *ReturnDesc2 = NULL;
300 UINT32 Temp32;
301 UINT32 i;
302 UINT32 j;
303 ACPI_INTEGER Digit;
304
305
306 FUNCTION_TRACE_STR ("ExOpcode_1A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
306 ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
307
308
309 /* Create a return object of type Integer for most opcodes */
310
311 switch (WalkState->Opcode)
312 {
313 case AML_BIT_NOT_OP:
314 case AML_FIND_SET_LEFT_BIT_OP:

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

411 break;
412
413
414 case AML_TO_BCD_OP: /* ToBcd (Operand, Result) */
415
416 if (Operand[0]->Integer.Value > ACPI_MAX_BCD_VALUE)
417 {
418 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %8.8X%8.8X\n",
307
308
309 /* Create a return object of type Integer for most opcodes */
310
311 switch (WalkState->Opcode)
312 {
313 case AML_BIT_NOT_OP:
314 case AML_FIND_SET_LEFT_BIT_OP:

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

411 break;
412
413
414 case AML_TO_BCD_OP: /* ToBcd (Operand, Result) */
415
416 if (Operand[0]->Integer.Value > ACPI_MAX_BCD_VALUE)
417 {
418 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %8.8X%8.8X\n",
419 HIDWORD(Operand[0]->Integer.Value), LODWORD(Operand[0]->Integer.Value)));
419 ACPI_HIDWORD(Operand[0]->Integer.Value),
420 ACPI_LODWORD(Operand[0]->Integer.Value)));
420 Status = AE_AML_NUMERIC_OVERFLOW;
421 goto Cleanup;
422 }
423
424 ReturnDesc->Integer.Value = 0;
425 for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++)
426 {
427 /* Divide by nth factor of 10 */

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

432 {
433 AcpiUtShortDivide (&Digit, 10, &Digit, &Temp32);
434 }
435
436 /* Create the BCD digit from the remainder above */
437
438 if (Digit > 0)
439 {
421 Status = AE_AML_NUMERIC_OVERFLOW;
422 goto Cleanup;
423 }
424
425 ReturnDesc->Integer.Value = 0;
426 for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++)
427 {
428 /* Divide by nth factor of 10 */

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

433 {
434 AcpiUtShortDivide (&Digit, 10, &Digit, &Temp32);
435 }
436
437 /* Create the BCD digit from the remainder above */
438
439 if (Digit > 0)
440 {
440 ReturnDesc->Integer.Value += (Temp32 << (i * 4));
441 ReturnDesc->Integer.Value += ((ACPI_INTEGER) Temp32 << (i * 4));
441 }
442 }
443 break;
444
445
446 case AML_COND_REF_OF_OP: /* CondRefOf (SourceObject, Result) */
447
448 /*

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

475 }
476
477 Status = AcpiExStore (ReturnDesc2, Operand[1], WalkState);
478
479 /* The object exists in the namespace, return TRUE */
480
481 ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
482 goto Cleanup;
442 }
443 }
444 break;
445
446
447 case AML_COND_REF_OF_OP: /* CondRefOf (SourceObject, Result) */
448
449 /*

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

476 }
477
478 Status = AcpiExStore (ReturnDesc2, Operand[1], WalkState);
479
480 /* The object exists in the namespace, return TRUE */
481
482 ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
483 goto Cleanup;
483 break;
484
485
486 case AML_STORE_OP: /* Store (Source, Target) */
487
488 /*
489 * A store operand is typically a number, string, buffer or lvalue
490 * Be careful about deleting the source object,
491 * since the object itself may have been stored.

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

500 * Normally, we would remove a reference on the Operand[0] parameter;
501 * But since it is being used as the internal return object
502 * (meaning we would normally increment it), the two cancel out,
503 * and we simply don't do anything.
504 */
505 WalkState->ResultObj = Operand[0];
506 WalkState->Operands[0] = NULL; /* Prevent deletion */
507 return_ACPI_STATUS (Status);
484
485
486 case AML_STORE_OP: /* Store (Source, Target) */
487
488 /*
489 * A store operand is typically a number, string, buffer or lvalue
490 * Be careful about deleting the source object,
491 * since the object itself may have been stored.

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

500 * Normally, we would remove a reference on the Operand[0] parameter;
501 * But since it is being used as the internal return object
502 * (meaning we would normally increment it), the two cancel out,
503 * and we simply don't do anything.
504 */
505 WalkState->ResultObj = Operand[0];
506 WalkState->Operands[0] = NULL; /* Prevent deletion */
507 return_ACPI_STATUS (Status);
508 break;
509
510
511 /*
512 * ACPI 2.0 Opcodes
513 */
514 case AML_COPY_OP: /* Copy (Source, Target) */
515
508
509
510 /*
511 * ACPI 2.0 Opcodes
512 */
513 case AML_COPY_OP: /* Copy (Source, Target) */
514
516 Status = AE_NOT_IMPLEMENTED;
517 goto Cleanup;
515 Status = AcpiUtCopyIobjectToIobject (Operand[0], &ReturnDesc, WalkState);
518 break;
519
520
521 case AML_TO_DECSTRING_OP: /* ToDecimalString (Data, Result) */
522
523 Status = AcpiExConvertToString (Operand[0], &ReturnDesc, 10, ACPI_UINT32_MAX, WalkState);
524 break;
525

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

547
548 /*
549 * These are two obsolete opcodes
550 */
551 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s is obsolete and not implemented\n",
552 AcpiPsGetOpcodeName (WalkState->Opcode)));
553 Status = AE_SUPPORT;
554 goto Cleanup;
516 break;
517
518
519 case AML_TO_DECSTRING_OP: /* ToDecimalString (Data, Result) */
520
521 Status = AcpiExConvertToString (Operand[0], &ReturnDesc, 10, ACPI_UINT32_MAX, WalkState);
522 break;
523

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

545
546 /*
547 * These are two obsolete opcodes
548 */
549 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s is obsolete and not implemented\n",
550 AcpiPsGetOpcodeName (WalkState->Opcode)));
551 Status = AE_SUPPORT;
552 goto Cleanup;
555 break;
556
557
558 default: /* Unknown opcode */
559
553
554
555 default: /* Unknown opcode */
556
560 REPORT_ERROR (("AcpiExOpcode_1A_1T_1R: Unknown opcode %X\n",
557 ACPI_REPORT_ERROR (("AcpiExOpcode_1A_1T_1R: Unknown opcode %X\n",
561 WalkState->Opcode));
562 Status = AE_AML_BAD_OPCODE;
563 goto Cleanup;
564 }
565
566 /*
567 * Store the return value computed above into the target object
568 */

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

603 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
604 ACPI_OPERAND_OBJECT *TempDesc;
605 ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
606 ACPI_STATUS Status = AE_OK;
607 UINT32 Type;
608 ACPI_INTEGER Value;
609
610
558 WalkState->Opcode));
559 Status = AE_AML_BAD_OPCODE;
560 goto Cleanup;
561 }
562
563 /*
564 * Store the return value computed above into the target object
565 */

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

600 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
601 ACPI_OPERAND_OBJECT *TempDesc;
602 ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
603 ACPI_STATUS Status = AE_OK;
604 UINT32 Type;
605 ACPI_INTEGER Value;
606
607
611 FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
608 ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
612
613
614 /* Examine the AML opcode */
615
616 switch (WalkState->Opcode)
617 {
618 case AML_LNOT_OP: /* LNot (Operand) */
619

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

628 break;
629
630
631 case AML_DECREMENT_OP: /* Decrement (Operand) */
632 case AML_INCREMENT_OP: /* Increment (Operand) */
633
634 /*
635 * Since we are expecting a Reference operand, it
609
610
611 /* Examine the AML opcode */
612
613 switch (WalkState->Opcode)
614 {
615 case AML_LNOT_OP: /* LNot (Operand) */
616

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

625 break;
626
627
628 case AML_DECREMENT_OP: /* Decrement (Operand) */
629 case AML_INCREMENT_OP: /* Increment (Operand) */
630
631 /*
632 * Since we are expecting a Reference operand, it
636 * can be either a Node or an internal object.
633 * can be either a NS Node or an internal object.
637 */
638 ReturnDesc = Operand[0];
634 */
635 ReturnDesc = Operand[0];
639 if (VALID_DESCRIPTOR_TYPE (Operand[0], ACPI_DESC_TYPE_INTERNAL))
636 if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_INTERNAL)
640 {
641 /* Internal reference object - prevent deletion */
642
643 AcpiUtAddReference (ReturnDesc);
644 }
645
646 /*
647 * Convert the ReturnDesc Reference to a Number

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

726
727 Type = AcpiDsMethodDataGetType (Operand[0]->Reference.Opcode,
728 Operand[0]->Reference.Offset, WalkState);
729 break;
730
731
732 default:
733
637 {
638 /* Internal reference object - prevent deletion */
639
640 AcpiUtAddReference (ReturnDesc);
641 }
642
643 /*
644 * Convert the ReturnDesc Reference to a Number

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

723
724 Type = AcpiDsMethodDataGetType (Operand[0]->Reference.Opcode,
725 Operand[0]->Reference.Offset, WalkState);
726 break;
727
728
729 default:
730
734 REPORT_ERROR (("AcpiExOpcode_1A_0T_1R/TypeOp: Internal error - Unknown Reference subtype %X\n",
731 ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_1R/TypeOp: Internal error - Unknown Reference subtype %X\n",
735 Operand[0]->Reference.Opcode));
736 Status = AE_AML_INTERNAL;
737 goto Cleanup;
738 }
739 }
740 else
741 {
742 /*

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

768
769 ReturnDesc->Integer.Value = Type;
770 break;
771
772
773 case AML_SIZE_OF_OP: /* SizeOf (SourceObject) */
774
775 TempDesc = Operand[0];
732 Operand[0]->Reference.Opcode));
733 Status = AE_AML_INTERNAL;
734 goto Cleanup;
735 }
736 }
737 else
738 {
739 /*

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

765
766 ReturnDesc->Integer.Value = Type;
767 break;
768
769
770 case AML_SIZE_OF_OP: /* SizeOf (SourceObject) */
771
772 TempDesc = Operand[0];
776 if (VALID_DESCRIPTOR_TYPE (Operand[0], ACPI_DESC_TYPE_NAMED))
773 if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_NAMED)
777 {
778 TempDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) Operand[0]);
779 }
780
781 if (!TempDesc)
782 {
783 Value = 0;
784 }

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

831 Status = AcpiExGetObjectReference (Operand[0], &ReturnDesc, WalkState);
832 if (ACPI_FAILURE (Status))
833 {
834 goto Cleanup;
835 }
836 break;
837
838
774 {
775 TempDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) Operand[0]);
776 }
777
778 if (!TempDesc)
779 {
780 Value = 0;
781 }

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

828 Status = AcpiExGetObjectReference (Operand[0], &ReturnDesc, WalkState);
829 if (ACPI_FAILURE (Status))
830 {
831 goto Cleanup;
832 }
833 break;
834
835
839 case AML_DEREF_OF_OP: /* DerefOf (ObjReference) */
836 case AML_DEREF_OF_OP: /* DerefOf (ObjReference | String) */
840
837
841 /* Check for a method local or argument */
838 /* Check for a method local or argument, or standalone String */
842
839
843 if (!VALID_DESCRIPTOR_TYPE (Operand[0], ACPI_DESC_TYPE_NAMED))
840 if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) != ACPI_DESC_TYPE_NAMED)
844 {
841 {
845 /*
846 * Must resolve/dereference the local/arg reference first
847 */
848 switch (Operand[0]->Reference.Opcode)
842 switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
849 {
843 {
850 case AML_LOCAL_OP:
851 case AML_ARG_OP:
844 case INTERNAL_TYPE_REFERENCE:
845 /*
846 * This is a DerefOf (LocalX | ArgX)
847 *
848 * Must resolve/dereference the local/arg reference first
849 */
850 switch (Operand[0]->Reference.Opcode)
851 {
852 case AML_LOCAL_OP:
853 case AML_ARG_OP:
852
854
853 /* Set Operand[0] to the value of the local/arg */
855 /* Set Operand[0] to the value of the local/arg */
854
856
855 AcpiDsMethodDataGetValue (Operand[0]->Reference.Opcode,
856 Operand[0]->Reference.Offset, WalkState, &TempDesc);
857 AcpiDsMethodDataGetValue (Operand[0]->Reference.Opcode,
858 Operand[0]->Reference.Offset, WalkState, &TempDesc);
857
859
860 /*
861 * Delete our reference to the input object and
862 * point to the object just retrieved
863 */
864 AcpiUtRemoveReference (Operand[0]);
865 Operand[0] = TempDesc;
866 break;
867
868 default:
869
870 /* Must be an Index op - handled below */
871 break;
872 }
873 break;
874
875
876 case ACPI_TYPE_STRING:
877
858 /*
878 /*
859 * Delete our reference to the input object and
860 * point to the object just retrieved
879 * This is a DerefOf (String). The string is a reference to a named ACPI object.
880 *
881 * 1) Find the owning Node
882 * 2) Dereference the node to an actual object. Could be a Field, so we nee
883 * to resolve the node to a value.
861 */
884 */
862 AcpiUtRemoveReference (Operand[0]);
863 Operand[0] = TempDesc;
864 break;
885 Status = AcpiNsGetNodeByPath (Operand[0]->String.Pointer, WalkState->ScopeInfo->Scope.Node,
886 ACPI_NS_SEARCH_PARENT, (ACPI_NAMESPACE_NODE **) &ReturnDesc);
887 if (ACPI_FAILURE (Status))
888 {
889 goto Cleanup;
890 }
865
891
892 Status = AcpiExResolveNodeToValue ((ACPI_NAMESPACE_NODE **) &ReturnDesc, WalkState);
893 goto Cleanup;
894
895
866 default:
867
896 default:
897
868 /* Must be an Index op - handled below */
869 break;
898 Status = AE_AML_OPERAND_TYPE;
899 goto Cleanup;
870 }
871 }
872
873 /* Operand[0] may have changed from the code above */
874
900 }
901 }
902
903 /* Operand[0] may have changed from the code above */
904
875 if (VALID_DESCRIPTOR_TYPE (Operand[0], ACPI_DESC_TYPE_NAMED))
905 if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_NAMED)
876 {
906 {
877 /* Get the actual object from the Node (This is the dereference) */
878
907 /*
908 * This is a DerefOf (ObjectReference)
909 * Get the actual object from the Node (This is the dereference).
910 * -- This case may only happen when a LocalX or ArgX is dereferenced above.
911 */
879 ReturnDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) Operand[0]);
912 ReturnDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) Operand[0]);
880
881 /* Returning a pointer to the object, add another reference! */
882
883 AcpiUtAddReference (ReturnDesc);
884 }
885 else
886 {
887 /*
913 }
914 else
915 {
916 /*
888 * This must be a reference produced by either the Index() or
917 * This must be a reference object produced by either the Index() or
889 * RefOf() operator
890 */
891 switch (Operand[0]->Reference.Opcode)
892 {
893 case AML_INDEX_OP:
894
895 /*
896 * The target type for the Index operator must be

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

910 */
911 ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
912 if (!ReturnDesc)
913 {
914 Status = AE_NO_MEMORY;
915 goto Cleanup;
916 }
917
918 * RefOf() operator
919 */
920 switch (Operand[0]->Reference.Opcode)
921 {
922 case AML_INDEX_OP:
923
924 /*
925 * The target type for the Index operator must be

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

939 */
940 ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
941 if (!ReturnDesc)
942 {
943 Status = AE_NO_MEMORY;
944 goto Cleanup;
945 }
946
918 /*
947 /*
919 * Since we are returning the value of the buffer at the
920 * indexed location, we don't need to add an additional
921 * reference to the buffer itself.
922 */
923 TempDesc = Operand[0]->Reference.Object;
924 ReturnDesc->Integer.Value =
925 TempDesc->Buffer.Pointer[Operand[0]->Reference.Offset];
926 break;
948 * Since we are returning the value of the buffer at the
949 * indexed location, we don't need to add an additional
950 * reference to the buffer itself.
951 */
952 TempDesc = Operand[0]->Reference.Object;
953 ReturnDesc->Integer.Value =
954 TempDesc->Buffer.Pointer[Operand[0]->Reference.Offset];
955 break;
927
928
956
957
929 case ACPI_TYPE_PACKAGE:
930
931 /*
932 * The target is a package, we want to return the referenced
933 * element of the package. We must add another reference to
934 * this object, however.
935 */
936 ReturnDesc = *(Operand[0]->Reference.Where);

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

972
973
974 default:
975 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n",
976 Operand[0], Operand[0]->Reference.Opcode));
977
978 Status = AE_TYPE;
979 goto Cleanup;
958 case ACPI_TYPE_PACKAGE:
959
960 /*
961 * The target is a package, we want to return the referenced
962 * element of the package. We must add another reference to
963 * this object, however.
964 */
965 ReturnDesc = *(Operand[0]->Reference.Where);

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

1001
1002
1003 default:
1004 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n",
1005 Operand[0], Operand[0]->Reference.Opcode));
1006
1007 Status = AE_TYPE;
1008 goto Cleanup;
980 break;
981 }
982 }
983 break;
984
985
986 default:
987
1009 }
1010 }
1011 break;
1012
1013
1014 default:
1015
988 REPORT_ERROR (("AcpiExOpcode_1A_0T_1R: Unknown opcode %X\n",
1016 ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_1R: Unknown opcode %X\n",
989 WalkState->Opcode));
990 Status = AE_AML_BAD_OPCODE;
991 goto Cleanup;
992 }
993
994
995Cleanup:
996
997 /* Delete return object on error */
998
999 if (ACPI_FAILURE (Status))
1000 {
1001 AcpiUtRemoveReference (ReturnDesc);
1002 }
1003
1004 WalkState->ResultObj = ReturnDesc;
1005 return_ACPI_STATUS (Status);
1006}
1007
1017 WalkState->Opcode));
1018 Status = AE_AML_BAD_OPCODE;
1019 goto Cleanup;
1020 }
1021
1022
1023Cleanup:
1024
1025 /* Delete return object on error */
1026
1027 if (ACPI_FAILURE (Status))
1028 {
1029 AcpiUtRemoveReference (ReturnDesc);
1030 }
1031
1032 WalkState->ResultObj = ReturnDesc;
1033 return_ACPI_STATUS (Status);
1034}
1035