Deleted Added
sdiff udiff text old ( 151937 ) new ( 167802 )
full compact
1/*******************************************************************************
2 *
3 * Module Name: dsmthdat - control method arguments and local variables
4 * $Revision: 1.85 $
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2005, 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 * RETURN: Status
160 *
161 * DESCRIPTION: Initialize the data structures that hold the method's arguments
162 * and locals. The data struct is an array of namespace nodes for
163 * each - this allows RefOf and DeRefOf to work properly for these
164 * special data types.
165 *
166 * NOTES: WalkState fields are initialized to zero by the
167 * ACPI_MEM_CALLOCATE().
168 *
169 * A pseudo-Namespace Node is assigned to each argument and local
170 * so that RefOf() can return a pointer to the Node.
171 *
172 ******************************************************************************/
173
174void
175AcpiDsMethodDataInit (
176 ACPI_WALK_STATE *WalkState)
177{
178 UINT32 i;
179
180
181 ACPI_FUNCTION_TRACE ("DsMethodDataInit");
182
183
184 /* Init the method arguments */
185
186 for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
187 {
188 ACPI_MOVE_32_TO_32 (&WalkState->Arguments[i].Name,
189 NAMEOF_ARG_NTE);
190 WalkState->Arguments[i].Name.Integer |= (i << 24);
191 WalkState->Arguments[i].Descriptor = ACPI_DESC_TYPE_NAMED;
192 WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
193 WalkState->Arguments[i].Flags = ANOBJ_END_OF_PEER_LIST |
194 ANOBJ_METHOD_ARG;
195 }
196
197 /* Init the method locals */
198
199 for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++)
200 {
201 ACPI_MOVE_32_TO_32 (&WalkState->LocalVariables[i].Name,
202 NAMEOF_LOCAL_NTE);
203
204 WalkState->LocalVariables[i].Name.Integer |= (i << 24);
205 WalkState->LocalVariables[i].Descriptor = ACPI_DESC_TYPE_NAMED;
206 WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
207 WalkState->LocalVariables[i].Flags = ANOBJ_END_OF_PEER_LIST |
208 ANOBJ_METHOD_LOCAL;
209 }
210
211 return_VOID;
212}
213
214
215/*******************************************************************************
216 *

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

227
228void
229AcpiDsMethodDataDeleteAll (
230 ACPI_WALK_STATE *WalkState)
231{
232 UINT32 Index;
233
234
235 ACPI_FUNCTION_TRACE ("DsMethodDataDeleteAll");
236
237
238 /* Detach the locals */
239
240 for (Index = 0; Index < ACPI_METHOD_NUM_LOCALS; Index++)
241 {
242 if (WalkState->LocalVariables[Index].Object)
243 {

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

290 ACPI_OPERAND_OBJECT **Params,
291 UINT32 MaxParamCount,
292 ACPI_WALK_STATE *WalkState)
293{
294 ACPI_STATUS Status;
295 UINT32 Index = 0;
296
297
298 ACPI_FUNCTION_TRACE_PTR ("DsMethodDataInitArgs", Params);
299
300
301 if (!Params)
302 {
303 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "No param list passed to method\n"));
304 return_ACPI_STATUS (AE_OK);
305 }
306

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

