Subversion Repositories Kolibri OS

Rev

Rev 1498 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1498 Rev 2216
Line 1... Line 1...
1
/*******************************************************************************
1
/*******************************************************************************
2
 *
2
 *
3
 * Module Name: dbcmds - debug commands and output routines
3
 * Module Name: dbcmds - Miscellaneous debug commands and output routines
4
 *
4
 *
5
 ******************************************************************************/
5
 ******************************************************************************/
Line 6... Line 6...
6
 
6
 
7
/******************************************************************************
7
/******************************************************************************
8
 *
8
 *
9
 * 1. Copyright Notice
9
 * 1. Copyright Notice
10
 *
10
 *
11
 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
11
 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
12
 * All rights reserved.
12
 * All rights reserved.
13
 *
13
 *
14
 * 2. License
14
 * 2. License
15
 *
15
 *
Line 114... Line 114...
114
 *****************************************************************************/
114
 *****************************************************************************/
Line 115... Line 115...
115
 
115
 
116
 
116
 
117
#include "acpi.h"
-
 
118
#include "accommon.h"
-
 
119
#include "acdispat.h"
117
#include "acpi.h"
120
#include "acnamesp.h"
118
#include "accommon.h"
121
#include "acevents.h"
119
#include "acevents.h"
122
#include "acdebug.h"
-
 
123
#include "acresrc.h"
120
#include "acdebug.h"
124
#include "acdisasm.h"
-
 
Line 125... Line 121...
125
#include "actables.h"
121
#include "acresrc.h"
Line 126... Line 122...
126
#include "acparser.h"
122
#include "actables.h"
127
 
123
 
Line 128... Line 124...
128
#ifdef ACPI_DEBUGGER
124
#ifdef ACPI_DEBUGGER
Line 129... Line -...
129
 
-
 
130
#define _COMPONENT          ACPI_CA_DEBUGGER
-
 
131
        ACPI_MODULE_NAME    ("dbcmds")
-
 
132
 
-
 
133
 
-
 
134
/* Local prototypes */
-
 
135
 
-
 
136
static ACPI_STATUS
-
 
137
AcpiDbIntegrityWalk (
-
 
138
    ACPI_HANDLE             ObjHandle,
-
 
139
    UINT32                  NestingLevel,
-
 
140
    void                    *Context,
-
 
141
    void                    **ReturnValue);
-
 
142
 
-
 
143
static ACPI_STATUS
-
 
144
AcpiDbWalkAndMatchName (
-
 
145
    ACPI_HANDLE             ObjHandle,
-
 
146
    UINT32                  NestingLevel,
-
 
147
    void                    *Context,
-
 
148
    void                    **ReturnValue);
-
 
149
 
-
 
150
static ACPI_STATUS
-
 
151
AcpiDbWalkForReferences (
-
 
152
    ACPI_HANDLE             ObjHandle,
-
 
153
    UINT32                  NestingLevel,
-
 
154
    void                    *Context,
-
 
155
    void                    **ReturnValue);
-
 
156
 
-
 
157
static ACPI_STATUS
-
 
158
AcpiDbWalkForSpecificObjects (
-
 
159
    ACPI_HANDLE             ObjHandle,
-
 
160
    UINT32                  NestingLevel,
-
 
161
    void                    *Context,
125
 
162
    void                    **ReturnValue);
126
#define _COMPONENT          ACPI_CA_DEBUGGER
163
 
127
        ACPI_MODULE_NAME    ("dbcmds")
164
static ACPI_NAMESPACE_NODE *
128
 
