Rev 1498 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1498 | Rev 2216 | ||
---|---|---|---|
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 120... | Line 120... | ||
120 | #endif |
120 | #endif |
Line 121... | Line 121... | ||
121 | 121 | ||
122 | #define _COMPONENT PARSER |
122 | #define _COMPONENT PARSER |
Line 123... | Line -... | ||
123 | ACPI_MODULE_NAME ("aemain") |
- | |
- | 123 | ACPI_MODULE_NAME ("aemain") |
|
124 | 124 | ||
125 | UINT8 AcpiGbl_BatchMode = 0; |
125 | |
126 | UINT8 AcpiGbl_RegionFillValue = 0; |
126 | UINT8 AcpiGbl_RegionFillValue = 0; |
127 | BOOLEAN AcpiGbl_IgnoreErrors = FALSE; |
127 | BOOLEAN AcpiGbl_IgnoreErrors = FALSE; |
- | 128 | BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE; |
|
- | 129 | BOOLEAN AcpiGbl_DebugTimeout = FALSE; |
|
128 | BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE; |
130 | |
129 | BOOLEAN AcpiGbl_DebugTimeout = FALSE; |
131 | static UINT8 AcpiGbl_BatchMode = 0; |
Line 130... | Line 132... | ||
130 | char BatchBuffer[128]; |
132 | static char BatchBuffer[128]; |
131 | AE_TABLE_DESC *AeTableListHead = NULL; |
133 | static AE_TABLE_DESC *AeTableListHead = NULL; |
132 | - | ||
Line 133... | Line 134... | ||
133 | #define ASL_MAX_FILES 256 |
134 | |
Line 162... | Line 163... | ||
162 | printf ("\n"); |
163 | printf ("\n"); |
Line 163... | Line 164... | ||
163 | 164 | ||
164 | printf (" -da Disable method abort on error\n"); |
165 | printf (" -da Disable method abort on error\n"); |
165 | printf (" -di Disable execution of STA/INI methods during init\n"); |
166 | printf (" -di Disable execution of STA/INI methods during init\n"); |
- | 167 | printf (" -do Disable Operation Region address simulation\n"); |
|
166 | printf (" -do Disable Operation Region address simulation\n"); |
168 | printf (" -dr Disable repair of method return values\n"); |
167 | printf (" -dt Disable allocation tracking (performance)\n"); |
169 | printf (" -dt Disable allocation tracking (performance)\n"); |
Line 168... | Line 170... | ||
168 | printf ("\n"); |
170 | printf ("\n"); |
169 | 171 | ||
Line 201... | Line 203... | ||
201 | ACPI_STATUS Status; |
203 | ACPI_STATUS Status; |
202 | char *Ptr = BatchBuffer; |
204 | char *Ptr = BatchBuffer; |
203 | char *Cmd = Ptr; |
205 | char *Cmd = Ptr; |
204 | UINT8 Run = 0; |
206 | UINT8 Run = 0; |
Line -... | Line 207... | ||
- | 207 | ||
205 | 208 | ||
206 | AcpiGbl_MethodExecuting = FALSE; |
209 | AcpiGbl_MethodExecuting = FALSE; |
Line 207... | Line 210... | ||
207 | AcpiGbl_StepToNextCall = FALSE; |
210 | AcpiGbl_StepToNextCall = FALSE; |
208 | 211 | ||
Line 358... | Line 361... | ||
358 | char *FileSpecifier) |
361 | char *FileSpecifier) |
359 | { |
362 | { |
360 | #ifdef WIN32 |
363 | #ifdef WIN32 |
361 | void *DirInfo; |
364 | void *DirInfo; |
362 | char *Filename; |
365 | char *Filename; |
- | 366 | int FileCount; |
|
Line 363... | Line 367... | ||
363 | 367 | ||
Line 364... | Line 368... | ||
364 | 368 | ||
Line 439... | Line 443... | ||
439 | ACPI_STATUS Status; |
443 | ACPI_STATUS Status; |
440 | UINT32 InitFlags; |
444 | UINT32 InitFlags; |
441 | ACPI_TABLE_HEADER *Table = NULL; |
445 | ACPI_TABLE_HEADER *Table = NULL; |
442 | UINT32 TableCount; |
446 | UINT32 TableCount; |
443 | AE_TABLE_DESC *TableDesc; |
447 | AE_TABLE_DESC *TableDesc; |
444 | char **FileList; |
448 | char **WildcardList; |
445 | char *Filename; |
449 | char *Filename; |
446 | char *Directory; |
450 | char *Directory; |
447 | char *FullPathname; |
451 | char *FullPathname; |
Line 448... | Line 452... | ||
448 | 452 | ||
449 | 453 | ||
450 | #ifdef _DEBUG |
454 | #ifdef _DEBUG |
451 | _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | |
455 | _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | |
Line 452... | Line 456... | ||
452 | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); |
456 | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); |
453 | #endif |
- | |
454 | - | ||
Line 455... | Line 457... | ||
455 | printf ("\nIntel ACPI Component Architecture\nAML Execution/Debug Utility"); |
457 | #endif |
456 | printf (" version %8.8X", ((UINT32) ACPI_CA_VERSION)); |
458 | |
457 | printf (" [%s]\n\n", __DATE__); |
459 | printf (ACPI_COMMON_SIGNON ("AML Execution/Debug Utility")); |
458 | 460 | ||
459 | if (argc < 2) |
461 | if (argc < 2) |
Line 460... | Line 462... | ||
460 | { |
462 | { |
Line 461... | Line 463... | ||
461 | usage (); |
463 | usage (); |
Line 469... | Line 471... | ||
469 | AcpiDbgLevel = ACPI_NORMAL_DEFAULT; |
471 | AcpiDbgLevel = ACPI_NORMAL_DEFAULT; |
470 | AcpiDbgLayer = 0xFFFFFFFF; |
472 | AcpiDbgLayer = 0xFFFFFFFF; |
Line 471... | Line 473... | ||
471 | 473 | ||
Line 472... | Line 474... | ||
472 | /* Init ACPI and start debugger thread */ |
474 | /* Init ACPI and start debugger thread */ |
- | 475 | ||
Line 473... | Line 476... | ||
473 | 476 | Status = AcpiInitializeSubsystem (); |
|
Line 474... | Line 477... | ||
474 | AcpiInitializeSubsystem (); |
477 | AE_CHECK_OK (AcpiInitializeSubsystem, Status); |
475 | 478 | ||
476 | /* Get the command line options */ |
479 | /* Get the command line options */ |
477 | 480 | ||
478 | while ((j = AcpiGetopt (argc, argv, AE_SUPPORTED_OPTIONS)) != EOF) switch(j) |
481 | while ((j = AcpiGetopt (argc, argv, AE_SUPPORTED_OPTIONS)) != EOF) switch(j) |
479 | { |
482 | { |
480 | case 'b': |
483 | case 'b': |
481 | if (strlen (AcpiGbl_Optarg) > 127) |
484 | if (strlen (AcpiGbl_Optarg) > 127) |
482 | { |
485 | { |
483 | printf ("**** The length of command line (%u) exceeded maximum (127)\n", |
486 | printf ("**** The length of command line (%u) exceeded maximum (127)\n", |
484 | (UINT32) strlen (AcpiGbl_Optarg)); |
487 | (UINT32) strlen (AcpiGbl_Optarg)); |
485 | return -1; |
488 | return (-1); |
Line 501... | Line 504... | ||
501 | 504 | ||
502 | case 'o': |
505 | case 'o': |
503 | AcpiGbl_DbOpt_NoRegionSupport = TRUE; |
506 | AcpiGbl_DbOpt_NoRegionSupport = TRUE; |
Line -... | Line 507... | ||
- | 507 | break; |
|
- | 508 | ||
- | 509 | case 'r': |
|
- | 510 | AcpiGbl_DisableAutoRepair = TRUE; |
|
504 | break; |
511 | break; |
505 | 512 | ||
506 | case 't': |
513 | case 't': |
507 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
514 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
508 | AcpiGbl_DisableMemTracking = TRUE; |
515 | AcpiGbl_DisableMemTracking = TRUE; |
Line 584... | Line 591... | ||
584 | 591 | ||
585 | case '?': |
592 | case '?': |
586 | case 'h': |
593 | case 'h': |
587 | default: |
594 | default: |
588 | usage(); |
595 | usage(); |
589 | return -1; |
596 | return (-1); |
Line 590... | Line 597... | ||
590 | } |
597 | } |
591 | 598 | ||
Line 615... | Line 622... | ||
615 | return (Status); |
622 | return (Status); |
616 | } |
623 | } |
Line 617... | Line 624... | ||
617 | 624 | ||
Line 618... | Line 625... | ||
618 | /* Expand wildcards (Windows only) */ |
625 | /* Expand wildcards (Windows only) */ |
619 | 626 | ||
620 | FileList = AsDoWildcard (Directory, Filename); |
627 | WildcardList = AsDoWildcard (Directory, Filename); |
621 | if (!FileList) |
628 | if (!WildcardList) |
622 | { |
629 | { |
Line 623... | Line 630... | ||
623 | return -1; |
630 | return (-1); |
624 | } |
631 | } |
625 | 632 | ||
626 | while (*FileList) |
633 | while (*WildcardList) |
Line 627... | Line 634... | ||
627 | { |
634 | { |
Line 628... | Line 635... | ||
628 | FullPathname = AcpiOsAllocate ( |
635 | FullPathname = AcpiOsAllocate ( |
629 | strlen (Directory) + strlen (*FileList) + 1); |
636 | strlen (Directory) + strlen (*WildcardList) + 1); |
Line 630... | Line 637... | ||
630 | 637 | ||
Line 631... | Line 638... | ||
631 | /* Construct a full path to the file */ |
638 | /* Construct a full path to the file */ |
632 | 639 | ||
Line 642... | Line 649... | ||
642 | AcpiFormatException (Status)); |
649 | AcpiFormatException (Status)); |
643 | goto enterloop; |
650 | goto enterloop; |
644 | } |
651 | } |
Line 645... | Line 652... | ||
645 | 652 | ||
646 | AcpiOsFree (FullPathname); |
653 | AcpiOsFree (FullPathname); |
647 | AcpiOsFree (*FileList); |
654 | AcpiOsFree (*WildcardList); |
648 | *FileList = NULL; |
655 | *WildcardList = NULL; |
Line 649... | Line 656... | ||
649 | FileList++; |
656 | WildcardList++; |
650 | 657 | ||
651 | /* |
658 | /* |
652 | * Ignore an FACS or RSDT, we can't use them. |
659 | * Ignore an FACS or RSDT, we can't use them. |
Line 674... | Line 681... | ||
674 | /* Build a local RSDT with all tables and let ACPICA process the RSDT */ |
681 | /* Build a local RSDT with all tables and let ACPICA process the RSDT */ |
Line 675... | Line 682... | ||
675 | 682 | ||
676 | Status = AeBuildLocalTables (TableCount, AeTableListHead); |
683 | Status = AeBuildLocalTables (TableCount, AeTableListHead); |
677 | if (ACPI_FAILURE (Status)) |
684 | if (ACPI_FAILURE (Status)) |
678 | { |
685 | { |
679 | return -1; |
686 | return (-1); |
Line 680... | Line 687... | ||
680 | } |
687 | } |
681 | 688 | ||
682 | Status = AeInstallTables (); |
689 | Status = AeInstallTables (); |
683 | if (ACPI_FAILURE (Status)) |
690 | if (ACPI_FAILURE (Status)) |
684 | { |
691 | { |
685 | printf ("**** Could not load ACPI tables, %s\n", AcpiFormatException (Status)); |
692 | printf ("**** Could not load ACPI tables, %s\n", AcpiFormatException (Status)); |
Line -... | Line 693... | ||
- | 693 | goto enterloop; |
|
- | 694 | } |
|
- | 695 | ||
- | 696 | /* |
|
686 | goto enterloop; |
697 | * Install most of the handlers. |
687 | } |
698 | * Override some default region handlers, especially SystemMemory |
688 | 699 | */ |
|
689 | Status = AeInstallHandlers (); |
700 | Status = AeInstallEarlyHandlers (); |
690 | if (ACPI_FAILURE (Status)) |
701 | if (ACPI_FAILURE (Status)) |
Line 691... | Line 702... | ||
691 | { |
702 | { |
692 | goto enterloop; |
- | |
693 | } |
703 | goto enterloop; |
694 | 704 | } |
|
695 | /* |
705 | |
696 | * TBD: |
706 | /* |
697 | * Need a way to call this after the "LOAD" command |
707 | * TBD: Need a way to call this after the "LOAD" command |
698 | */ |
708 | */ |
Line 708... | Line 718... | ||
708 | { |
718 | { |
709 | printf ("**** Could not InitializeObjects, %s\n", AcpiFormatException (Status)); |
719 | printf ("**** Could not InitializeObjects, %s\n", AcpiFormatException (Status)); |
710 | goto enterloop; |
720 | goto enterloop; |
711 | } |
721 | } |
Line -... | Line 722... | ||
- | 722 | ||
- | 723 | /* |
|
- | 724 | * Install handlers for "device driver" space IDs (EC,SMBus, etc.) |
|
- | 725 | * and fixed event handlers |
|
- | 726 | */ |
|
712 | 727 | AeInstallLateHandlers (); |
|
713 | AeMiscellaneousTests (); |
728 | AeMiscellaneousTests (); |
Line 714... | Line 729... | ||
714 | } |
729 | } |
Line 719... | Line 734... | ||
719 | { |
734 | { |
720 | AcpiDbRunBatchMode (); |
735 | AcpiDbRunBatchMode (); |
721 | } |
736 | } |
722 | else if (AcpiGbl_BatchMode == 2) |
737 | else if (AcpiGbl_BatchMode == 2) |
723 | { |
738 | { |
724 | AcpiDbExecute (BatchBuffer, NULL, EX_NO_SINGLE_STEP); |
739 | AcpiDbExecute (BatchBuffer, NULL, NULL, EX_NO_SINGLE_STEP); |
725 | } |
740 | } |
726 | else |
741 | else |
727 | { |
742 | { |
728 | /* Enter the debugger command loop */ |
743 | /* Enter the debugger command loop */ |
Line 729... | Line 744... | ||
729 | 744 | ||
730 | AcpiDbUserCommands (ACPI_DEBUGGER_COMMAND_PROMPT, NULL); |
745 | AcpiDbUserCommands (ACPI_DEBUGGER_COMMAND_PROMPT, NULL); |
Line 731... | Line 746... | ||
731 | } |
746 | } |
732 | 747 |