Deleted Added
sdiff udiff text old ( 67754 ) new ( 69450 )
full compact
1/******************************************************************************
2 *
3 * Module Name: dsobject - Dispatcher object management routines
4 * $Revision: 48 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
13 * 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#define __DSOBJECT_C__
118
119#include "acpi.h"
120#include "acparser.h"
121#include "amlcode.h"
122#include "acdispat.h"
123#include "acinterp.h"
124#include "acnamesp.h"
125
126#define _COMPONENT DISPATCHER
127 MODULE_NAME ("dsobject")
128
129
130/*******************************************************************************
131 *
132 * FUNCTION: AcpiDsInitOneObject
133 *
134 * PARAMETERS: ObjHandle - Node
135 * Level - Current nesting level
136 * Context - Points to a init info struct
137 * ReturnValue - Not used
138 *
139 * RETURN: Status
140 *
141 * DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every object
142 * within the namespace.
143 *
144 * Currently, the only objects that require initialization are:
145 * 1) Methods
146 * 2) Op Regions
147 *
148 ******************************************************************************/
149
150ACPI_STATUS
151AcpiDsInitOneObject (
152 ACPI_HANDLE ObjHandle,
153 UINT32 Level,
154 void *Context,
155 void **ReturnValue)
156{
157 OBJECT_TYPE_INTERNAL Type;
158 ACPI_STATUS Status;
159 ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
160
161
162 Info->ObjectCount++;
163
164 /*
165 * We are only interested in objects owned by the table that
166 * was just loaded
167 */
168
169 if (((ACPI_NAMESPACE_NODE *) ObjHandle)->OwnerId !=
170 Info->TableDesc->TableId)
171 {
172 return (AE_OK);
173 }
174
175
176 /* And even then, we are only interested in a few object types */
177
178 Type = AcpiNsGetType (ObjHandle);
179
180 switch (Type)
181 {
182
183 case ACPI_TYPE_REGION:
184
185 AcpiDsInitializeRegion (ObjHandle);
186
187 Info->OpRegionCount++;
188 break;
189
190
191 case ACPI_TYPE_METHOD:
192
193 Info->MethodCount++;
194
195 DEBUG_PRINT_RAW (ACPI_OK, ("."));
196
197
198 /*
199 * Always parse methods to detect errors, we may delete
200 * the parse tree below
201 */
202
203 Status = AcpiDsParseMethod (ObjHandle);
204
205 /* TBD: [Errors] what do we do with an error? */
206
207 if (ACPI_FAILURE (Status))
208 {
209 DEBUG_PRINT (ACPI_ERROR,
210 ("DsInitOneObject: Method %p [%4.4s] parse failed! %s\n",
211 ObjHandle, &((ACPI_NAMESPACE_NODE *)ObjHandle)->Name,
212 AcpiCmFormatException (Status)));
213 break;
214 }
215
216 /*
217 * Keep the parse tree only if we are parsing all methods
218 * at init time (versus just-in-time)
219 */
220
221 if (AcpiGbl_WhenToParseMethods != METHOD_PARSE_AT_INIT)
222 {
223 AcpiNsDeleteNamespaceSubtree (ObjHandle);
224 }
225
226 break;
227
228 default:
229 break;
230 }
231
232 /*
233 * We ignore errors from above, and always return OK, since
234 * we don't want to abort the walk on a single error.
235 */
236 return (AE_OK);
237}
238
239
240/*******************************************************************************
241 *
242 * FUNCTION: AcpiDsInitializeObjects
243 *
244 * PARAMETERS: None
245 *
246 * RETURN: Status
247 *
248 * DESCRIPTION: Walk the entire namespace and perform any necessary
249 * initialization on the objects found therein
250 *
251 ******************************************************************************/
252
253ACPI_STATUS
254AcpiDsInitializeObjects (
255 ACPI_TABLE_DESC *TableDesc,
256 ACPI_NAMESPACE_NODE *StartNode)
257{
258 ACPI_STATUS Status;
259 ACPI_INIT_WALK_INFO Info;
260
261
262 FUNCTION_TRACE ("DsInitializeObjects");
263
264
265 DEBUG_PRINT (TRACE_DISPATCH,
266 ("DsInitializeObjects: **** Starting initialization of namespace objects ****\n"));
267 DEBUG_PRINT_RAW (ACPI_OK, ("Parsing Methods:"));
268
269
270 Info.MethodCount = 0;
271 Info.OpRegionCount = 0;
272 Info.ObjectCount = 0;
273 Info.TableDesc = TableDesc;
274
275
276 /* Walk entire namespace from the supplied root */
277
278 Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartNode,
279 ACPI_UINT32_MAX, AcpiDsInitOneObject,
280 &Info, NULL);
281 if (ACPI_FAILURE (Status))
282 {
283 DEBUG_PRINT (ACPI_ERROR,
284 ("DsInitializeObjects: WalkNamespace failed! %x\n", Status));
285 }
286
287 DEBUG_PRINT_RAW (ACPI_OK,
288 ("\n%d Control Methods found and parsed (%d nodes total)\n",
289 Info.MethodCount, Info.ObjectCount));
290 DEBUG_PRINT (TRACE_DISPATCH,
291 ("DsInitializeObjects: %d Control Methods found\n", Info.MethodCount));
292 DEBUG_PRINT (TRACE_DISPATCH,
293 ("DsInitializeObjects: %d Op Regions found\n", Info.OpRegionCount));
294
295 return_ACPI_STATUS (AE_OK);
296}
297
298
299/*****************************************************************************
300 *
301 * FUNCTION: AcpiDsInitObjectFromOp
302 *
303 * PARAMETERS: Op - Parser op used to init the internal object
304 * Opcode - AML opcode associated with the object
305 * ObjDesc - Namespace object to be initialized
306 *
307 * RETURN: Status
308 *
309 * DESCRIPTION: Initialize a namespace object from a parser Op and its
310 * associated arguments. The namespace object is a more compact
311 * representation of the Op and its arguments.
312 *
313 ****************************************************************************/
314
315ACPI_STATUS
316AcpiDsInitObjectFromOp (
317 ACPI_WALK_STATE *WalkState,
318 ACPI_PARSE_OBJECT *Op,
319 UINT16 Opcode,
320 ACPI_OPERAND_OBJECT **ObjDesc)
321{
322 ACPI_STATUS Status;
323 ACPI_PARSE_OBJECT *Arg;
324 ACPI_PARSE2_OBJECT *ByteList;
325 ACPI_OPERAND_OBJECT *ArgDesc;
326 ACPI_OPCODE_INFO *OpInfo;
327
328
329 OpInfo = AcpiPsGetOpcodeInfo (Opcode);
330 if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE)
331 {
332 /* Unknown opcode */
333
334 return (AE_TYPE);
335 }
336
337
338 /* Get and prepare the first argument */
339
340 switch ((*ObjDesc)->Common.Type)
341 {
342 case ACPI_TYPE_BUFFER:
343
344 /* First arg is a number */
345
346 AcpiDsCreateOperand (WalkState, Op->Value.Arg);
347 ArgDesc = WalkState->Operands [WalkState->NumOperands - 1];
348 AcpiDsObjStackPop (1, WalkState);
349
350 /* Resolve the object (could be an arg or local) */
351
352 Status = AcpiAmlResolveToValue (&ArgDesc, WalkState);
353 if (ACPI_FAILURE (Status))
354 {
355 AcpiCmRemoveReference (ArgDesc);
356 return (Status);
357 }
358
359 /* We are expecting a number */
360
361 if (ArgDesc->Common.Type != ACPI_TYPE_NUMBER)
362 {
363 DEBUG_PRINT (ACPI_ERROR,
364 ("InitObject: Expecting number, got obj: %p type %X\n",
365 ArgDesc, ArgDesc->Common.Type));
366 AcpiCmRemoveReference (ArgDesc);
367 return (AE_TYPE);
368 }
369
370 /* Get the value, delete the internal object */
371
372 (*ObjDesc)->Buffer.Length = (UINT32) ArgDesc->Number.Value;
373 AcpiCmRemoveReference (ArgDesc);
374
375 /* Allocate the buffer */
376
377 if ((*ObjDesc)->Buffer.Length == 0)
378 {
379 (*ObjDesc)->Buffer.Pointer = NULL;
380 REPORT_WARNING (("Buffer created with zero length in AML\n"));
381 break;
382 }
383
384 else
385 {
386 (*ObjDesc)->Buffer.Pointer =
387 AcpiCmCallocate ((*ObjDesc)->Buffer.Length);
388
389 if (!(*ObjDesc)->Buffer.Pointer)
390 {
391 return (AE_NO_MEMORY);
392 }
393 }
394
395 /*
396 * Second arg is the buffer data (optional)
397 * ByteList can be either individual bytes or a
398 * string initializer!
399 */
400
401 /* skip first arg */
402 Arg = Op->Value.Arg;
403 ByteList = (ACPI_PARSE2_OBJECT *) Arg->Next;
404 if (ByteList)
405 {
406 if (ByteList->Opcode != AML_BYTELIST_OP)
407 {
408 DEBUG_PRINT (ACPI_ERROR,
409 ("InitObject: Expecting bytelist, got: %x\n",
410 ByteList));
411 return (AE_TYPE);
412 }
413
414 MEMCPY ((*ObjDesc)->Buffer.Pointer, ByteList->Data,
415 (*ObjDesc)->Buffer.Length);
416 }
417
418 break;
419
420
421 case ACPI_TYPE_PACKAGE:
422
423 /*
424 * When called, an internal package object has already
425 * been built and is pointed to by *ObjDesc.
426 * AcpiDsBuildInternalObject build another internal
427 * package object, so remove reference to the original
428 * so that it is deleted. Error checking is done
429 * within the remove reference function.
430 */
431 AcpiCmRemoveReference(*ObjDesc);
432
433 Status = AcpiDsBuildInternalObject (WalkState, Op, ObjDesc);
434 break;
435
436 case ACPI_TYPE_NUMBER:
437 (*ObjDesc)->Number.Value = Op->Value.Integer;
438 break;
439
440
441 case ACPI_TYPE_STRING:
442 (*ObjDesc)->String.Pointer = Op->Value.String;
443 (*ObjDesc)->String.Length = STRLEN (Op->Value.String);
444 break;
445
446
447 case ACPI_TYPE_METHOD:
448 break;
449
450
451 case INTERNAL_TYPE_REFERENCE:
452
453 switch (ACPI_GET_OP_CLASS (OpInfo))
454 {
455 case OPTYPE_LOCAL_VARIABLE:
456
457 /* Split the opcode into a base opcode + offset */
458
459 (*ObjDesc)->Reference.OpCode = AML_LOCAL_OP;
460 (*ObjDesc)->Reference.Offset = Opcode - AML_LOCAL_OP;
461 break;
462
463 case OPTYPE_METHOD_ARGUMENT:
464
465 /* Split the opcode into a base opcode + offset */
466
467 (*ObjDesc)->Reference.OpCode = AML_ARG_OP;
468 (*ObjDesc)->Reference.Offset = Opcode - AML_ARG_OP;
469 break;
470
471 default: /* Constants, Literals, etc.. */
472
473 if (Op->Opcode == AML_NAMEPATH_OP)
474 {
475 /* Node was saved in Op */
476
477 (*ObjDesc)->Reference.Node = Op->Node;
478 }
479
480 (*ObjDesc)->Reference.OpCode = Opcode;
481 break;
482 }
483
484 break;
485
486
487 default:
488
489 DEBUG_PRINT (ACPI_ERROR,
490 ("InitObject: Unimplemented data type: %x\n",
491 (*ObjDesc)->Common.Type));
492
493 break;
494 }
495
496 return (AE_OK);
497}
498
499
500/*****************************************************************************
501 *
502 * FUNCTION: AcpiDsBuildInternalSimpleObj
503 *
504 * PARAMETERS: Op - Parser object to be translated
505 * ObjDescPtr - Where the ACPI internal object is returned
506 *
507 * RETURN: Status
508 *
509 * DESCRIPTION: Translate a parser Op object to the equivalent namespace object
510 * Simple objects are any objects other than a package object!
511 *
512 ****************************************************************************/
513
514ACPI_STATUS
515AcpiDsBuildInternalSimpleObj (
516 ACPI_WALK_STATE *WalkState,
517 ACPI_PARSE_OBJECT *Op,
518 ACPI_OPERAND_OBJECT **ObjDescPtr)
519{
520 ACPI_OPERAND_OBJECT *ObjDesc;
521 OBJECT_TYPE_INTERNAL Type;
522 ACPI_STATUS Status;
523 UINT32 Length;
524 char *Name;
525
526
527 FUNCTION_TRACE ("DsBuildInternalSimpleObj");
528
529
530 if (Op->Opcode == AML_NAMEPATH_OP)
531 {
532 /*
533 * This is an object reference. If The name was
534 * previously looked up in the NS, it is stored in this op.
535 * Otherwise, go ahead and look it up now
536 */
537
538 if (!Op->Node)
539 {
540 Status = AcpiNsLookup (WalkState->ScopeInfo,
541 Op->Value.String, ACPI_TYPE_ANY,
542 IMODE_EXECUTE,
543 NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
544 NULL,
545 (ACPI_NAMESPACE_NODE **)&(Op->Node));
546
547 if (ACPI_FAILURE (Status))
548 {
549 if (Status == AE_NOT_FOUND)
550 {
551 Name = NULL;
552 AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Value.String, &Length, &Name);
553
554 if (Name)
555 {
556 REPORT_WARNING (("Reference %s AML 0x%X not found\n",
557 Name, Op->AmlOffset));
558 AcpiCmFree (Name);
559 }
560 else
561 {
562 REPORT_WARNING (("Reference %s AML 0x%X not found\n",
563 Op->Value.String, Op->AmlOffset));
564 }
565 *ObjDescPtr = NULL;
566 return_ACPI_STATUS (AE_OK);
567 }
568
569 return_ACPI_STATUS (Status);
570 }
571 }
572
573 /*
574 * The reference will be a Reference
575 * TBD: [Restructure] unless we really need a separate
576 * type of INTERNAL_TYPE_REFERENCE change
577 * AcpiDsMapOpcodeToDataType to handle this case
578 */
579 Type = INTERNAL_TYPE_REFERENCE;
580 }
581 else
582 {
583 Type = AcpiDsMapOpcodeToDataType (Op->Opcode, NULL);
584 }
585
586
587 /* Create and init the internal ACPI object */
588
589 ObjDesc = AcpiCmCreateInternalObject (Type);
590 if (!ObjDesc)
591 {
592 return_ACPI_STATUS (AE_NO_MEMORY);
593 }
594
595 Status = AcpiDsInitObjectFromOp (WalkState, Op,
596 Op->Opcode, &ObjDesc);
597
598 if (ACPI_FAILURE (Status))
599 {
600 AcpiCmRemoveReference (ObjDesc);
601 return_ACPI_STATUS (Status);
602 }
603
604 *ObjDescPtr = ObjDesc;
605
606 return_ACPI_STATUS (AE_OK);
607}
608
609
610/*****************************************************************************
611 *
612 * FUNCTION: AcpiDsBuildInternalPackageObj
613 *
614 * PARAMETERS: Op - Parser object to be translated
615 * ObjDescPtr - Where the ACPI internal object is returned
616 *
617 * RETURN: Status
618 *
619 * DESCRIPTION: Translate a parser Op package object to the equivalent
620 * namespace object
621 *
622 ****************************************************************************/
623
624ACPI_STATUS
625AcpiDsBuildInternalPackageObj (
626 ACPI_WALK_STATE *WalkState,
627 ACPI_PARSE_OBJECT *Op,
628 ACPI_OPERAND_OBJECT **ObjDescPtr)
629{
630 ACPI_PARSE_OBJECT *Arg;
631 ACPI_OPERAND_OBJECT *ObjDesc;
632 ACPI_STATUS Status = AE_OK;
633
634
635 FUNCTION_TRACE ("DsBuildInternalPackageObj");
636
637
638 ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_PACKAGE);
639 if (!ObjDesc)
640 {
641 return_ACPI_STATUS (AE_NO_MEMORY);
642 }
643
644 /* The first argument must be the package length */
645
646 Arg = Op->Value.Arg;
647 ObjDesc->Package.Count = Arg->Value.Integer;
648
649 /*
650 * Allocate the array of pointers (ptrs to the
651 * individual objects) Add an extra pointer slot so
652 * that the list is always null terminated.
653 */
654
655 ObjDesc->Package.Elements =
656 AcpiCmCallocate ((ObjDesc->Package.Count + 1) *
657 sizeof (void *));
658
659 if (!ObjDesc->Package.Elements)
660 {
661 /* Package vector allocation failure */
662
663 REPORT_ERROR (("DsBuildInternalPackageObj: Package vector allocation failure\n"));
664
665 AcpiCmDeleteObjectDesc (ObjDesc);
666 return_ACPI_STATUS (AE_NO_MEMORY);
667 }
668
669 ObjDesc->Package.NextElement = ObjDesc->Package.Elements;
670
671 /*
672 * Now init the elements of the package
673 */
674
675 Arg = Arg->Next;
676 while (Arg)
677 {
678 if (Arg->Opcode == AML_PACKAGE_OP)
679 {
680 Status = AcpiDsBuildInternalPackageObj (WalkState, Arg,
681 ObjDesc->Package.NextElement);
682 }
683
684 else
685 {
686 Status = AcpiDsBuildInternalSimpleObj (WalkState, Arg,
687 ObjDesc->Package.NextElement);
688 }
689
690 ObjDesc->Package.NextElement++;
691 Arg = Arg->Next;
692 }
693
694 *ObjDescPtr = ObjDesc;
695 return_ACPI_STATUS (Status);
696}
697
698
699/*****************************************************************************
700 *
701 * FUNCTION: AcpiDsBuildInternalObject
702 *
703 * PARAMETERS: Op - Parser object to be translated
704 * ObjDescPtr - Where the ACPI internal object is returned
705 *
706 * RETURN: Status
707 *
708 * DESCRIPTION: Translate a parser Op object to the equivalent namespace
709 * object
710 *
711 ****************************************************************************/
712
713ACPI_STATUS
714AcpiDsBuildInternalObject (
715 ACPI_WALK_STATE *WalkState,
716 ACPI_PARSE_OBJECT *Op,
717 ACPI_OPERAND_OBJECT **ObjDescPtr)
718{
719 ACPI_STATUS Status;
720
721
722 if (Op->Opcode == AML_PACKAGE_OP)
723 {
724 Status = AcpiDsBuildInternalPackageObj (WalkState, Op,
725 ObjDescPtr);
726 }
727
728 else
729 {
730 Status = AcpiDsBuildInternalSimpleObj (WalkState, Op,
731 ObjDescPtr);
732 }
733
734 return (Status);
735}
736
737
738/*****************************************************************************
739 *
740 * FUNCTION: AcpiDsCreateNode
741 *
742 * PARAMETERS: Op - Parser object to be translated
743 * ObjDescPtr - Where the ACPI internal object is returned
744 *
745 * RETURN: Status
746 *
747 * DESCRIPTION:
748 *
749 ****************************************************************************/
750
751ACPI_STATUS
752AcpiDsCreateNode (
753 ACPI_WALK_STATE *WalkState,
754 ACPI_NAMESPACE_NODE *Node,
755 ACPI_PARSE_OBJECT *Op)
756{
757 ACPI_STATUS Status;
758 ACPI_OPERAND_OBJECT *ObjDesc;
759
760
761 FUNCTION_TRACE_PTR ("DsCreateNode", Op);
762
763
764 if (!Op->Value.Arg)
765 {
766 /* No arguments, there is nothing to do */
767
768 return_ACPI_STATUS (AE_OK);
769 }
770
771
772 /* Build an internal object for the argument(s) */
773
774 Status = AcpiDsBuildInternalObject (WalkState,
775 Op->Value.Arg, &ObjDesc);
776 if (ACPI_FAILURE (Status))
777 {
778 return_ACPI_STATUS (Status);
779 }
780
781
782 /* Re-type the object according to it's argument */
783
784 Node->Type = ObjDesc->Common.Type;
785
786 /* Init obj */
787
788 Status = AcpiNsAttachObject ((ACPI_HANDLE) Node, ObjDesc,
789 (UINT8) Node->Type);
790 if (ACPI_FAILURE (Status))
791 {
792 goto Cleanup;
793 }
794
795 return_ACPI_STATUS (Status);
796
797
798Cleanup:
799
800 AcpiCmRemoveReference (ObjDesc);
801
802 return_ACPI_STATUS (Status);
803}
804
805