165
AcpiDbConvertToNode (
129
 
Line 176... Line 140...
176
AcpiDmTestResourceConversion (
140
AcpiDmTestResourceConversion (
177
    ACPI_NAMESPACE_NODE     *Node,
141
    ACPI_NAMESPACE_NODE     *Node,
178
    char                    *Name);
142
    char                    *Name);
Line 179... Line -...
179
 
-
 
180
 
-
 
181
/*
-
 
182
 * Arguments for the Objects command
-
 
183
 * These object types map directly to the ACPI_TYPES
-
 
184
 */
-
 
185
static ARGUMENT_INFO        AcpiDbObjectTypes [] =
-
 
186
{
-
 
187
    {"ANY"},
-
 
188
    {"INTEGERS"},
-
 
189
    {"STRINGS"},
-
 
190
    {"BUFFERS"},
-
 
191
    {"PACKAGES"},
-
 
192
    {"FIELDS"},
-
 
193
    {"DEVICES"},
-
 
194
    {"EVENTS"},
-
 
195
    {"METHODS"},
-
 
196
    {"MUTEXES"},
-
 
197
    {"REGIONS"},
-
 
198
    {"POWERRESOURCES"},
-
 
199
    {"PROCESSORS"},
-
 
200
    {"THERMALZONES"},
-
 
201
    {"BUFFERFIELDS"},
-
 
202
    {"DDBHANDLES"},
-
 
203
    {"DEBUG"},
-
 
204
    {"REGIONFIELDS"},
-
 
205
    {"BANKFIELDS"},
-
 
206
    {"INDEXFIELDS"},
-
 
207
    {"REFERENCES"},
-
 
208
    {"ALIAS"},
-
 
209
    {NULL}           /* Must be null terminated */
-
 
210
};
-
 
211
 
143
 
212
 
144
 
213
/*******************************************************************************
145
/*******************************************************************************
214
 *
146
 *
215
 * FUNCTION:    AcpiDbConvertToNode
147
 * FUNCTION:    AcpiDbConvertToNode
Line 221... Line 153...
221
 * DESCRIPTION: Convert a string to a valid NS pointer.  Handles numeric or
153
 * DESCRIPTION: Convert a string to a valid NS pointer.  Handles numeric or
222
 *              alpha strings.
154
 *              alpha strings.
223
 *
155
 *
224
 ******************************************************************************/
156
 ******************************************************************************/
Line 225... Line 157...
225
 
157
 
226
static ACPI_NAMESPACE_NODE *
158
ACPI_NAMESPACE_NODE *
227
AcpiDbConvertToNode (
159
AcpiDbConvertToNode (
228
    char                    *InString)
160
    char                    *InString)
229
{
161
{
Line 308... Line 240...
308
    Status = AcpiLeaveSleepState (SleepState);
240
    Status = AcpiLeaveSleepState (SleepState);
Line 309... Line 241...
309
 
241
 
310
    return (Status);
242
    return (Status);
Line 311... Line -...
311
}
-
 
312
 
-
 
313
 
-
 
314
/*******************************************************************************
-
 
315
 *
-
 
316
 * FUNCTION:    AcpiDbWalkForReferences
-
 
317
 *
-
 
318
 * PARAMETERS:  Callback from WalkNamespace
-
 
319
 *
-
 
320
 * RETURN:      Status
-
 
321
 *
-
 
322
 * DESCRIPTION: Check if this namespace object refers to the target object
-
 
323
 *              that is passed in as the context value.
-
 
324
 *
-
 
325
 * Note: Currently doesn't check subobjects within the Node's object
-
 
326
 *
-
 
327
 ******************************************************************************/
-
 
328
 
-
 
329
static ACPI_STATUS
-
 
330
AcpiDbWalkForReferences (
-
 
331
    ACPI_HANDLE             ObjHandle,
-
 
332
    UINT32                  NestingLevel,
-
 
333
    void                    *Context,
-
 
334
    void                    **ReturnValue)
-
 
335
{
-
 
336
    ACPI_OPERAND_OBJECT     *ObjDesc = (ACPI_OPERAND_OBJECT  *) Context;
-
 
337
    ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
-
 
338
 
-
 
339
 
-
 
340
    /* Check for match against the namespace node itself */
-
 
341
 
-
 
342
    if (Node == (void *) ObjDesc)
-
 
343
    {
-
 
344
        AcpiOsPrintf ("Object is a Node [%4.4s]\n",
-
 
345
            AcpiUtGetNodeName (Node));
-
 
346
    }
-
 
347
 
-
 
348
    /* Check for match against the object attached to the node */
-
 
349
 
-
 
350
    if (AcpiNsGetAttachedObject (Node) == ObjDesc)
-
 
351
    {
-
 
352
        AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n",
-
 
353
            Node, AcpiUtGetNodeName (Node));
-
 
354
    }
-
 
355
 
-
 
356
    return (AE_OK);
-
 
357
}
-
 
358
 
-
 
359
 
-
 
360
/*******************************************************************************
-
 
361
 *
-
 
362
 * FUNCTION:    AcpiDbFindReferences
-
 
363
 *
-
 
364
 * PARAMETERS:  ObjectArg       - String with hex value of the object
-
 
365
 *
-
 
366
 * RETURN:      None
-
 
367
 *
-
 
368
 * DESCRIPTION: Search namespace for all references to the input object
-
 
369
 *
-
 
370
 ******************************************************************************/
-
 
371
 
-
 
372
void
-
 
373
AcpiDbFindReferences (
-
 
374
    char                    *ObjectArg)
-
 
375
{
-
 
376
    ACPI_OPERAND_OBJECT     *ObjDesc;
-
 
377
 
-
 
378
 
-
 
379
    /* Convert string to object pointer */
-
 
380
 
-
 
381
    ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
-
 
382
 
-
 
383
    /* Search all nodes in namespace */
-
 
384
 
-
 
385
    (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-
 
386
                    AcpiDbWalkForReferences, NULL, (void *) ObjDesc, NULL);
-
 
387
}
-
 
388
 
-
 
389
 
-
 
390
/*******************************************************************************
-
 
391
 *
-
 
392
 * FUNCTION:    AcpiDbWalkForPredefinedNames
-
 
393
 *
-
 
394
 * PARAMETERS:  Callback from WalkNamespace
-
 
395
 *
-
 
396
 * RETURN:      Status
-
 
397
 *
-
 
398
 * DESCRIPTION: Detect and display predefined ACPI names (names that start with
-
 
399
 *              an underscore)
-
 
400
 *
-
 
401
 ******************************************************************************/
-
 
402
 
-
 
403
static ACPI_STATUS
-
 
404
AcpiDbWalkForPredefinedNames (
-
 
405
    ACPI_HANDLE             ObjHandle,
-
 
406
    UINT32                  NestingLevel,
-
 
407
    void                    *Context,
-
 
408
    void                    **ReturnValue)
-
 
409
{
-
 
410
    ACPI_NAMESPACE_NODE         *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
-
 
411
    UINT32                      *Count = (UINT32 *) Context;
-
 
412
    const ACPI_PREDEFINED_INFO  *Predefined;
-
 
413
    const ACPI_PREDEFINED_INFO  *Package = NULL;
-
 
414
    char                        *Pathname;
-
 
415
 
-
 
416
 
-
 
417
    Predefined = AcpiNsCheckForPredefinedName (Node);
-
 
418
    if (!Predefined)
-
 
419
    {
-
 
420
        return (AE_OK);
-
 
421
    }
-
 
422
 
-
 
423
    Pathname = AcpiNsGetExternalPathname (Node);
-
 
424
    if (!Pathname)
-
 
425
    {
-
 
426
        return (AE_OK);
-
 
427
    }
-
 
428
 
-
 
429
    /* If method returns a package, the info is in the next table entry */
-
 
430
 
-
 
431
    if (Predefined->Info.ExpectedBtypes & ACPI_BTYPE_PACKAGE)
-
 
432
    {
-
 
433
        Package = Predefined + 1;
-
 
434
    }
-
 
435
 
-
 
436
    AcpiOsPrintf ("%-32s arg %X ret %2.2X", Pathname,
-
 
437
        Predefined->Info.ParamCount, Predefined->Info.ExpectedBtypes);
-
 
438
 
-
 
439
    if (Package)
-
 
440
    {
-
 
441
        AcpiOsPrintf (" PkgType %2.2X ObjType %2.2X Count %2.2X",
-
 
442
            Package->RetInfo.Type, Package->RetInfo.ObjectType1,
-
 
443
            Package->RetInfo.Count1);
-
 
444
    }
-
 
445
 
-
 
446
    AcpiOsPrintf("\n");
-
 
447
 
-
 
448
    AcpiNsCheckParameterCount (Pathname, Node, ACPI_UINT32_MAX, Predefined);
-
 
449
    ACPI_FREE (Pathname);
-
 
450
    (*Count)++;
-
 
451
 
-
 
452
    return (AE_OK);
-
 
453
}
-
 
454
 
-
 
455
 
-
 
456
/*******************************************************************************
-
 
457
 *
-
 
458
 * FUNCTION:    AcpiDbCheckPredefinedNames
-
 
459
 *
-
 
460
 * PARAMETERS:  None
-
 
461
 *
-
 
462
 * RETURN:      None
-
 
463
 *
-
 
464
 * DESCRIPTION: Validate all predefined names in the namespace
-
 
465
 *
-
 
466
 ******************************************************************************/
-
 
467
 
-
 
468
void
-
 
469
AcpiDbCheckPredefinedNames (
-
 
470
    void)
-
 
471
{
-
 
472
    UINT32                  Count = 0;
-
 
473
 
-
 
474
 
-
 
475
    /* Search all nodes in namespace */
-
 
476
 
-
 
477
    (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-
 
478
                AcpiDbWalkForPredefinedNames, NULL, (void *) &Count, NULL);
-
 
479
 
-
 
480
    AcpiOsPrintf ("Found %u predefined names in the namespace\n", Count);
-
 
481
}
-
 
482
 
-
 
483
 
-
 
484
/*******************************************************************************
-
 
485
 *
-
 
486
 * FUNCTION:    AcpiDbWalkForExecute
-
 
487
 *
-
 
488
 * PARAMETERS:  Callback from WalkNamespace
-
 
489
 *
-
 
490
 * RETURN:      Status
-
 
491
 *
-
 
492
 * DESCRIPTION: Batch execution module. Currently only executes predefined
-
 
493
 *              ACPI names.
-
 
494
 *
-
 
495
 ******************************************************************************/
-
 
496
 
-
 
497
static ACPI_STATUS
-
 
498
AcpiDbWalkForExecute (
-
 
499
    ACPI_HANDLE             ObjHandle,
-
 
500
    UINT32                  NestingLevel,
-
 
501
    void                    *Context,
-
 
502
    void                    **ReturnValue)
-
 
503
{
-
 
504
    ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
-
 
505
    ACPI_EXECUTE_WALK       *Info = (ACPI_EXECUTE_WALK *) Context;
-
 
506
    ACPI_BUFFER             ReturnObj;
-
 
507
    ACPI_STATUS             Status;
-
 
508
    char                    *Pathname;
-
 
509
    UINT32                  i;
-
 
510
    ACPI_DEVICE_INFO        *ObjInfo;
-
 
511
    ACPI_OBJECT_LIST        ParamObjects;
-
 
512
    ACPI_OBJECT             Params[ACPI_METHOD_NUM_ARGS];
-
 
513
    const ACPI_PREDEFINED_INFO *Predefined;
-
 
514
 
-
 
515
 
-
 
516
    Predefined = AcpiNsCheckForPredefinedName (Node);
-
 
517
    if (!Predefined)
-
 
518
    {
-
 
519
        return (AE_OK);
-
 
520
    }
-
 
521
 
-
 
522
    if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
-
 
523
    {
-
 
524
        return (AE_OK);
-
 
525
    }
-
 
526
 
-
 
527
    Pathname = AcpiNsGetExternalPathname (Node);
-
 
528
    if (!Pathname)
-
 
529
    {
-
 
530
        return (AE_OK);
-
 
531
    }
-
 
532
 
-
 
533
    /* Get the object info for number of method parameters */
-
 
534
 
-
 
535
    Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo);
-
 
536
    if (ACPI_FAILURE (Status))
-
 
537
    {
-
 
538
        return (Status);
-
 
539
    }
-
 
540
 
-
 
541
    ParamObjects.Pointer = NULL;
-
 
542
    ParamObjects.Count   = 0;
-
 
543
 
-
 
544
    if (ObjInfo->Type == ACPI_TYPE_METHOD)
-
 
545
    {
-
 
546
        /* Setup default parameters */
-
 
547
 
-
 
548
        for (i = 0; i < ObjInfo->ParamCount; i++)
-
 
549
        {
-
 
550
            Params[i].Type           = ACPI_TYPE_INTEGER;
-
 
551
            Params[i].Integer.Value  = 1;
-
 
552
        }
-
 
553
 
-
 
554
        ParamObjects.Pointer     = Params;
-
 
555
        ParamObjects.Count       = ObjInfo->ParamCount;
-
 
556
    }
-
 
557
 
-
 
558
    ACPI_FREE (ObjInfo);
-
 
559
    ReturnObj.Pointer = NULL;
-
 
560
    ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
-
 
561
 
-
 
562
    /* Do the actual method execution */
-
 
563
 
-
 
564
    AcpiGbl_MethodExecuting = TRUE;
-
 
565
 
-
 
566
    Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj);
