Deleted Added
full compact
dsmthdat.c (99146) dsmthdat.c (99679)
1/*******************************************************************************
2 *
3 * Module Name: dsmthdat - control method arguments and local variables
1/*******************************************************************************
2 *
3 * Module Name: dsmthdat - control method arguments and local variables
4 * $Revision: 59 $
4 * $Revision: 62 $
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.

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

112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117#define __DSMTHDAT_C__
118
119#include "acpi.h"
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.

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

112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117#define __DSMTHDAT_C__
118
119#include "acpi.h"
120#include "acparser.h"
121#include "acdispat.h"
120#include "acdispat.h"
122#include "acinterp.h"
123#include "amlcode.h"
124#include "acnamesp.h"
125
126
127#define _COMPONENT ACPI_DISPATCHER
128 ACPI_MODULE_NAME ("dsmthdat")
129
130

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

144 * NOTES: WalkState fields are initialized to zero by the
145 * ACPI_MEM_CALLOCATE().
146 *
147 * A pseudo-Namespace Node is assigned to each argument and local
148 * so that RefOf() can return a pointer to the Node.
149 *
150 ******************************************************************************/
151
121#include "amlcode.h"
122#include "acnamesp.h"
123
124
125#define _COMPONENT ACPI_DISPATCHER
126 ACPI_MODULE_NAME ("dsmthdat")
127
128

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

