nrelease - fix/improve livecd
[dragonfly.git] / sys / contrib / dev / acpica / source / components / debugger / dbtest.c
1 /*******************************************************************************
2  *
3  * Module Name: dbtest - Various debug-related tests
4  *
5  ******************************************************************************/
6
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights. You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code. No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision. In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change. Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee. Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution. In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government. In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************
115  *
116  * Alternatively, you may choose to be licensed under the terms of the
117  * following license:
118  *
119  * Redistribution and use in source and binary forms, with or without
120  * modification, are permitted provided that the following conditions
121  * are met:
122  * 1. Redistributions of source code must retain the above copyright
123  *    notice, this list of conditions, and the following disclaimer,
124  *    without modification.
125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126  *    substantially similar to the "NO WARRANTY" disclaimer below
127  *    ("Disclaimer") and any redistribution must be conditioned upon
128  *    including a substantially similar Disclaimer requirement for further
129  *    binary redistribution.
130  * 3. Neither the names of the above-listed copyright holders nor the names
131  *    of any contributors may be used to endorse or promote products derived
132  *    from this software without specific prior written permission.
133  *
134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145  *
146  * Alternatively, you may choose to be licensed under the terms of the
147  * GNU General Public License ("GPL") version 2 as published by the Free
148  * Software Foundation.
149  *
150  *****************************************************************************/
151
152 #include "acpi.h"
153 #include "accommon.h"
154 #include "acdebug.h"
155 #include "acnamesp.h"
156 #include "acpredef.h"
157 #include "acinterp.h"
158
159 #ifdef ACPI_DEBUGGER
160
161 #define _COMPONENT          ACPI_CA_DEBUGGER
162         ACPI_MODULE_NAME    ("dbtest")
163
164
165 /* Local prototypes */
166
167 static void
168 AcpiDbTestAllObjects (
169     void);
170
171 static ACPI_STATUS
172 AcpiDbTestOneObject (
173     ACPI_HANDLE             ObjHandle,
174     UINT32                  NestingLevel,
175     void                    *Context,
176     void                    **ReturnValue);
177
178 static ACPI_STATUS
179 AcpiDbTestIntegerType (
180     ACPI_NAMESPACE_NODE     *Node,
181     UINT32                  BitLength);
182
183 static ACPI_STATUS
184 AcpiDbTestBufferType (
185     ACPI_NAMESPACE_NODE     *Node,
186     UINT32                  BitLength);
187
188 static ACPI_STATUS
189 AcpiDbTestStringType (
190     ACPI_NAMESPACE_NODE     *Node,
191     UINT32                  ByteLength);
192
193 static ACPI_STATUS
194 AcpiDbTestPackageType (
195     ACPI_NAMESPACE_NODE     *Node);
196
197 static ACPI_STATUS
198 AcpiDbTestFieldUnitType (
199     ACPI_OPERAND_OBJECT     *ObjDesc);
200
201 static ACPI_STATUS
202 AcpiDbReadFromObject (
203     ACPI_NAMESPACE_NODE     *Node,
204     ACPI_OBJECT_TYPE        ExpectedType,
205     ACPI_OBJECT             **Value);
206
207 static ACPI_STATUS
208 AcpiDbWriteToObject (
209     ACPI_NAMESPACE_NODE     *Node,
210     ACPI_OBJECT             *Value);
211
212 static void
213 AcpiDbEvaluateAllPredefinedNames (
214     char                    *CountArg);
215
216 static ACPI_STATUS
217 AcpiDbEvaluateOnePredefinedName (
218     ACPI_HANDLE             ObjHandle,
219     UINT32                  NestingLevel,
220     void                    *Context,
221     void                    **ReturnValue);
222
223 /*
224  * Test subcommands
225  */
226 static ACPI_DB_ARGUMENT_INFO    AcpiDbTestTypes [] =
227 {
228     {"OBJECTS"},
229     {"PREDEFINED"},
230     {NULL}           /* Must be null terminated */
231 };
232
233 #define CMD_TEST_OBJECTS        0
234 #define CMD_TEST_PREDEFINED     1
235
236 #define BUFFER_FILL_VALUE       0xFF
237
238 /*
239  * Support for the special debugger read/write control methods.
240  * These methods are installed into the current namespace and are
241  * used to read and write the various namespace objects. The point
242  * is to force the AML interpreter do all of the work.
243  */
244 #define ACPI_DB_READ_METHOD     "\\_T98"
245 #define ACPI_DB_WRITE_METHOD    "\\_T99"
246
247 static ACPI_HANDLE          ReadHandle = NULL;
248 static ACPI_HANDLE          WriteHandle = NULL;
249
250 /* ASL Definitions of the debugger read/write control methods. AML below. */
251
252 #if 0
253 DefinitionBlock ("ssdt.aml", "SSDT", 2, "Intel", "DEBUG", 0x00000001)
254 {
255     Method (_T98, 1, NotSerialized)     /* Read */
256     {
257         Return (DeRefOf (Arg0))
258     }
259 }
260 DefinitionBlock ("ssdt2.aml", "SSDT", 2, "Intel", "DEBUG", 0x00000001)
261 {
262     Method (_T99, 2, NotSerialized)     /* Write */
263     {
264         Store (Arg1, Arg0)
265     }
266 }
267 #endif
268
269 static unsigned char ReadMethodCode[] =
270 {
271     0x53,0x53,0x44,0x54,0x2E,0x00,0x00,0x00,  /* 00000000    "SSDT...." */
272     0x02,0xC9,0x49,0x6E,0x74,0x65,0x6C,0x00,  /* 00000008    "..Intel." */
273     0x44,0x45,0x42,0x55,0x47,0x00,0x00,0x00,  /* 00000010    "DEBUG..." */
274     0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
275     0x18,0x12,0x13,0x20,0x14,0x09,0x5F,0x54,  /* 00000020    "... .._T" */
276     0x39,0x38,0x01,0xA4,0x83,0x68             /* 00000028    "98...h"   */
277 };
278
279 static unsigned char WriteMethodCode[] =
280 {
281     0x53,0x53,0x44,0x54,0x2E,0x00,0x00,0x00,  /* 00000000    "SSDT...." */
282     0x02,0x15,0x49,0x6E,0x74,0x65,0x6C,0x00,  /* 00000008    "..Intel." */
283     0x44,0x45,0x42,0x55,0x47,0x00,0x00,0x00,  /* 00000010    "DEBUG..." */
284     0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
285     0x18,0x12,0x13,0x20,0x14,0x09,0x5F,0x54,  /* 00000020    "... .._T" */
286     0x39,0x39,0x02,0x70,0x69,0x68             /* 00000028    "99.pih"   */
287 };
288
289
290 /*******************************************************************************
291  *
292  * FUNCTION:    AcpiDbExecuteTest
293  *
294  * PARAMETERS:  TypeArg         - Subcommand
295  *
296  * RETURN:      None
297  *
298  * DESCRIPTION: Execute various debug tests.
299  *
300  * Note: Code is prepared for future expansion of the TEST command.
301  *
302  ******************************************************************************/
303
304 void
305 AcpiDbExecuteTest (
306     char                    *TypeArg)
307 {
308     UINT32                  Temp;
309
310
311     AcpiUtStrupr (TypeArg);
312     Temp = AcpiDbMatchArgument (TypeArg, AcpiDbTestTypes);
313     if (Temp == ACPI_TYPE_NOT_FOUND)
314     {
315         AcpiOsPrintf ("Invalid or unsupported argument\n");
316         return;
317     }
318
319     switch (Temp)
320     {
321     case CMD_TEST_OBJECTS:
322
323         AcpiDbTestAllObjects ();
324         break;
325
326     case CMD_TEST_PREDEFINED:
327
328         AcpiDbEvaluateAllPredefinedNames (NULL);
329         break;
330
331     default:
332         break;
333     }
334 }
335
336
337 /*******************************************************************************
338  *
339  * FUNCTION:    AcpiDbTestAllObjects
340  *
341  * PARAMETERS:  None
342  *
343  * RETURN:      None
344  *
345  * DESCRIPTION: This test implements the OBJECTS subcommand. It exercises the
346  *              namespace by reading/writing/comparing all data objects such
347  *              as integers, strings, buffers, fields, buffer fields, etc.
348  *
349  ******************************************************************************/
350
351 static void
352 AcpiDbTestAllObjects (
353     void)
354 {
355     ACPI_STATUS             Status;
356
357
358     /* Install the debugger read-object control method if necessary */
359
360     if (!ReadHandle)
361     {
362         Status = AcpiInstallMethod (ReadMethodCode);
363         if (ACPI_FAILURE (Status))
364         {
365             AcpiOsPrintf ("%s, Could not install debugger read method\n",
366                 AcpiFormatException (Status));
367             return;
368         }
369
370         Status = AcpiGetHandle (NULL, ACPI_DB_READ_METHOD, &ReadHandle);
371         if (ACPI_FAILURE (Status))
372         {
373             AcpiOsPrintf ("Could not obtain handle for debug method %s\n",
374                 ACPI_DB_READ_METHOD);
375             return;
376         }
377     }
378
379     /* Install the debugger write-object control method if necessary */
380
381     if (!WriteHandle)
382     {
383         Status = AcpiInstallMethod (WriteMethodCode);
384         if (ACPI_FAILURE (Status))
385         {
386             AcpiOsPrintf ("%s, Could not install debugger write method\n",
387                 AcpiFormatException (Status));
388             return;
389         }
390
391         Status = AcpiGetHandle (NULL, ACPI_DB_WRITE_METHOD, &WriteHandle);
392         if (ACPI_FAILURE (Status))
393         {
394             AcpiOsPrintf ("Could not obtain handle for debug method %s\n",
395                 ACPI_DB_WRITE_METHOD);
396             return;
397         }
398     }
399
400     /* Walk the entire namespace, testing each supported named data object */
401
402     (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
403         ACPI_UINT32_MAX, AcpiDbTestOneObject, NULL, NULL, NULL);
404 }
405
406
407 /*******************************************************************************
408  *
409  * FUNCTION:    AcpiDbTestOneObject
410  *
411  * PARAMETERS:  ACPI_WALK_CALLBACK
412  *
413  * RETURN:      Status
414  *
415  * DESCRIPTION: Test one namespace object. Supported types are Integer,
416  *              String, Buffer, Package, BufferField, and FieldUnit.
417  *              All other object types are simply ignored.
418  *
419  ******************************************************************************/
420
421 static ACPI_STATUS
422 AcpiDbTestOneObject (
423     ACPI_HANDLE             ObjHandle,
424     UINT32                  NestingLevel,
425     void                    *Context,
426     void                    **ReturnValue)
427 {
428     ACPI_NAMESPACE_NODE     *Node;
429     ACPI_OPERAND_OBJECT     *ObjDesc;
430     ACPI_OBJECT_TYPE        LocalType;
431     UINT32                  BitLength = 0;
432     UINT32                  ByteLength = 0;
433     ACPI_STATUS             Status = AE_OK;
434
435
436     Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
437     ObjDesc = Node->Object;
438
439     /*
440      * For the supported types, get the actual bit length or
441      * byte length. Map the type to one of Integer/String/Buffer.
442      */
443     switch (Node->Type)
444     {
445     case ACPI_TYPE_INTEGER:
446
447         /* Integer width is either 32 or 64 */
448
449         LocalType = ACPI_TYPE_INTEGER;
450         BitLength = AcpiGbl_IntegerBitWidth;
451         break;
452
453     case ACPI_TYPE_STRING:
454
455         LocalType = ACPI_TYPE_STRING;
456         ByteLength = ObjDesc->String.Length;
457         break;
458
459     case ACPI_TYPE_BUFFER:
460
461         LocalType = ACPI_TYPE_BUFFER;
462         ByteLength = ObjDesc->Buffer.Length;
463         BitLength = ByteLength * 8;
464         break;
465
466     case ACPI_TYPE_PACKAGE:
467
468         LocalType = ACPI_TYPE_PACKAGE;
469         break;
470
471     case ACPI_TYPE_FIELD_UNIT:
472     case ACPI_TYPE_LOCAL_REGION_FIELD:
473     case ACPI_TYPE_LOCAL_INDEX_FIELD:
474     case ACPI_TYPE_LOCAL_BANK_FIELD:
475
476         LocalType = ACPI_TYPE_FIELD_UNIT;
477         break;
478
479     case ACPI_TYPE_BUFFER_FIELD:
480         /*
481          * The returned object will be a Buffer if the field length
482          * is larger than the size of an Integer (32 or 64 bits
483          * depending on the DSDT version).
484          */
485         LocalType = ACPI_TYPE_INTEGER;
486         if (ObjDesc)
487         {
488             BitLength = ObjDesc->CommonField.BitLength;
489             ByteLength = ACPI_ROUND_BITS_UP_TO_BYTES (BitLength);
490             if (BitLength > AcpiGbl_IntegerBitWidth)
491             {
492                 LocalType = ACPI_TYPE_BUFFER;
493             }
494         }
495         break;
496
497 default:
498
499         /* Ignore all non-data types - Methods, Devices, Scopes, etc. */
500
501         return (AE_OK);
502     }
503
504     /* Emit the common prefix: Type:Name */
505
506     AcpiOsPrintf ("%14s: %4.4s",
507         AcpiUtGetTypeName (Node->Type), Node->Name.Ascii);
508
509     if (!ObjDesc)
510     {
511         AcpiOsPrintf (" No attached sub-object, ignoring\n");
512         return (AE_OK);
513     }
514
515     /* At this point, we have resolved the object to one of the major types */
516
517     switch (LocalType)
518     {
519     case ACPI_TYPE_INTEGER:
520
521         Status = AcpiDbTestIntegerType (Node, BitLength);
522         break;
523
524     case ACPI_TYPE_STRING:
525
526         Status = AcpiDbTestStringType (Node, ByteLength);
527         break;
528
529     case ACPI_TYPE_BUFFER:
530
531         Status = AcpiDbTestBufferType (Node, BitLength);
532         break;
533
534     case ACPI_TYPE_PACKAGE:
535
536         Status = AcpiDbTestPackageType (Node);
537         break;
538
539     case ACPI_TYPE_FIELD_UNIT:
540
541         Status = AcpiDbTestFieldUnitType (ObjDesc);
542         break;
543
544     default:
545
546         AcpiOsPrintf (" Ignoring, type not implemented (%2.2X)",
547             LocalType);
548         break;
549     }
550
551     /* Exit on error, but don't abort the namespace walk */
552
553     if (ACPI_FAILURE (Status))
554     {
555         Status = AE_OK;
556     }
557
558     AcpiOsPrintf ("\n");
559     return (Status);
560 }
561
562
563 /*******************************************************************************
564  *
565  * FUNCTION:    AcpiDbTestIntegerType
566  *
567  * PARAMETERS:  Node                - Parent NS node for the object
568  *              BitLength           - Actual length of the object. Used for
569  *                                    support of arbitrary length FieldUnit
570  *                                    and BufferField objects.
571  *
572  * RETURN:      Status
573  *
574  * DESCRIPTION: Test read/write for an Integer-valued object. Performs a
575  *              write/read/compare of an arbitrary new value, then performs
576  *              a write/read/compare of the original value.
577  *
578  ******************************************************************************/
579
580 static ACPI_STATUS
581 AcpiDbTestIntegerType (
582     ACPI_NAMESPACE_NODE     *Node,
583     UINT32                  BitLength)
584 {
585     ACPI_OBJECT             *Temp1 = NULL;
586     ACPI_OBJECT             *Temp2 = NULL;
587     ACPI_OBJECT             *Temp3 = NULL;
588     ACPI_OBJECT             WriteValue;
589     UINT64                  ValueToWrite;
590     ACPI_STATUS             Status;
591
592
593     if (BitLength > 64)
594     {
595         AcpiOsPrintf (" Invalid length for an Integer: %u", BitLength);
596         return (AE_OK);
597     }
598
599     /* Read the original value */
600
601     Status = AcpiDbReadFromObject (Node, ACPI_TYPE_INTEGER, &Temp1);
602     if (ACPI_FAILURE (Status))
603     {
604         return (Status);
605     }
606
607     AcpiOsPrintf (ACPI_DEBUG_LENGTH_FORMAT " %8.8X%8.8X",
608         BitLength, ACPI_ROUND_BITS_UP_TO_BYTES (BitLength),
609         ACPI_FORMAT_UINT64 (Temp1->Integer.Value));
610
611     ValueToWrite = ACPI_UINT64_MAX >> (64 - BitLength);
612     if (Temp1->Integer.Value == ValueToWrite)
613     {
614         ValueToWrite = 0;
615     }
616     /* Write a new value */
617
618     WriteValue.Type = ACPI_TYPE_INTEGER;
619     WriteValue.Integer.Value = ValueToWrite;
620     Status = AcpiDbWriteToObject (Node, &WriteValue);
621     if (ACPI_FAILURE (Status))
622     {
623         goto Exit;
624     }
625
626     /* Ensure that we can read back the new value */
627
628     Status = AcpiDbReadFromObject (Node, ACPI_TYPE_INTEGER, &Temp2);
629     if (ACPI_FAILURE (Status))
630     {
631         goto Exit;
632     }
633
634     if (Temp2->Integer.Value != ValueToWrite)
635     {
636         AcpiOsPrintf (" MISMATCH 2: %8.8X%8.8X, expecting %8.8X%8.8X",
637             ACPI_FORMAT_UINT64 (Temp2->Integer.Value),
638             ACPI_FORMAT_UINT64 (ValueToWrite));
639     }
640
641     /* Write back the original value */
642
643     WriteValue.Integer.Value = Temp1->Integer.Value;
644     Status = AcpiDbWriteToObject (Node, &WriteValue);
645     if (ACPI_FAILURE (Status))
646     {
647         goto Exit;
648     }
649
650     /* Ensure that we can read back the original value */
651
652     Status = AcpiDbReadFromObject (Node, ACPI_TYPE_INTEGER, &Temp3);
653     if (ACPI_FAILURE (Status))
654     {
655         goto Exit;
656     }
657
658     if (Temp3->Integer.Value != Temp1->Integer.Value)
659     {
660         AcpiOsPrintf (" MISMATCH 3: %8.8X%8.8X, expecting %8.8X%8.8X",
661             ACPI_FORMAT_UINT64 (Temp3->Integer.Value),
662             ACPI_FORMAT_UINT64 (Temp1->Integer.Value));
663     }
664
665 Exit:
666     if (Temp1) {AcpiOsFree (Temp1);}
667     if (Temp2) {AcpiOsFree (Temp2);}
668     if (Temp3) {AcpiOsFree (Temp3);}
669     return (AE_OK);
670 }
671
672
673 /*******************************************************************************
674  *
675  * FUNCTION:    AcpiDbTestBufferType
676  *
677  * PARAMETERS:  Node                - Parent NS node for the object
678  *              BitLength           - Actual length of the object.
679  *
680  * RETURN:      Status
681  *
682  * DESCRIPTION: Test read/write for an Buffer-valued object. Performs a
683  *              write/read/compare of an arbitrary new value, then performs
684  *              a write/read/compare of the original value.
685  *
686  ******************************************************************************/
687
688 static ACPI_STATUS
689 AcpiDbTestBufferType (
690     ACPI_NAMESPACE_NODE     *Node,
691     UINT32                  BitLength)
692 {
693     ACPI_OBJECT             *Temp1 = NULL;
694     ACPI_OBJECT             *Temp2 = NULL;
695     ACPI_OBJECT             *Temp3 = NULL;
696     UINT8                   *Buffer;
697     ACPI_OBJECT             WriteValue;
698     ACPI_STATUS             Status;
699     UINT32                  ByteLength;
700     UINT32                  i;
701     UINT8                   ExtraBits;
702
703
704     ByteLength = ACPI_ROUND_BITS_UP_TO_BYTES (BitLength);
705     if (ByteLength == 0)
706     {
707         AcpiOsPrintf (" Ignoring zero length buffer");
708         return (AE_OK);
709     }
710
711     /* Allocate a local buffer */
712
713     Buffer = ACPI_ALLOCATE_ZEROED (ByteLength);
714     if (!Buffer)
715     {
716         return (AE_NO_MEMORY);
717     }
718
719     /* Read the original value */
720
721     Status = AcpiDbReadFromObject (Node, ACPI_TYPE_BUFFER, &Temp1);
722     if (ACPI_FAILURE (Status))
723     {
724         goto Exit;
725     }
726
727     /* Emit a few bytes of the buffer */
728
729     AcpiOsPrintf (ACPI_DEBUG_LENGTH_FORMAT, BitLength, Temp1->Buffer.Length);
730     for (i = 0; ((i < 8) && (i < ByteLength)); i++)
731     {
732         AcpiOsPrintf (" %2.2X", Temp1->Buffer.Pointer[i]);
733     }
734     AcpiOsPrintf ("...  ");
735
736     /*
737      * Write a new value.
738      *
739      * Handle possible extra bits at the end of the buffer. Can
740      * happen for FieldUnits larger than an integer, but the bit
741      * count is not an integral number of bytes. Zero out the
742      * unused bits.
743      */
744     memset (Buffer, BUFFER_FILL_VALUE, ByteLength);
745     ExtraBits = BitLength % 8;
746     if (ExtraBits)
747     {
748         Buffer [ByteLength - 1] = ACPI_MASK_BITS_ABOVE (ExtraBits);
749     }
750
751     WriteValue.Type = ACPI_TYPE_BUFFER;
752     WriteValue.Buffer.Length = ByteLength;
753     WriteValue.Buffer.Pointer = Buffer;
754
755     Status = AcpiDbWriteToObject (Node, &WriteValue);
756     if (ACPI_FAILURE (Status))
757     {
758         goto Exit;
759     }
760
761     /* Ensure that we can read back the new value */
762
763     Status = AcpiDbReadFromObject (Node, ACPI_TYPE_BUFFER, &Temp2);
764     if (ACPI_FAILURE (Status))
765     {
766         goto Exit;
767     }
768
769     if (memcmp (Temp2->Buffer.Pointer, Buffer, ByteLength))
770     {
771         AcpiOsPrintf (" MISMATCH 2: New buffer value");
772     }
773
774     /* Write back the original value */
775
776     WriteValue.Buffer.Length = ByteLength;
777     WriteValue.Buffer.Pointer = Temp1->Buffer.Pointer;
778
779     Status = AcpiDbWriteToObject (Node, &WriteValue);
780     if (ACPI_FAILURE (Status))
781     {
782         goto Exit;
783     }
784
785     /* Ensure that we can read back the original value */
786
787     Status = AcpiDbReadFromObject (Node, ACPI_TYPE_BUFFER, &Temp3);
788     if (ACPI_FAILURE (Status))
789     {
790         goto Exit;
791     }
792
793     if (memcmp (Temp1->Buffer.Pointer,
794             Temp3->Buffer.Pointer, ByteLength))
795     {
796         AcpiOsPrintf (" MISMATCH 3: While restoring original buffer");
797     }
798
799 Exit:
800     ACPI_FREE (Buffer);
801     if (Temp1) {AcpiOsFree (Temp1);}
802     if (Temp2) {AcpiOsFree (Temp2);}
803     if (Temp3) {AcpiOsFree (Temp3);}
804     return (Status);
805 }
806
807
808 /*******************************************************************************
809  *
810  * FUNCTION:    AcpiDbTestStringType
811  *
812  * PARAMETERS:  Node                - Parent NS node for the object
813  *              ByteLength          - Actual length of the object.
814  *
815  * RETURN:      Status
816  *
817  * DESCRIPTION: Test read/write for an String-valued object. Performs a
818  *              write/read/compare of an arbitrary new value, then performs
819  *              a write/read/compare of the original value.
820  *
821  ******************************************************************************/
822
823 static ACPI_STATUS
824 AcpiDbTestStringType (
825     ACPI_NAMESPACE_NODE     *Node,
826     UINT32                  ByteLength)
827 {
828     ACPI_OBJECT             *Temp1 = NULL;
829     ACPI_OBJECT             *Temp2 = NULL;
830     ACPI_OBJECT             *Temp3 = NULL;
831     char                    *ValueToWrite = "Test String from AML Debugger";
832     ACPI_OBJECT             WriteValue;
833     ACPI_STATUS             Status;
834
835
836     /* Read the original value */
837
838     Status = AcpiDbReadFromObject (Node, ACPI_TYPE_STRING, &Temp1);
839     if (ACPI_FAILURE (Status))
840     {
841         return (Status);
842     }
843
844     AcpiOsPrintf (ACPI_DEBUG_LENGTH_FORMAT " \"%s\"", (Temp1->String.Length * 8),
845         Temp1->String.Length, Temp1->String.Pointer);
846
847     /* Write a new value */
848
849     WriteValue.Type = ACPI_TYPE_STRING;
850     WriteValue.String.Length = strlen (ValueToWrite);
851     WriteValue.String.Pointer = ValueToWrite;
852
853     Status = AcpiDbWriteToObject (Node, &WriteValue);
854     if (ACPI_FAILURE (Status))
855     {
856         goto Exit;
857     }
858
859     /* Ensure that we can read back the new value */
860
861     Status = AcpiDbReadFromObject (Node, ACPI_TYPE_STRING, &Temp2);
862     if (ACPI_FAILURE (Status))
863     {
864         goto Exit;
865     }
866
867     if (strcmp (Temp2->String.Pointer, ValueToWrite))
868     {
869         AcpiOsPrintf (" MISMATCH 2: %s, expecting %s",
870             Temp2->String.Pointer, ValueToWrite);
871     }
872
873     /* Write back the original value */
874
875     WriteValue.String.Length = strlen (Temp1->String.Pointer);
876     WriteValue.String.Pointer = Temp1->String.Pointer;
877
878     Status = AcpiDbWriteToObject (Node, &WriteValue);
879     if (ACPI_FAILURE (Status))
880     {
881         goto Exit;
882     }
883
884     /* Ensure that we can read back the original value */
885
886     Status = AcpiDbReadFromObject (Node, ACPI_TYPE_STRING, &Temp3);
887     if (ACPI_FAILURE (Status))
888     {
889         goto Exit;
890     }
891
892     if (strcmp (Temp1->String.Pointer, Temp3->String.Pointer))
893     {
894         AcpiOsPrintf (" MISMATCH 3: %s, expecting %s",
895             Temp3->String.Pointer, Temp1->String.Pointer);
896     }
897
898 Exit:
899     if (Temp1) {AcpiOsFree (Temp1);}
900     if (Temp2) {AcpiOsFree (Temp2);}
901     if (Temp3) {AcpiOsFree (Temp3);}
902     return (Status);
903 }
904
905
906 /*******************************************************************************
907  *
908  * FUNCTION:    AcpiDbTestPackageType
909  *
910  * PARAMETERS:  Node                - Parent NS node for the object
911  *
912  * RETURN:      Status
913  *
914  * DESCRIPTION: Test read for a Package object.
915  *
916  ******************************************************************************/
917
918 static ACPI_STATUS
919 AcpiDbTestPackageType (
920     ACPI_NAMESPACE_NODE     *Node)
921 {
922     ACPI_OBJECT             *Temp1 = NULL;
923     ACPI_STATUS             Status;
924
925
926     /* Read the original value */
927
928     Status = AcpiDbReadFromObject (Node, ACPI_TYPE_PACKAGE, &Temp1);
929     if (ACPI_FAILURE (Status))
930     {
931         return (Status);
932     }
933
934     AcpiOsPrintf (" %.2X Elements", Temp1->Package.Count);
935     AcpiOsFree (Temp1);
936     return (Status);
937 }
938
939
940 /*******************************************************************************
941  *
942  * FUNCTION:    AcpiDbTestFieldUnitType
943  *
944  * PARAMETERS:  ObjDesc                 - A field unit object
945  *
946  * RETURN:      Status
947  *
948  * DESCRIPTION: Test read/write on a named field unit.
949  *
950  ******************************************************************************/
951
952 static ACPI_STATUS
953 AcpiDbTestFieldUnitType (
954     ACPI_OPERAND_OBJECT     *ObjDesc)
955 {
956     ACPI_OPERAND_OBJECT     *RegionObj;
957     UINT32                  BitLength = 0;
958     UINT32                  ByteLength = 0;
959     ACPI_STATUS             Status = AE_OK;
960     ACPI_OPERAND_OBJECT     *RetBufferDesc;
961
962
963     /* Supported spaces are memory/io/pci_config */
964
965     RegionObj = ObjDesc->Field.RegionObj;
966     switch (RegionObj->Region.SpaceId)
967     {
968     case ACPI_ADR_SPACE_SYSTEM_MEMORY:
969     case ACPI_ADR_SPACE_SYSTEM_IO:
970     case ACPI_ADR_SPACE_PCI_CONFIG:
971
972         /* Need the interpreter to execute */
973
974         AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
975         AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
976
977         /* Exercise read-then-write */
978
979         Status = AcpiExReadDataFromField (NULL, ObjDesc, &RetBufferDesc);
980         if (Status == AE_OK)
981         {
982             AcpiExWriteDataToField (RetBufferDesc, ObjDesc, NULL);
983             AcpiUtRemoveReference (RetBufferDesc);
984         }
985
986         AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
987         AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
988
989         BitLength = ObjDesc->CommonField.BitLength;
990         ByteLength = ACPI_ROUND_BITS_UP_TO_BYTES (BitLength);
991
992         AcpiOsPrintf (ACPI_DEBUG_LENGTH_FORMAT " [%s]", BitLength,
993             ByteLength, AcpiUtGetRegionName (RegionObj->Region.SpaceId));
994         return (Status);
995
996     default:
997
998         AcpiOsPrintf (
999             "      %s address space is not supported in this command [%4.4s]",
1000             AcpiUtGetRegionName (RegionObj->Region.SpaceId),
1001             RegionObj->Region.Node->Name.Ascii);
1002         return (AE_OK);
1003     }
1004 }
1005
1006
1007 /*******************************************************************************
1008  *
1009  * FUNCTION:    AcpiDbReadFromObject
1010  *
1011  * PARAMETERS:  Node                - Parent NS node for the object
1012  *              ExpectedType        - Object type expected from the read
1013  *              Value               - Where the value read is returned
1014  *
1015  * RETURN:      Status
1016  *
1017  * DESCRIPTION: Performs a read from the specified object by invoking the
1018  *              special debugger control method that reads the object. Thus,
1019  *              the AML interpreter is doing all of the work, increasing the
1020  *              validity of the test.
1021  *
1022  ******************************************************************************/
1023
1024 static ACPI_STATUS
1025 AcpiDbReadFromObject (
1026     ACPI_NAMESPACE_NODE     *Node,
1027     ACPI_OBJECT_TYPE        ExpectedType,
1028     ACPI_OBJECT             **Value)
1029 {
1030     ACPI_OBJECT             *RetValue;
1031     ACPI_OBJECT_LIST        ParamObjects;
1032     ACPI_OBJECT             Params[2];
1033     ACPI_BUFFER             ReturnObj;
1034     ACPI_STATUS             Status;
1035
1036
1037     Params[0].Type = ACPI_TYPE_LOCAL_REFERENCE;
1038     Params[0].Reference.ActualType = Node->Type;
1039     Params[0].Reference.Handle = ACPI_CAST_PTR (ACPI_HANDLE, Node);
1040
1041     ParamObjects.Count = 1;
1042     ParamObjects.Pointer = Params;
1043
1044     ReturnObj.Length  = ACPI_ALLOCATE_BUFFER;
1045
1046     AcpiGbl_MethodExecuting = TRUE;
1047     Status = AcpiEvaluateObject (ReadHandle, NULL,
1048         &ParamObjects, &ReturnObj);
1049
1050     AcpiGbl_MethodExecuting = FALSE;
1051     if (ACPI_FAILURE (Status))
1052     {
1053         AcpiOsPrintf ("Could not read from object, %s",
1054             AcpiFormatException (Status));
1055         return (Status);
1056     }
1057
1058     RetValue = (ACPI_OBJECT *) ReturnObj.Pointer;
1059
1060     switch (RetValue->Type)
1061     {
1062     case ACPI_TYPE_INTEGER:
1063     case ACPI_TYPE_BUFFER:
1064     case ACPI_TYPE_STRING:
1065     case ACPI_TYPE_PACKAGE:
1066         /*
1067          * Did we receive the type we wanted? Most important for the
1068          * Integer/Buffer case (when a field is larger than an Integer,
1069          * it should return a Buffer).
1070          */
1071         if (RetValue->Type != ExpectedType)
1072         {
1073             AcpiOsPrintf (" Type mismatch:  Expected %s, Received %s",
1074                 AcpiUtGetTypeName (ExpectedType),
1075                 AcpiUtGetTypeName (RetValue->Type));
1076
1077             AcpiOsFree (ReturnObj.Pointer);
1078             return (AE_TYPE);
1079         }
1080
1081         *Value = RetValue;
1082         break;
1083
1084     default:
1085
1086         AcpiOsPrintf (" Unsupported return object type, %s",
1087             AcpiUtGetTypeName (RetValue->Type));
1088
1089         AcpiOsFree (ReturnObj.Pointer);
1090         return (AE_TYPE);
1091     }
1092
1093     return (Status);
1094 }
1095
1096
1097 /*******************************************************************************
1098  *
1099  * FUNCTION:    AcpiDbWriteToObject
1100  *
1101  * PARAMETERS:  Node                - Parent NS node for the object
1102  *              Value               - Value to be written
1103  *
1104  * RETURN:      Status
1105  *
1106  * DESCRIPTION: Performs a write to the specified object by invoking the
1107  *              special debugger control method that writes the object. Thus,
1108  *              the AML interpreter is doing all of the work, increasing the
1109  *              validity of the test.
1110  *
1111  ******************************************************************************/
1112
1113 static ACPI_STATUS
1114 AcpiDbWriteToObject (
1115     ACPI_NAMESPACE_NODE     *Node,
1116     ACPI_OBJECT             *Value)
1117 {
1118     ACPI_OBJECT_LIST        ParamObjects;
1119     ACPI_OBJECT             Params[2];
1120     ACPI_STATUS             Status;
1121
1122
1123     Params[0].Type = ACPI_TYPE_LOCAL_REFERENCE;
1124     Params[0].Reference.ActualType = Node->Type;
1125     Params[0].Reference.Handle = ACPI_CAST_PTR (ACPI_HANDLE, Node);
1126
1127     /* Copy the incoming user parameter */
1128
1129     memcpy (&Params[1], Value, sizeof (ACPI_OBJECT));
1130
1131     ParamObjects.Count = 2;
1132     ParamObjects.Pointer = Params;
1133
1134     AcpiGbl_MethodExecuting = TRUE;
1135     Status = AcpiEvaluateObject (WriteHandle, NULL, &ParamObjects, NULL);
1136     AcpiGbl_MethodExecuting = FALSE;
1137
1138     if (ACPI_FAILURE (Status))
1139     {
1140         AcpiOsPrintf ("Could not write to object, %s",
1141             AcpiFormatException (Status));
1142     }
1143
1144     return (Status);
1145 }
1146
1147
1148 /*******************************************************************************
1149  *
1150  * FUNCTION:    AcpiDbEvaluateAllPredefinedNames
1151  *
1152  * PARAMETERS:  CountArg            - Max number of methods to execute
1153  *
1154  * RETURN:      None
1155  *
1156  * DESCRIPTION: Namespace batch execution. Execute predefined names in the
1157  *              namespace, up to the max count, if specified.
1158  *
1159  ******************************************************************************/
1160
1161 static void
1162 AcpiDbEvaluateAllPredefinedNames (
1163     char                    *CountArg)
1164 {
1165     ACPI_DB_EXECUTE_WALK    Info;
1166
1167
1168     Info.Count = 0;
1169     Info.MaxCount = ACPI_UINT32_MAX;
1170
1171     if (CountArg)
1172     {
1173         Info.MaxCount = strtoul (CountArg, NULL, 0);
1174     }
1175
1176     /* Search all nodes in namespace */
1177
1178     (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
1179         ACPI_UINT32_MAX, AcpiDbEvaluateOnePredefinedName, NULL,
1180         (void *) &Info, NULL);
1181
1182     AcpiOsPrintf (
1183         "Evaluated %u predefined names in the namespace\n", Info.Count);
1184 }
1185
1186
1187 /*******************************************************************************
1188  *
1189  * FUNCTION:    AcpiDbEvaluateOnePredefinedName
1190  *
1191  * PARAMETERS:  Callback from WalkNamespace
1192  *
1193  * RETURN:      Status
1194  *
1195  * DESCRIPTION: Batch execution module. Currently only executes predefined
1196  *              ACPI names.
1197  *
1198  ******************************************************************************/
1199
1200 static ACPI_STATUS
1201 AcpiDbEvaluateOnePredefinedName (
1202     ACPI_HANDLE             ObjHandle,
1203     UINT32                  NestingLevel,
1204     void                    *Context,
1205     void                    **ReturnValue)
1206 {
1207     ACPI_NAMESPACE_NODE         *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
1208     ACPI_DB_EXECUTE_WALK        *Info = (ACPI_DB_EXECUTE_WALK *) Context;
1209     char                        *Pathname;
1210     const ACPI_PREDEFINED_INFO  *Predefined;
1211     ACPI_DEVICE_INFO            *ObjInfo;
1212     ACPI_OBJECT_LIST            ParamObjects;
1213     ACPI_OBJECT                 Params[ACPI_METHOD_NUM_ARGS];
1214     ACPI_OBJECT                 *ThisParam;
1215     ACPI_BUFFER                 ReturnObj;
1216     ACPI_STATUS                 Status;
1217     UINT16                      ArgTypeList;
1218     UINT8                       ArgCount;
1219     UINT8                       ArgType;
1220     UINT32                      i;
1221
1222
1223     /* The name must be a predefined ACPI name */
1224
1225     Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii);
1226     if (!Predefined)
1227     {
1228         return (AE_OK);
1229     }
1230
1231     if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
1232     {
1233         return (AE_OK);
1234     }
1235
1236     Pathname = AcpiNsGetNormalizedPathname (Node, TRUE);
1237     if (!Pathname)
1238     {
1239         return (AE_OK);
1240     }
1241
1242     /* Get the object info for number of method parameters */
1243
1244     Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo);
1245     if (ACPI_FAILURE (Status))
1246     {
1247         ACPI_FREE (Pathname);
1248         return (Status);
1249     }
1250
1251     ParamObjects.Count = 0;
1252     ParamObjects.Pointer = NULL;
1253
1254     if (ObjInfo->Type == ACPI_TYPE_METHOD)
1255     {
1256         /* Setup default parameters (with proper types) */
1257
1258         ArgTypeList = Predefined->Info.ArgumentList;
1259         ArgCount = METHOD_GET_ARG_COUNT (ArgTypeList);
1260
1261         /*
1262          * Setup the ACPI-required number of arguments, regardless of what
1263          * the actual method defines. If there is a difference, then the
1264          * method is wrong and a warning will be issued during execution.
1265          */
1266         ThisParam = Params;
1267         for (i = 0; i < ArgCount; i++)
1268         {
1269             ArgType = METHOD_GET_NEXT_TYPE (ArgTypeList);
1270             ThisParam->Type = ArgType;
1271
1272             switch (ArgType)
1273             {
1274             case ACPI_TYPE_INTEGER:
1275
1276                 ThisParam->Integer.Value = 1;
1277                 break;
1278
1279             case ACPI_TYPE_STRING:
1280
1281                 ThisParam->String.Pointer =
1282                     "This is the default argument string";
1283                 ThisParam->String.Length =
1284                     strlen (ThisParam->String.Pointer);
1285                 break;
1286
1287             case ACPI_TYPE_BUFFER:
1288
1289                 ThisParam->Buffer.Pointer = (UINT8 *) Params; /* just a garbage buffer */
1290                 ThisParam->Buffer.Length = 48;
1291                 break;
1292
1293              case ACPI_TYPE_PACKAGE:
1294
1295                 ThisParam->Package.Elements = NULL;
1296                 ThisParam->Package.Count = 0;
1297                 break;
1298
1299            default:
1300
1301                 AcpiOsPrintf ("%s: Unsupported argument type: %u\n",
1302                     Pathname, ArgType);
1303                 break;
1304             }
1305
1306             ThisParam++;
1307         }
1308
1309         ParamObjects.Count = ArgCount;
1310         ParamObjects.Pointer = Params;
1311     }
1312
1313     ACPI_FREE (ObjInfo);
1314     ReturnObj.Pointer = NULL;
1315     ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
1316
1317     /* Do the actual method execution */
1318
1319     AcpiGbl_MethodExecuting = TRUE;
1320
1321     Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj);
1322
1323     AcpiOsPrintf ("%-32s returned %s\n",
1324         Pathname, AcpiFormatException (Status));
1325     AcpiGbl_MethodExecuting = FALSE;
1326     ACPI_FREE (Pathname);
1327
1328     /* Ignore status from method execution */
1329
1330     Status = AE_OK;
1331
1332     /* Update count, check if we have executed enough methods */
1333
1334     Info->Count++;
1335     if (Info->Count >= Info->MaxCount)
1336     {
1337         Status = AE_CTRL_TERMINATE;
1338     }
1339
1340     return (Status);
1341 }
1342
1343 #endif /* ACPI_DEBUGGER */