-
 
567
 
-
 
568
    AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status));
-
 
569
    AcpiGbl_MethodExecuting = FALSE;
-
 
570
    ACPI_FREE (Pathname);
-
 
571
 
-
 
572
    /* Ignore status from method execution */
-
 
573
 
-
 
574
    Status = AE_OK;
-
 
575
 
-
 
576
    /* Update count, check if we have executed enough methods */
-
 
577
 
-
 
578
    Info->Count++;
-
 
579
    if (Info->Count >= Info->MaxCount)
-
 
580
    {
-
 
581
        Status = AE_CTRL_TERMINATE;
-
 
582
    }
-
 
583
 
-
 
584
    return (Status);
-
 
585
}
-
 
586
 
-
 
587
 
-
 
588
/*******************************************************************************
-
 
589
 *
-
 
590
 * FUNCTION:    AcpiDbBatchExecute
-
 
591
 *
-
 
592
 * PARAMETERS:  CountArg            - Max number of methods to execute
-
 
593
 *
-
 
594
 * RETURN:      None
-
 
595
 *
-
 
596
 * DESCRIPTION: Namespace batch execution. Execute predefined names in the
-
 
597
 *              namespace, up to the max count, if specified.
-
 
598
 *
-
 
599
 ******************************************************************************/
-
 
600
 
-
 
601
void
-
 
602
AcpiDbBatchExecute (
-
 
603
    char                    *CountArg)
-
 
604
{
-
 
605
    ACPI_EXECUTE_WALK       Info;
-
 
606
 
-
 
607
 
-
 
608
    Info.Count = 0;
-
 
609
    Info.MaxCount = ACPI_UINT32_MAX;
-
 
610
 
-
 
611
    if (CountArg)
-
 
612
    {
-
 
613
        Info.MaxCount = ACPI_STRTOUL (CountArg, NULL, 0);
-
 
614
    }
-
 
615
 
-
 
616
 
-
 
617
    /* Search all nodes in namespace */
-
 
618
 
-
 
619
    (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-
 
620
                AcpiDbWalkForExecute, NULL, (void *) &Info, NULL);
-
 
621
 
-
 
622
    AcpiOsPrintf ("Executed %u predefined names in the namespace\n", Info.Count);
-
 
623
}
-
 
624
 
243
}
625
 
244
 
626
/*******************************************************************************
245
/*******************************************************************************
627
 *
246
 *
628
 * FUNCTION:    AcpiDbDisplayLocks
247
 * FUNCTION:    AcpiDbDisplayLocks
Line 761... Line 380...
761
}
380
}
Line 762... Line 381...
762
 
381
 
763
 
382
 
764
/*******************************************************************************
-
 
765
 *
-
 
766
 * FUNCTION:    AcpiDbSetMethodBreakpoint
-
 
767
 *
-
 
768
 * PARAMETERS:  Location            - AML offset of breakpoint
-
 
769
 *              WalkState           - Current walk info
-
 
770
 *              Op                  - Current Op (from parse walk)
-
 
771
 *
-
 
772
 * RETURN:      None
-
 
773
 *
-
 
774
 * DESCRIPTION: Set a breakpoint in a control method at the specified
-
 
775
 *              AML offset
-
 
776
 *
-
 
777
 ******************************************************************************/
-
 
778
 
-
 
779
void
-
 
780
AcpiDbSetMethodBreakpoint (
-
 
781
    char                    *Location,
-
 
782
    ACPI_WALK_STATE         *WalkState,
-
 
783
    ACPI_PARSE_OBJECT       *Op)
-
 
784
{
-
 
785
    UINT32                  Address;
-
 
786
 
-
 
787
 
-
 
788
    if (!Op)
-
 
789
    {
-
 
790
        AcpiOsPrintf ("There is no method currently executing\n");
-
 
791
        return;
-
 
792
    }
-
 
793
 
-
 
794
    /* Get and verify the breakpoint address */
-
 
795
 
-
 
796
    Address = ACPI_STRTOUL (Location, NULL, 16);
-
 
797
    if (Address <= Op->Common.AmlOffset)
-
 
798
    {
-
 
799
        AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n",
-
 
800
            Address, Op->Common.AmlOffset);
-
 
801
    }
-
 
802
 
-
 
803
    /* Save breakpoint in current walk */
-
 
804
 
-
 
805
    WalkState->UserBreakpoint = Address;
-
 
806
    AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address);
-
 
807
}
-
 
808
 
-
 
809
 
-
 
810
/*******************************************************************************
-
 
811
 *
-
 
812
 * FUNCTION:    AcpiDbSetMethodCallBreakpoint
-
 
813
 *
-
 
814
 * PARAMETERS:  Op                  - Current Op (from parse walk)
-
 
815
 *
-
 
816
 * RETURN:      None
-
 
817
 *
-
 
818
 * DESCRIPTION: Set a breakpoint in a control method at the specified
-
 
819
 *              AML offset
-
 
820
 *
-
 
821
 ******************************************************************************/
-
 
822
 
-
 
823
void
-
 
824
AcpiDbSetMethodCallBreakpoint (
-
 
825
    ACPI_PARSE_OBJECT       *Op)
-
 
826
{
-
 
827
 
-
 
828
 
-
 
829
    if (!Op)
-
 
830
    {
-
 
831
        AcpiOsPrintf ("There is no method currently executing\n");
-
 
832
        return;
-
 
833
    }
-
 
834
 
-
 
835
    AcpiGbl_StepToNextCall = TRUE;
-
 
836
}
-
 
837
 
-
 
838
 
-
 
839
/*******************************************************************************
-
 
840
 *
-
 
841
 * FUNCTION:    AcpiDbDisassembleAml
-
 
842
 *
-
 
843
 * PARAMETERS:  Statements          - Number of statements to disassemble
-
 
844
 *              Op                  - Current Op (from parse walk)
-
 
845
 *
-
 
846
 * RETURN:      None
-
 
847
 *
-
 
848
 * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
-
 
849
 *              of statements specified.
-
 
850
 *
-
 
851
 ******************************************************************************/