142 * NOTES: WalkState fields are initialized to zero by the
143 * ACPI_MEM_CALLOCATE().
144 *
145 * A pseudo-Namespace Node is assigned to each argument and local
146 * so that RefOf() can return a pointer to the Node.
147 *
148 ******************************************************************************/
149
152ACPI_STATUS
150void
153AcpiDsMethodDataInit (
154 ACPI_WALK_STATE *WalkState)
155{
156 UINT32 i;
157
158
159 ACPI_FUNCTION_TRACE ("DsMethodDataInit");
160

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

179 NAMEOF_LOCAL_NTE);
180
181 WalkState->LocalVariables[i].Name.Integer |= (i << 24);
182 WalkState->LocalVariables[i].Descriptor = ACPI_DESC_TYPE_NAMED;
183 WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
184 WalkState->LocalVariables[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
185 }
186
151AcpiDsMethodDataInit (
152 ACPI_WALK_STATE *WalkState)
153{
154 UINT32 i;
155
156
157 ACPI_FUNCTION_TRACE ("DsMethodDataInit");
158

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

177 NAMEOF_LOCAL_NTE);
178
179 WalkState->LocalVariables[i].Name.Integer |= (i << 24);
180 WalkState->LocalVariables[i].Descriptor = ACPI_DESC_TYPE_NAMED;
181 WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
182 WalkState->LocalVariables[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
183 }
184
187 return_ACPI_STATUS (AE_OK);
185 return_VOID;
188}
189
190
191/*******************************************************************************
192 *
193 * FUNCTION: AcpiDsMethodDataDeleteAll
194 *
195 * PARAMETERS: WalkState - Current walk state object
196 *
186}
187
188
189/*******************************************************************************
190 *
191 * FUNCTION: AcpiDsMethodDataDeleteAll
192 *
193 * PARAMETERS: WalkState - Current walk state object
194 *
197 * RETURN: Status
195 * RETURN: None
198 *
199 * DESCRIPTION: Delete method locals and arguments. Arguments are only
200 * deleted if this method was called from another method.
201 *
202 ******************************************************************************/
203
196 *
197 * DESCRIPTION: Delete method locals and arguments. Arguments are only
198 * deleted if this method was called from another method.
199 *
200 ******************************************************************************/
201
204ACPI_STATUS
202void
205AcpiDsMethodDataDeleteAll (
206 ACPI_WALK_STATE *WalkState)
207{
208 UINT32 Index;
209
210
211 ACPI_FUNCTION_TRACE ("DsMethodDataDeleteAll");
212

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

218 if (WalkState->LocalVariables[Index].Object)
219 {
220 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
221 Index, WalkState->LocalVariables[Index].Object));
222
223 /* Detach object (if present) and remove a reference */
224
225 AcpiNsDetachObject (&WalkState->LocalVariables[Index]);
203AcpiDsMethodDataDeleteAll (
204 ACPI_WALK_STATE *WalkState)
205{
206 UINT32 Index;
207
208
209 ACPI_FUNCTION_TRACE ("DsMethodDataDeleteAll");
210

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

216 if (WalkState->LocalVariables[Index].Object)
217 {
218 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
219 Index, WalkState->LocalVariables[Index].Object));
220
221 /* Detach object (if present) and remove a reference */
222
223 AcpiNsDetachObject (&WalkState->LocalVariables[Index]);
226 }
224 }
227 }
228
229 /* Detach the arguments */
230
231 for (Index = 0; Index < MTH_NUM_ARGS; Index++)
232 {
233 if (WalkState->Arguments[Index].Object)
234 {
235 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
236 Index, WalkState->Arguments[Index].Object));
237
238 /* Detach object (if present) and remove a reference */
239
240 AcpiNsDetachObject (&WalkState->Arguments[Index]);
241 }
242 }
243
225 }
226
227 /* Detach the arguments */
228
229 for (Index = 0; Index < MTH_NUM_ARGS; Index++)
230 {
231 if (WalkState->Arguments[Index].Object)
232 {
233 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
234 Index, WalkState->Arguments[Index].Object));
235
236 /* Detach object (if present) and remove a reference */
237
238 AcpiNsDetachObject (&WalkState->Arguments[Index]);
239 }
240 }
241
244 return_ACPI_STATUS (AE_OK);
242 return_VOID;
245}
246
247
248/*******************************************************************************
249 *
250 * FUNCTION: AcpiDsMethodDataInitArgs
251 *
252 * PARAMETERS: *Params - Pointer to a parameter list for the method

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

458 {
459 /* Uninitialized local/arg, return TYPE_ANY */
460
461 return_VALUE (ACPI_TYPE_ANY);
462 }
463
464 /* Get the object type */
465
243}
244
245
246/*******************************************************************************
247 *
248 * FUNCTION: AcpiDsMethodDataInitArgs
249 *
250 * PARAMETERS: *Params - Pointer to a parameter list for the method

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

456 {
457 /* Uninitialized local/arg, return TYPE_ANY */
458
459 return_VALUE (ACPI_TYPE_ANY);
460 }
461
462 /* Get the object type */
463
466 return_VALUE (Object->Common.Type);
464 return_VALUE (ACPI_GET_OBJECT_TYPE (Object));
467}
468
469
470/*******************************************************************************
471 *
472 * FUNCTION: AcpiDsMethodDataGetValue
473 *
474 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP

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

541 return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
542
543 case AML_LOCAL_OP:
544
545 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at node %p\n",
546 Index, Node));
547
548 return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
465}
466
467
468/*******************************************************************************
469 *
470 * FUNCTION: AcpiDsMethodDataGetValue
471 *
472 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP

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

539 return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
540
541 case AML_LOCAL_OP:
542
543 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at node %p\n",
544 Index, Node));
545
546 return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
547
548 default:
549 return_ACPI_STATUS (AE_AML_INTERNAL);
549 }
550 }
551
552 /*
553 * The Index points to an initialized and valid object.
554 * Return an additional reference to the object
555 */
556 *DestDesc = Object;

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

563/*******************************************************************************
564 *
565 * FUNCTION: AcpiDsMethodDataDeleteValue
566 *
567 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
568 * Index - Which localVar or argument to delete
569 * WalkState - Current walk state object
570 *
550 }
551 }
552
553 /*
554 * The Index points to an initialized and valid object.
555 * Return an additional reference to the object
556 */
557 *DestDesc = Object;

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