347
348ACPI_STATUS
349AcpiDsMethodDataGetNode (
350 UINT16 Opcode,
351 UINT32 Index,
352 ACPI_WALK_STATE *WalkState,
353 ACPI_NAMESPACE_NODE **Node)
354{
355 ACPI_FUNCTION_TRACE ("DsMethodDataGetNode");
356
357
358 /*
359 * Method Locals and Arguments are supported
360 */
361 switch (Opcode)
362 {
363 case AML_LOCAL_OP:
364
365 if (Index > ACPI_METHOD_MAX_LOCAL)
366 {
367 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
368 "Local index %d is invalid (max %d)\n",
369 Index, ACPI_METHOD_MAX_LOCAL));
370 return_ACPI_STATUS (AE_AML_INVALID_INDEX);
371 }
372
373 /* Return a pointer to the pseudo-node */
374
375 *Node = &WalkState->LocalVariables[Index];
376 break;
377
378 case AML_ARG_OP:
379
380 if (Index > ACPI_METHOD_MAX_ARG)
381 {
382 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
383 "Arg index %d is invalid (max %d)\n",
384 Index, ACPI_METHOD_MAX_ARG));
385 return_ACPI_STATUS (AE_AML_INVALID_INDEX);
386 }
387
388 /* Return a pointer to the pseudo-node */
389
390 *Node = &WalkState->Arguments[Index];
391 break;
392
393 default:
394 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", Opcode));
395 return_ACPI_STATUS (AE_AML_BAD_OPCODE);
396 }
397
398 return_ACPI_STATUS (AE_OK);
399}
400
401
402/*******************************************************************************

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

421 UINT32 Index,
422 ACPI_OPERAND_OBJECT *Object,
423 ACPI_WALK_STATE *WalkState)
424{
425 ACPI_STATUS Status;
426 ACPI_NAMESPACE_NODE *Node;
427
428
429 ACPI_FUNCTION_TRACE ("DsMethodDataSetValue");
430
431
432 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
433 "NewObj %p Opcode %X, Refs=%d [%s]\n", Object,
434 Opcode, Object->Common.ReferenceCount,
435 AcpiUtGetTypeName (Object->Common.Type)));
436
437 /* Get the namespace node for the arg/local */

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

480 ACPI_WALK_STATE *WalkState,
481 ACPI_OPERAND_OBJECT **DestDesc)
482{
483 ACPI_STATUS Status;
484 ACPI_NAMESPACE_NODE *Node;
485 ACPI_OPERAND_OBJECT *Object;
486
487
488 ACPI_FUNCTION_TRACE ("DsMethodDataGetValue");
489
490
491 /* Validate the object descriptor */
492
493 if (!DestDesc)
494 {
495 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null object descriptor pointer\n"));
496 return_ACPI_STATUS (AE_BAD_PARAMETER);
497 }
498
499 /* Get the namespace node for the arg/local */
500
501 Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
502 if (ACPI_FAILURE (Status))
503 {

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

535 }
536
537 /* Otherwise, return the error */
538
539 else switch (Opcode)
540 {
541 case AML_ARG_OP:
542
543 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
544 "Uninitialized Arg[%d] at node %p\n",
545 Index, Node));
546
547 return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
548
549 case AML_LOCAL_OP:
550
551 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
552 "Uninitialized Local[%d] at node %p\n",
553 Index, Node));
554
555 return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
556
557 default:
558 ACPI_REPORT_ERROR (("Not Arg/Local opcode: %X\n", Opcode));
559 return_ACPI_STATUS (AE_AML_INTERNAL);
560 }
561 }
562
563 /*
564 * The Index points to an initialized and valid object.
565 * Return an additional reference to the object
566 */

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

592 UINT32 Index,
593 ACPI_WALK_STATE *WalkState)
594{
595 ACPI_STATUS Status;
596 ACPI_NAMESPACE_NODE *Node;
597 ACPI_OPERAND_OBJECT *Object;
598
599
600 ACPI_FUNCTION_TRACE ("DsMethodDataDeleteValue");
601
602
603 /* Get the namespace node for the arg/local */
604
605 Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
606 if (ACPI_FAILURE (Status))
607 {
608 return_VOID;

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

659 ACPI_WALK_STATE *WalkState)
660{
661 ACPI_STATUS Status;
662 ACPI_NAMESPACE_NODE *Node;
663 ACPI_OPERAND_OBJECT *CurrentObjDesc;
664 ACPI_OPERAND_OBJECT *NewObjDesc;
665
666
667 ACPI_FUNCTION_TRACE ("DsStoreObjectToLocal");
668 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
669 Opcode, Index, ObjDesc));
670
671 /* Parameter validation */
672
673 if (!ObjDesc)
674 {
675 return_ACPI_STATUS (AE_BAD_PARAMETER);

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

811 UINT32 Index,
812 ACPI_WALK_STATE *WalkState)
813{
814 ACPI_STATUS Status;
815 ACPI_NAMESPACE_NODE *Node;
816 ACPI_OPERAND_OBJECT *Object;
817
818
819 ACPI_FUNCTION_TRACE ("DsMethodDataGetType");
820
821
822 /* Get the namespace node for the arg/local */
823
824 Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
825 if (ACPI_FAILURE (Status))
826 {
827 return_VALUE ((ACPI_TYPE_NOT_FOUND));

--- 19 unchanged lines hidden ---