-
 
852
 
-
 
853
void
-
 
854
AcpiDbDisassembleAml (
-
 
855
    char                    *Statements,
-
 
856
    ACPI_PARSE_OBJECT       *Op)
-
 
857
{
-
 
858
    UINT32                  NumStatements = 8;
-
 
859
 
-
 
860
 
-
 
861
    if (!Op)
-
 
862
    {
-
 
863
        AcpiOsPrintf ("There is no method currently executing\n");
-
 
864
        return;
-
 
865
    }
-
 
866
 
-
 
867
    if (Statements)
-
 
868
    {
-
 
869
        NumStatements = ACPI_STRTOUL (Statements, NULL, 0);
-
 
870
    }
-
 
871
 
-
 
872
    AcpiDmDisassemble (NULL, Op, NumStatements);
-
 
873
}
-
 
874
 
-
 
875
 
-
 
876
/*******************************************************************************
-
 
877
 *
-
 
878
 * FUNCTION:    AcpiDbDisassembleMethod
-
 
879
 *
-
 
880
 * PARAMETERS:  Name            - Name of control method
-
 
881
 *
-
 
882
 * RETURN:      None
-
 
883
 *
-
 
884
 * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
-
 
885
 *              of statements specified.
-
 
886
 *
-
 
887
 ******************************************************************************/
-
 
888
 
-
 
889
ACPI_STATUS
-
 
890
AcpiDbDisassembleMethod (
-
 
891
    char                    *Name)
-
 
892
{
-
 
893
    ACPI_STATUS             Status;
-
 
894
    ACPI_PARSE_OBJECT       *Op;
-
 
895
    ACPI_WALK_STATE         *WalkState;
-
 
896
    ACPI_OPERAND_OBJECT     *ObjDesc;
-
 
897
    ACPI_NAMESPACE_NODE     *Method;
-
 
898
 
-
 
899
 
-
 
900
    Method = AcpiDbConvertToNode (Name);
-
 
901
    if (!Method)
-
 
902
    {
-
 
903
        return (AE_BAD_PARAMETER);
-
 
904
    }
-
 
905
 
-
 
906
    ObjDesc = Method->Object;
-
 
907
 
-
 
908
    Op = AcpiPsCreateScopeOp ();
-
 
909
    if (!Op)
-
 
910
    {
-
 
911
        return (AE_NO_MEMORY);
-
 
912
    }
-
 
913
 
-
 
914
    /* Create and initialize a new walk state */
-
 
915
 
-
 
916
    WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL);
-
 
917
    if (!WalkState)
-
 
918
    {
-
 
919
        return (AE_NO_MEMORY);
-
 
920
    }
-
 
921
 
-
 
922
    Status = AcpiDsInitAmlWalk (WalkState, Op, NULL,
-
 
923
                    ObjDesc->Method.AmlStart,
-
 
924
                    ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
-
 
925
    if (ACPI_FAILURE (Status))
-
 
926
    {
-
 
927
        return (Status);
-
 
928
    }
-
 
929
 
-
 
930
    /* Parse the AML */
-
 
931
 
-
 
932
    WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
-
 
933
    WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
-
 
934
    Status = AcpiPsParseAml (WalkState);
-
 
935
 
-
 
936
    AcpiDmDisassemble (NULL, Op, 0);
-
 
937
    AcpiPsDeleteParseTree (Op);
-
 
938
    return (AE_OK);
-
 
939
}
-
 
940
 
-
 
941
 
-
 
942
/*******************************************************************************
-
 
943
 *
-
 
944
 * FUNCTION:    AcpiDbDumpNamespace
-
 
945
 *
-
 
946
 * PARAMETERS:  StartArg        - Node to begin namespace dump
-
 
947
 *              DepthArg        - Maximum tree depth to be dumped
-
 
948
 *
-
 
949
 * RETURN:      None
-
 
950
 *
-
 
951
 * DESCRIPTION: Dump entire namespace or a subtree.  Each node is displayed
-
 
952
 *              with type and other information.
-
 
953
 *
-
 
954
 ******************************************************************************/
-
 
955
 
-
 
956
void
-
 
957
AcpiDbDumpNamespace (
-
 
958
    char                    *StartArg,
-
 
959
    char                    *DepthArg)
-
 
960
{
-
 
961
    ACPI_HANDLE             SubtreeEntry = AcpiGbl_RootNode;
-
 
962
    UINT32                  MaxDepth = ACPI_UINT32_MAX;
-
 
963
 
-
 
964
 
-
 
965
    /* No argument given, just start at the root and dump entire namespace */
-
 
966
 
-
 
967
    if (StartArg)
-
 
968
    {
-
 
969
        SubtreeEntry = AcpiDbConvertToNode (StartArg);
-
 
970
        if (!SubtreeEntry)
-
 
971
        {
-
 
972
            return;
-
 
973
        }
-
 
974
 
-
 
975
        /* Now we can check for the depth argument */
-
 
976
 
-
 
977
        if (DepthArg)
-
 
978
        {
-
 
979
            MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
-
 
980
        }
-
 
981
    }
-
 
982
 
-
 
983
    AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
-
 
984
    AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n",
-
 
985
        ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry);
-
 
986
 
-
 
987
    /* Display the subtree */
-
 
988
 
-
 
989
    AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
-
 
990
    AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth,
-
 
991
        ACPI_OWNER_ID_MAX, SubtreeEntry);
-
 
992
    AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
-
 
993
}
-
 
994
 
-
 
995
 
-
 
996
/*******************************************************************************
-
 
997
 *
-
 
998
 * FUNCTION:    AcpiDbDumpNamespaceByOwner
-
 
999
 *
-
 
1000
 * PARAMETERS:  OwnerArg        - Owner ID whose nodes will be displayed
-
 
1001
 *              DepthArg        - Maximum tree depth to be dumped
-
 
1002
 *
-
 
1003
 * RETURN:      None
-
 
1004
 *
-
 
1005
 * DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId.
-
 
1006
 *
-
 
1007
 ******************************************************************************/
-
 
1008
 
-
 
1009
void
-
 
1010
AcpiDbDumpNamespaceByOwner (
-
 
1011
    char                    *OwnerArg,
-
 
1012
    char                    *DepthArg)
-
 
1013
{
-
 
1014
    ACPI_HANDLE             SubtreeEntry = AcpiGbl_RootNode;
-
 
1015
    UINT32                  MaxDepth = ACPI_UINT32_MAX;
-
 
1016
    ACPI_OWNER_ID           OwnerId;
-
 
1017
 
-
 
1018
 
-
 
1019
    OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0);
-
 
1020
 
-
 
1021
    /* Now we can check for the depth argument */
-
 
1022
 
-
 
1023
    if (DepthArg)
-
 
1024
    {
-
 
1025
        MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
-
 
1026
    }
-
 
1027
 
-
 
1028
    AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
-
 
1029
    AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId);
-
 
1030
 
-
 
1031
    /* Display the subtree */
-
 
1032
 
-
 
1033
    AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
-
 
1034
    AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId,
-
 
1035
        SubtreeEntry);
-
 
1036
    AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
-
 
1037
}
-
 
1038
 
-
 
1039
 
-
 