564/*******************************************************************************
565 *
566 * FUNCTION: AcpiDsMethodDataDeleteValue
567 *
568 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
569 * Index - Which localVar or argument to delete
570 * WalkState - Current walk state object
571 *
571 * RETURN: Status
572 * RETURN: None
572 *
573 * DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts
574 * a null into the stack slot after the object is deleted.
575 *
576 ******************************************************************************/
577
573 *
574 * DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts
575 * a null into the stack slot after the object is deleted.
576 *
577 ******************************************************************************/
578
578ACPI_STATUS
579void
579AcpiDsMethodDataDeleteValue (
580 UINT16 Opcode,
581 UINT32 Index,
582 ACPI_WALK_STATE *WalkState)
583{
584 ACPI_STATUS Status;
585 ACPI_NAMESPACE_NODE *Node;
586 ACPI_OPERAND_OBJECT *Object;
587
588
589 ACPI_FUNCTION_TRACE ("DsMethodDataDeleteValue");
590
591
592 /* Get the namespace node for the arg/local */
593
594 Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
595 if (ACPI_FAILURE (Status))
596 {
580AcpiDsMethodDataDeleteValue (
581 UINT16 Opcode,
582 UINT32 Index,
583 ACPI_WALK_STATE *WalkState)
584{
585 ACPI_STATUS Status;
586 ACPI_NAMESPACE_NODE *Node;
587 ACPI_OPERAND_OBJECT *Object;
588
589
590 ACPI_FUNCTION_TRACE ("DsMethodDataDeleteValue");
591
592
593 /* Get the namespace node for the arg/local */
594
595 Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
596 if (ACPI_FAILURE (Status))
597 {
597 return_ACPI_STATUS (Status);
598 return_VOID;
598 }
599
600 /* Get the associated object */
601
602 Object = AcpiNsGetAttachedObject (Node);
603
604 /*
605 * Undefine the Arg or Local by setting its descriptor
606 * pointer to NULL. Locals/Args can contain both
607 * ACPI_OPERAND_OBJECTS and ACPI_NAMESPACE_NODEs
608 */
609 Node->Object = NULL;
610
611 if ((Object) &&
599 }
600
601 /* Get the associated object */
602
603 Object = AcpiNsGetAttachedObject (Node);
604
605 /*
606 * Undefine the Arg or Local by setting its descriptor
607 * pointer to NULL. Locals/Args can contain both
608 * ACPI_OPERAND_OBJECTS and ACPI_NAMESPACE_NODEs
609 */
610 Node->Object = NULL;
611
612 if ((Object) &&
612 (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_INTERNAL))
613 (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_OPERAND))
613 {
614 /*
615 * There is a valid object.
616 * Decrement the reference count by one to balance the
617 * increment when the object was stored.
618 */
619 AcpiUtRemoveReference (Object);
620 }
621
614 {
615 /*
616 * There is a valid object.
617 * Decrement the reference count by one to balance the
618 * increment when the object was stored.
619 */
620 AcpiUtRemoveReference (Object);
621 }
622
622 return_ACPI_STATUS (AE_OK);
623 return_VOID;
623}
624
625
626/*******************************************************************************
627 *
628 * FUNCTION: AcpiDsStoreObjectToLocal
629 *
630 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP

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

714
715 AcpiNsDetachObject ((ACPI_NAMESPACE_NODE *) CurrentObjDesc);
716
717 /*
718 * Store this object into the Node
719 * (perform the indirect store)
720 */
721 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) CurrentObjDesc,
624}
625
626
627/*******************************************************************************
628 *
629 * FUNCTION: AcpiDsStoreObjectToLocal
630 *
631 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP

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

715
716 AcpiNsDetachObject ((ACPI_NAMESPACE_NODE *) CurrentObjDesc);
717
718 /*
719 * Store this object into the Node
720 * (perform the indirect store)
721 */
722 Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) CurrentObjDesc,
722 ObjDesc, ObjDesc->Common.Type);
723 ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc));
723 return_ACPI_STATUS (Status);
724 }
725
726 /*
727 * Delete the existing object
728 * before storing the new one
729 */
730 AcpiDsMethodDataDeleteValue (Opcode, Index, WalkState);

--- 13 unchanged lines hidden ---
724 return_ACPI_STATUS (Status);
725 }
726
727 /*
728 * Delete the existing object
729 * before storing the new one
730 */
731 AcpiDsMethodDataDeleteValue (Opcode, Index, WalkState);

--- 13 unchanged lines hidden ---