1040
/*******************************************************************************
383
/*******************************************************************************
1041
 *
384
 *
1042
 * FUNCTION:    AcpiDbSendNotify
385
 * FUNCTION:    AcpiDbSendNotify
1043
 *
386
 *
1044
 * PARAMETERS:  Name            - Name of ACPI object to send the notify to
387
 * PARAMETERS:  Name            - Name of ACPI object to send the notify to
Line 1091... Line 434...
1091
}
434
}
Line 1092... Line 435...
1092
 
435
 
1093
 
436
 
1094
/*******************************************************************************
437
/*******************************************************************************
1095
 *
438
 *
1096
 * FUNCTION:    AcpiDbSetMethodData
439
 * FUNCTION:    AcpiDbDisplayInterfaces
1097
 *
-
 
1098
 * PARAMETERS:  TypeArg         - L for local, A for argument
440
 *
1099
 *              IndexArg        - which one
441
 * PARAMETERS:  ActionArg           - Null, "install", or "remove"
1100
 *              ValueArg        - Value to set.
442
 *              InterfaceNameArg    - Name for install/remove options
1101
 *
443
 *
1102
 * RETURN:      None
444
 * RETURN:      None
1103
 *
-
 
1104
 * DESCRIPTION: Set a local or argument for the running control method.
445
 *
1105
 *              NOTE: only object supported is Number.
446
 * DESCRIPTION: Display or modify the global _OSI interface list
Line 1106... Line 447...
1106
 *
447
 *
1107
 ******************************************************************************/
448
 ******************************************************************************/
1108
 
-
 
1109
void
449
 
1110
AcpiDbSetMethodData (
450
void
1111
    char                    *TypeArg,
451
AcpiDbDisplayInterfaces (
1112
    char                    *IndexArg,
-
 
1113
    char                    *ValueArg)
452
    char                    *ActionArg,
1114
{
453
    char                    *InterfaceNameArg)
1115
    char                    Type;
-
 
1116
    UINT32                  Index;
-
 
1117
    UINT32                  Value;
454
{
1118
    ACPI_WALK_STATE         *WalkState;
-
 
Line 1119... Line 455...
1119
    ACPI_OPERAND_OBJECT     *ObjDesc;
455
    ACPI_INTERFACE_INFO     *NextInterface;
Line 1120... Line -...
1120
    ACPI_STATUS             Status;
-
 
1121
    ACPI_NAMESPACE_NODE     *Node;
-
 
1122
 
456
    char                    *SubString;
1123
 
-
 
1124
    /* Validate TypeArg */
-
 
1125
 
457
    ACPI_STATUS             Status;
1126
    AcpiUtStrupr (TypeArg);
458
 
1127
    Type = TypeArg[0];
459
 
1128
    if ((Type != 'L') &&
-
 
Line 1129... Line 460...
1129
        (Type != 'A') &&
460
    /* If no arguments, just display current interface list */
Line 1130... Line 461...
1130
        (Type != 'N'))
461
 
1131
    {
462
    if (!ActionArg)
1132
        AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg);
-
 
1133
        return;
463
    {
1134
    }
464
        (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex,
1135
 
465
                    ACPI_WAIT_FOREVER);
1136
    Value = ACPI_STRTOUL (ValueArg, NULL, 16);
-
 
1137
 
466
 
1138
    if (Type == 'N')
-
 
1139
    {
467
        NextInterface = AcpiGbl_SupportedInterfaces;
1140
        Node = AcpiDbConvertToNode (IndexArg);
-
 
1141
        if (Node->Type != ACPI_TYPE_INTEGER)
468
 
Line 1142... Line -...
1142
        {
-
 
1143
            AcpiOsPrintf ("Can only set Integer nodes\n");
-
 
1144
            return;
-
 
1145
        }
-
 
1146
        ObjDesc = Node->Object;
469
        while (NextInterface)
1147
        ObjDesc->Integer.Value = Value;
-
 
1148
        return;
-
 
1149
    }
-
 
1150
 
470
        {
1151
    /* Get the index and value */
471
            if (!(NextInterface->Flags & ACPI_OSI_INVALID))
Line 1152... Line 472...
1152
 
472
            {
Line 1153... Line -...
1153
    Index = ACPI_STRTOUL (IndexArg, NULL, 16);
-
 
1154
 
473
                AcpiOsPrintf ("%s\n", NextInterface->Name);
1155
    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
474
            }
1156
    if (!WalkState)
475
            NextInterface = NextInterface->Next;
1157
    {
476
        }
1158
        AcpiOsPrintf ("There is no method currently executing\n");
477
 
Line 1159... Line 478...
1159
        return;
478
        AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
1160
    }
-
 
1161
 
-
 
1162
    /* Create and initialize the new object */
-
 
1163
 
-
 
1164
    ObjDesc = AcpiUtCreateIntegerObject ((UINT64) Value);
-
 
1165
    if (!ObjDesc)
-
 
1166
    {
-
 
1167
        AcpiOsPrintf ("Could not create an internal object\n");
-
 
1168
        return;
-
 
1169
    }
-
 
1170
 
-
 
1171
    /* Store the new object into the target */
-
 
1172
 
-
 
1173
    switch (Type)
-
 
1174
    {
-
 
1175
    case 'A':
-
 
1176
 
-
 
1177
        /* Set a method argument */
-
 
1178
 
-
 
1179
        if (Index > ACPI_METHOD_MAX_ARG)
-
 
1180
        {
-
 
1181
            AcpiOsPrintf ("Arg%u - Invalid argument name\n", Index);
-
 
1182
            goto Cleanup;
-
 
1183
        }
-
 
1184
 
-
 
1185
        Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG, Index, ObjDesc,
-
 
1186
                    WalkState);
-
 
1187
        if (ACPI_FAILURE (Status))
-
 
1188
        {
-
 
1189
            goto Cleanup;
-
 
1190
        }
-
 
1191
 
-
 
1192
        ObjDesc = WalkState->Arguments[Index].Object;
-
 
1193
 
-
 
1194
        AcpiOsPrintf ("Arg%u: ", Index);
-
 
1195
        AcpiDmDisplayInternalObject (ObjDesc, WalkState);
-
 
1196
        break;
-
 
1197
 
-
 
1198
    case 'L':
-
 
1199
 
-
 
1200
        /* Set a method local */
-
 
1201
 
-
 
1202
        if (Index > ACPI_METHOD_MAX_LOCAL)
-
 
1203
        {
-
 
1204
            AcpiOsPrintf ("Local%u - Invalid local variable name\n", Index);
-
 
1205
            goto Cleanup;
-
 
1206
        }
-
 
1207
 
-
 
1208
        Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL, Index, ObjDesc,
-
 
1209
                    WalkState);
-
 
1210
        if (ACPI_FAILURE (Status))
-
 
1211
        {
-
 
1212
            goto Cleanup;
-
 
1213
        }
-
 
1214
 
-
 
1215
        ObjDesc = WalkState->LocalVariables[Index].Object;
-
 
Line -... Line 479...
-
 
479
        return;
Line 1216... Line -...
1216
 
-
 
1217
        AcpiOsPrintf ("Local%u: ", Index);
-
 
1218
        AcpiDmDisplayInternalObject (ObjDesc, WalkState);
480
    }
1219
        break;
-
 
1220
 
-
 
1221
    default:
-
 
1222
        break;
-
 
1223
    }
-
 
1224
 
-
 
1225
Cleanup:
-
 
1226
    AcpiUtRemoveReference (ObjDesc);
-
 
Line 1227... Line -...
1227
}
-
 
1228
 
-
 
1229
 
481
 
1230
/*******************************************************************************
-
 
1231
 *
482
    /* If ActionArg exists, so must InterfaceNameArg */
1232
 * FUNCTION:    AcpiDbWalkForSpecificObjects
-
 
1233
 *
483
 
1234
 * PARAMETERS:  Callback from WalkNamespace
-
 
1235
 *
-
 
1236
 * RETURN:      Status
-
 
1237
 *
-
 
1238
 * DESCRIPTION: Display short info about objects in the namespace
-
 
1239
 *
-
 
1240
 ******************************************************************************/
-
 
1241
 
-
 
1242
static ACPI_STATUS
-
 
1243
AcpiDbWalkForSpecificObjects (
-
 
1244
    ACPI_HANDLE             ObjHandle,
484
    if (!InterfaceNameArg)
1245
    UINT32                  NestingLevel,
485
    {
1246
    void                    *Context,
486
        AcpiOsPrintf ("Missing Interface Name argument\n");
1247
    void                    **ReturnValue)
487
        return;
1248
{
488
    }
1249
    ACPI_WALK_INFO          *Info = (ACPI_WALK_INFO *) Context;
489
 
1250
    ACPI_BUFFER             Buffer;
-
 
1251
    ACPI_STATUS             Status;
-
 
1252
 
-
 
1253
 
-
 
1254
    Info->Count++;
-
 
1255
 
-
 
1256
    /* Get and display the full pathname to this object */
-
 
1257
 
-
 
1258
    Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
-
 
1259
    Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
-
 
1260
    if (ACPI_FAILURE (Status))
-
 
1261
    {
-
 
1262
        AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
-
 
1263
        return (AE_OK);
-
 
1264
    }
-
 
1265
 
-
 
1266
    AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
-
 
1267
    ACPI_FREE (Buffer.Pointer);
-
 
1268
 
-
 
1269
    /* Dump short info about the object */
-
 
1270
 
-
 
1271
    (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, Info, NULL);
-
 
1272
    return (AE_OK);
-
 
1273
}
-
 
1274
 
-
 
1275
 
-
 
1276
/*******************************************************************************
-
 
1277
 *
-
 
1278
 * FUNCTION:    AcpiDbDisplayObjects
-
 
1279
 *
-
 
1280
 * PARAMETERS:  ObjTypeArg          - Type of object to display
-
 
1281
 *              DisplayCountArg     - Max depth to display
-
 
1282
 *
-
 
1283
 * RETURN:      None
-
 
1284
 *
-
 
1285
 * DESCRIPTION: Display objects in the namespace of the requested type
-
 
1286
 *
-
 
1287
 ******************************************************************************/
-
 
1288
 
-
 
1289
ACPI_STATUS
-
 
1290
AcpiDbDisplayObjects (
-
 
1291
    char                    *ObjTypeArg,
-
 
1292
    char                    *DisplayCountArg)
-
 
1293
{
-
 
1294
    ACPI_WALK_INFO          Info;
-
 
1295
    ACPI_OBJECT_TYPE        Type;
-
 
1296
 
-
 
1297
 
-
 
1298
    /* Get the object type */
-
 
1299
 
-
 
1300
    Type = AcpiDbMatchArgument (ObjTypeArg, AcpiDbObjectTypes);
-
 
1301
    if (Type == ACPI_TYPE_NOT_FOUND)
-
 
1302
    {
-
 
1303
        AcpiOsPrintf ("Invalid or unsupported argument\n");
-
 
1304
        return (AE_OK);
-
 
1305
    }
-
 
1306
 
-
 
1307
    AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
-
 
1308
    AcpiOsPrintf (
-
 
1309
        "Objects of type [%s] defined in the current ACPI Namespace:\n",
-
 
1310
        AcpiUtGetTypeName (Type));
-
 
1311
 
-
 
1312
    AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
-
 
1313
 
-
 
1314
    Info.Count = 0;
-
 
1315
    Info.OwnerId = ACPI_OWNER_ID_MAX;
-
 
1316
    Info.DebugLevel = ACPI_UINT32_MAX;
-
 
1317
    Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
-
 
1318
 
-
 
1319
    /* Walk the namespace from the root */
-
 
1320
 
-
 
1321
    (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-
 
1322
                AcpiDbWalkForSpecificObjects, NULL, (void *) &Info, NULL);
-
 
1323
 
-
 
1324
    AcpiOsPrintf (
-
 
1325
        "\nFound %u objects of type [%s] in the current ACPI Namespace\n",
-
 
1326
        Info.Count, AcpiUtGetTypeName (Type));
-
 
1327
 
-
 
1328
    AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
-
 
1329
    return (AE_OK);
-
 
1330
}
-
 
1331
 
-
 
1332
 
-
 
1333
/*******************************************************************************
-
 
1334
 *
-
 
1335
 * FUNCTION:    AcpiDbWalkAndMatchName
-
 
1336
 *
-
 
1337
 * PARAMETERS:  Callback from WalkNamespace
-
 
1338
 *
-
 
1339
 * RETURN:      Status
-
 
1340
 *
-
 
1341
 * DESCRIPTION: Find a particular name/names within the namespace.  Wildcards
-
 
1342
 *              are supported -- '?' matches any character.
-
 
1343
 *
-
 
1344
 ******************************************************************************/
-
 
1345
 
-
 
1346
static ACPI_STATUS
-
 
1347
AcpiDbWalkAndMatchName (
-
 
1348
    ACPI_HANDLE             ObjHandle,
-
 
1349
    UINT32                  NestingLevel,
-
 
1350
    void                    *Context,
-
 
1351
    void                    **ReturnValue)
-
 
1352
{
-
 
1353
    ACPI_STATUS             Status;
-
 
1354
    char                    *RequestedName = (char *) Context;
-
 
1355
    UINT32                  i;
-
 
1356
    ACPI_BUFFER             Buffer;
-
 
1357
    ACPI_WALK_INFO          Info;
-
 
1358
 
-
 
1359
 
-
 
1360
    /* Check for a name match */
-
 
1361
 
-
 
1362
    for (i = 0; i < 4; i++)
-
 
1363
    {
-
 
1364
        /* Wildcard support */
-
 
1365
 
-
 
1366
        if ((RequestedName[i] != '?') &&
-
 
1367
            (RequestedName[i] != ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii[i]))
-
 
1368
        {
-
 
1369
            /* No match, just exit */
-
 
1370
 
-
 
1371
            return (AE_OK);
-
 
1372
        }
-
 
1373
    }
-
 
1374
 
-
 
1375
    /* Get the full pathname to this object */
-
 
1376
 
-
 
1377
    Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
-
 
1378
    Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
-
 
1379
    if (ACPI_FAILURE (Status))
-
 
1380
    {
-
 
1381
        AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
-
 
1382
    }
-
 
1383
    else
-
 
1384
    {
-
 
1385
        Info.OwnerId = ACPI_OWNER_ID_MAX;
-
 
1386
        Info.DebugLevel = ACPI_UINT32_MAX;
-
 
1387
        Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
-
 
1388
 
-
 
1389
        AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
-
 
1390
        (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL);
-
 
1391
        ACPI_FREE (Buffer.Pointer);
-
 
1392
    }
-
 
1393
 
-
 
1394
    return (AE_OK);
-
 
1395
}
-
 
1396
 
-
 
1397
 
-
 
1398
/*******************************************************************************
-
 
1399
 *
-
 
1400
 * FUNCTION:    AcpiDbFindNameInNamespace
-
 
1401
 *
-
 
1402
 * PARAMETERS:  NameArg         - The 4-character ACPI name to find.
-
 
1403
 *                                wildcards are supported.
-
 
1404
 *
-
 
1405
 * RETURN:      None
-
 
1406
 *
-
 
1407
 * DESCRIPTION: Search the namespace for a given name (with wildcards)
-
 
1408
 *
-
 
1409
 ******************************************************************************/
-
 
1410
 
-
 
1411
ACPI_STATUS
-
 
1412
AcpiDbFindNameInNamespace (
-
 
1413
    char                    *NameArg)
-
 
1414
{
-
 
1415
    char                    AcpiName[5] = "____";
-
 
1416
    char                    *AcpiNamePtr = AcpiName;
-
 
1417
 
-
 
1418
 
-
 
1419
    if (ACPI_STRLEN (NameArg) > 4)
-
 
1420
    {
-
 
1421
        AcpiOsPrintf ("Name must be no longer than 4 characters\n");
-
 
1422
        return (AE_OK);
-
 
1423
    }
-
 
1424
 
-
 
1425
    /* Pad out name with underscores as necessary to create a 4-char name */
-
 
1426
 
-
 
1427
    AcpiUtStrupr (NameArg);
-
 
1428
    while (*NameArg)
-
 
1429
    {
-
 
1430
        *AcpiNamePtr = *NameArg;
-
 
1431
        AcpiNamePtr++;
-
 
1432
        NameArg++;
-
 
1433
    }
-
 
1434
 
-
 
1435
    /* Walk the namespace from the root */
-
 
1436
 
-
 
1437
    (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-
 
1438
                        AcpiDbWalkAndMatchName, NULL, AcpiName, NULL);
-
 
1439
 
-
 
1440
    AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
-
 
1441
    return (AE_OK);
-
 
1442
}
-
 
1443
 
-
 
1444
 
-
 
1445
/*******************************************************************************
-
 
1446
 *
-
 
1447
 * FUNCTION:    AcpiDbSetScope
-
 
1448
 *
-
 
1449
 * PARAMETERS:  Name                - New scope path
-
 
1450
 *
-
 
1451
 * RETURN:      Status
-
 
1452
 *
-
 
1453
 * DESCRIPTION: Set the "current scope" as maintained by this utility.
-
 
1454
 *              The scope is used as a prefix to ACPI paths.
490
    /* Uppercase the action for match below */
1455
 *
491
 
Line 1456... Line 492...
1456
 ******************************************************************************/
492
    AcpiUtStrupr (ActionArg);
Line -... Line 493...
-
 
493
 
1457
 
494
    /* Install - install an interface */
1458
void
495
 
1459
AcpiDbSetScope (
-
 
1460
    char                    *Name)
-
 
1461
{
496
    SubString = ACPI_STRSTR ("INSTALL", ActionArg);
1462
    ACPI_STATUS             Status;
-
 
1463
    ACPI_NAMESPACE_NODE     *Node;
497
    if (SubString)
1464
 
498
    {
1465
 
-
 
1466
    if (!Name || Name[0] == 0)
-
 
1467
    {
-
 
1468
        AcpiOsPrintf ("Current scope: %s\n", AcpiGbl_DbScopeBuf);
499
        Status = AcpiInstallInterface (InterfaceNameArg);
1469
        return;
500
        if (ACPI_FAILURE (Status))
1470
    }
501
        {
1471
 
-
 
1472
    AcpiDbPrepNamestring (Name);
-
 
1473
 
-
 
1474
    if (Name[0] == '\\')
-
 
1475
    {
-
 
1476
        /* Validate new scope from the root */
-
 
1477
 
-
 
1478
        Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, ACPI_NS_NO_UPSEARCH,
502
            AcpiOsPrintf ("%s, while installing \"%s\"\n",
1479
                    &Node);
-
 
1480
        if (ACPI_FAILURE (Status))
503
                AcpiFormatException (Status), InterfaceNameArg);
Line 1481... Line -...
1481
        {
-
 
1482
            goto ErrorExit;
504
        }
1483
        }
-
 
Line 1484... Line -...
1484
 
-
 
1485
        ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name);
505
        return;
1486
        ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
506
    }
1487
    }
-
 
1488
    else
-
 
1489
    {
-
 
1490
        /* Validate new scope relative to old scope */
-
 
1491
 
-
 
1492
        Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, ACPI_NS_NO_UPSEARCH,
507
 
Line 1493... Line 508...
1493
                    &Node);
508
    /* Remove - remove an interface */
1494
        if (ACPI_FAILURE (Status))
509
 
Line 1837... Line 852...
1837
}
852
}
Line 1838... Line 853...
1838
 
853
 
1839
 
854
 
1840
/*******************************************************************************
-
 
1841
 *
-
 
1842
 * FUNCTION:    AcpiDbIntegrityWalk
-
 
1843
 *
-
 
1844
 * PARAMETERS:  Callback from WalkNamespace
-
 
1845
 *
-
 
1846
 * RETURN:      Status
-
 
1847
 *
-
 
1848
 * DESCRIPTION: Examine one NS node for valid values.
-
 
1849
 *
-
 
1850
 ******************************************************************************/
-
 
1851
 
-
 
1852
static ACPI_STATUS
-
 
1853
AcpiDbIntegrityWalk (
-
 
1854
    ACPI_HANDLE             ObjHandle,
-
 
1855
    UINT32                  NestingLevel,
-
 
1856
    void                    *Context,
-
 
1857
    void                    **ReturnValue)
-
 
1858
{
-
 
1859
    ACPI_INTEGRITY_INFO     *Info = (ACPI_INTEGRITY_INFO *) Context;
-
 
1860
    ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
-
 
1861
    ACPI_OPERAND_OBJECT     *Object;
-
 
1862
    BOOLEAN                 Alias = TRUE;
-
 
1863
 
-
 
1864
 
-
 
1865
    Info->Nodes++;
-
 
1866
 
-
 
1867
    /* Verify the NS node, and dereference aliases */
-
 
1868
 
-
 
1869
    while (Alias)
-
 
1870
    {
-
 
1871
        if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
-
 
1872
        {
-
 
1873
            AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s] - is %2.2X should be %2.2X\n",
-
 
1874
                Node, AcpiUtGetDescriptorName (Node), ACPI_GET_DESCRIPTOR_TYPE (Node),
-
 
1875
                ACPI_DESC_TYPE_NAMED);
-
 
1876
            return (AE_OK);
-
 
1877
        }
-
 
1878
 
-
 
1879
        if ((Node->Type == ACPI_TYPE_LOCAL_ALIAS)  ||
-
 
1880
            (Node->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS))
-
 
1881
        {
-
 
1882
            Node = (ACPI_NAMESPACE_NODE *) Node->Object;
-
 
1883
        }
-
 
1884
        else
-
 
1885
        {
-
 
1886
            Alias = FALSE;
-
 
1887
        }
-
 
1888
    }
-
 
1889
 
-
 
1890
    if (Node->Type > ACPI_TYPE_LOCAL_MAX)
-
 
1891
    {
-
 
1892
        AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n",
-
 
1893
            Node, Node->Type);
-
 
1894
        return (AE_OK);
-
 
1895
    }
-
 
1896
 
-
 
1897
    if (!AcpiUtValidAcpiName (Node->Name.Integer))
-
 
1898
    {
-
 
1899
        AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node);
-
 
1900
        return (AE_OK);
-
 
1901
    }
-
 
1902
 
-
 
1903
    Object = AcpiNsGetAttachedObject (Node);
-
 
1904
    if (Object)
-
 
1905
    {
-
 
1906
        Info->Objects++;
-
 
1907
        if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
-
 
1908
        {
-
 
1909
            AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n",
-
 
1910
                Object, AcpiUtGetDescriptorName (Object));
-
 
1911
        }
-
 
1912
    }
-
 
1913
 
-
 
1914
    return (AE_OK);
-
 
1915
}
-
 
1916
 
-
 
1917
 
-
 
1918
/*******************************************************************************
-
 
1919
 *
-
 
1920
 * FUNCTION:    AcpiDbCheckIntegrity
-
 
1921
 *
-
 
1922
 * PARAMETERS:  None
-
 
1923
 *
-
 
1924
 * RETURN:      None
-
 
1925
 *
-
 
1926
 * DESCRIPTION: Check entire namespace for data structure integrity
-
 
1927
 *
-
 
1928
 ******************************************************************************/
-
 
1929
 
-
 
1930
void
-
 
1931
AcpiDbCheckIntegrity (
-
 
1932
    void)
-
 
1933
{
-
 
1934
    ACPI_INTEGRITY_INFO     Info = {0,0};
-
 
1935
 
-
 
1936
    /* Search all nodes in namespace */
-
 
1937
 
-
 
1938
    (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-
 
1939
                    AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL);
-
 
1940
 
-
 
1941
    AcpiOsPrintf ("Verified %u namespace nodes with %u Objects\n",
-
 
1942
        Info.Nodes, Info.Objects);
-
 
1943
}
-
 
1944
 
-
 
1945
 
-
 
1946
/*******************************************************************************
855
/*******************************************************************************
1947
 *
856
 *
1948
 * FUNCTION:    AcpiDbGenerateGpe
857
 * FUNCTION:    AcpiDbGenerateGpe
1949
 *
858
 *
1950
 * PARAMETERS:  GpeArg          - Raw GPE number, ascii string
859
 * PARAMETERS:  GpeArg          - Raw GPE number, ascii string
Line 1977... Line 886...
1977
    {
886
    {
1978
        AcpiOsPrintf ("Invalid GPE\n");
887
        AcpiOsPrintf ("Invalid GPE\n");
1979
        return;
888
        return;
1980
    }
889
    }
Line 1981... Line 890...
1981
 
890
 
1982
    (void) AcpiEvGpeDispatch (GpeEventInfo, GpeNumber);
-
 
1983
}
-
 
1984
 
-
 
1985
 
-
 
1986
/*******************************************************************************
-
 
1987
 *
-
 
1988
 * FUNCTION:    AcpiDbBusWalk
-
 
1989
 *
-
 
1990
 * PARAMETERS:  Callback from WalkNamespace
-
 
1991
 *
-
 
1992
 * RETURN:      Status
-
 
1993
 *
-
 
1994
 * DESCRIPTION: Display info about device objects that have a corresponding
-
 
1995
 *              _PRT method.
-
 
1996
 *
-
 
1997
 ******************************************************************************/
-
 
1998
 
-
 
1999
static ACPI_STATUS
-
 
2000
AcpiDbBusWalk (
-
 
2001
    ACPI_HANDLE             ObjHandle,
-
 
2002
    UINT32                  NestingLevel,
-
 
2003
    void                    *Context,
-
 
2004
    void                    **ReturnValue)
-
 
2005
{
-
 
2006
    ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
-
 
2007
    ACPI_STATUS             Status;
-
 
2008
    ACPI_BUFFER             Buffer;
-
 
2009
    ACPI_NAMESPACE_NODE     *TempNode;
-
 
2010
    ACPI_DEVICE_INFO        *Info;
-
 
2011
    UINT32                  i;
-
 
2012
 
-
 
2013
 
-
 
2014
    if ((Node->Type != ACPI_TYPE_DEVICE) &&
-
 
2015
        (Node->Type != ACPI_TYPE_PROCESSOR))
-
 
2016
    {
-
 
2017
        return (AE_OK);
-
 
2018
    }
-
 
2019
 
-
 
2020
    /* Exit if there is no _PRT under this device */
-
 
2021
 
-
 
2022
    Status = AcpiGetHandle (Node, METHOD_NAME__PRT,
-
 
2023
                ACPI_CAST_PTR (ACPI_HANDLE, &TempNode));
-
 
2024
    if (ACPI_FAILURE (Status))
-
 
2025
    {
-
 
2026
        return (AE_OK);
-
 
2027
    }
-
 
2028
 
-
 
2029
    /* Get the full path to this device object */
-
 
2030
 
-
 
2031
    Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
-
 
2032
    Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
-
 
2033
    if (ACPI_FAILURE (Status))
-
 
2034
    {
-
 
2035
        AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
-
 
2036
        return (AE_OK);
-
 
2037
    }
-
 
2038
 
-
 
2039
    Status = AcpiGetObjectInfo (ObjHandle, &Info);
-
 
2040
    if (ACPI_FAILURE (Status))
-
 
2041
    {
-
 
2042
        return (AE_OK);
-
 
2043
    }
-
 
2044
 
-
 
2045
    /* Display the full path */
-
 
2046
 
-
 
2047
    AcpiOsPrintf ("%-32s Type %X", (char *) Buffer.Pointer, Node->Type);
-
 
2048
    ACPI_FREE (Buffer.Pointer);
-
 
2049
 
-
 
2050
    if (Info->Flags & ACPI_PCI_ROOT_BRIDGE)
-
 
2051
    {
-
 
2052
        AcpiOsPrintf ("  - Is PCI Root Bridge");
-
 
2053
    }
-
 
2054
    AcpiOsPrintf ("\n");
-
 
2055
 
-
 
2056
    /* _PRT info */
-
 
2057
 
-
 
2058
    AcpiOsPrintf ("_PRT: %p\n", TempNode);
-
 
2059
 
-
 
2060
    /* Dump _ADR, _HID, _UID, _CID */
-
 
2061
 
-
 
2062
    if (Info->Valid & ACPI_VALID_ADR)
-
 
2063
    {
-
 
2064
        AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Info->Address));
-
 
2065
    }
-
 
2066
    else
-
 
2067
    {
-
 
2068
        AcpiOsPrintf ("_ADR: \n");
-
 
2069
    }
-
 
2070
 
-
 
2071
    if (Info->Valid & ACPI_VALID_HID)
-
 
2072
    {
-
 
2073
        AcpiOsPrintf ("_HID: %s\n", Info->HardwareId.String);
-
 
2074
    }
-
 
2075
    else
-
 
2076
    {
-
 
2077
        AcpiOsPrintf ("_HID: \n");
-
 
2078
    }
-
 
2079
 
-
 
2080
    if (Info->Valid & ACPI_VALID_UID)
-
 
2081
    {
-
 
2082
        AcpiOsPrintf ("_UID: %s\n", Info->UniqueId.String);
-
 
2083
    }
-
 
2084
    else
-
 
2085
    {
-
 
2086
        AcpiOsPrintf ("_UID: \n");
-
 
2087
    }
-
 
2088
 
-
 
2089
    if (Info->Valid & ACPI_VALID_CID)
-
 
2090
    {
-
 
2091
        for (i = 0; i < Info->CompatibleIdList.Count; i++)
-
 
2092
        {
-
 
2093
            AcpiOsPrintf ("_CID: %s\n",
-
 
2094
                Info->CompatibleIdList.Ids[i].String);
-
 
2095
        }
-
 
2096
    }
-
 
2097
    else
-
 
2098
    {
-
 
2099
        AcpiOsPrintf ("_CID: \n");
-
 
2100
    }
-
 
2101
 
-
 
2102
    ACPI_FREE (Info);
-
 
2103
    return (AE_OK);
-
 
2104
}
-
 
2105
 
-
 
2106
 
-
 
2107
/*******************************************************************************
-
 
2108
 *
-
 
2109
 * FUNCTION:    AcpiDbGetBusInfo
-
 
2110
 *
-
 
2111
 * PARAMETERS:  None
-
 
2112
 *
-
 
2113
 * RETURN:      None
-
 
2114
 *
-
 
2115
 * DESCRIPTION: Display info about system busses.
-
 
2116
 *
-
 
2117
 ******************************************************************************/
-
 
2118
 
-
 
2119
void
-
 
2120
AcpiDbGetBusInfo (
-
 
2121
    void)
-
 
2122
{
-
 
2123
    /* Search all nodes in namespace */
-
 
2124
 
-
 
2125
    (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-
 
2126
                    AcpiDbBusWalk, NULL, NULL, NULL);
891
    (void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber);
Line 2127... Line 892...
2127
}
892
}