diff options
Diffstat (limited to 'source/tools/acpiexec')
-rw-r--r-- | source/tools/acpiexec/aecommon.h | 4 | ||||
-rw-r--r-- | source/tools/acpiexec/aehandlers.c | 63 | ||||
-rw-r--r-- | source/tools/acpiexec/aemain.c | 54 | ||||
-rw-r--r-- | source/tools/acpiexec/aeregion.c | 58 | ||||
-rw-r--r-- | source/tools/acpiexec/aetables.c | 70 |
5 files changed, 164 insertions, 85 deletions
diff --git a/source/tools/acpiexec/aecommon.h b/source/tools/acpiexec/aecommon.h index bc30acf0ea11b..6184c6b62b40f 100644 --- a/source/tools/acpiexec/aecommon.h +++ b/source/tools/acpiexec/aecommon.h @@ -113,6 +113,10 @@ ACPI_STATUS AeInstallTables ( void); +ACPI_STATUS +AeLoadTables ( + void); + void AeDumpNamespace ( void); diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c index 625cf5704d4f8..ba461dd453b18 100644 --- a/source/tools/acpiexec/aehandlers.c +++ b/source/tools/acpiexec/aehandlers.c @@ -693,7 +693,39 @@ AeInstallLateHandlers ( void) { ACPI_STATUS Status; + ACPI_HANDLE Handle; + + + Status = AcpiGetHandle (NULL, "\\_TZ.TZ1", &Handle); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, + AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567)); + + Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, + AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF)); + + Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY, + AeNotifyHandler1); + Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY, + AeNotifyHandler2); + Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, + AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF)); + + Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, + AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567)); + } + + Status = AcpiGetHandle (NULL, "\\_PR.CPU0", &Handle); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, + AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567)); + + Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, + AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF)); + } #if (!ACPI_REDUCED_HARDWARE) if (!AcpiGbl_ReducedHardware) @@ -879,37 +911,6 @@ AeInstallEarlyHandlers ( printf ("No _SB_ found, %s\n", AcpiFormatException (Status)); } - Status = AcpiGetHandle (NULL, "\\_TZ.TZ1", &Handle); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, - AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567)); - - Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, - AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF)); - - Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY, - AeNotifyHandler1); - Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY, - AeNotifyHandler2); - - Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, - AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF)); - - Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, - AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567)); - } - - Status = AcpiGetHandle (NULL, "\\_PR.CPU0", &Handle); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, - AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567)); - - Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, - AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF)); - } - /* * Install handlers that will override the default handlers for some of * the space IDs. diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index bc35036df4b4f..a5f168c237b0f 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -152,9 +152,11 @@ usage ( ACPI_OPTION ("-dt", "Disable allocation tracking (performance)"); printf ("\n"); + ACPI_OPTION ("-ed", "Enable timer output for Debug Object"); ACPI_OPTION ("-ef", "Enable display of final memory statistics"); ACPI_OPTION ("-ei", "Enable additional tests for ACPICA interfaces"); ACPI_OPTION ("-el", "Enable loading of additional test tables"); + ACPI_OPTION ("-em", "Enable grouping of module-level code"); ACPI_OPTION ("-es", "Enable Interpreter Slack Mode"); ACPI_OPTION ("-et", "Enable debug semaphore timeout"); printf ("\n"); @@ -258,6 +260,11 @@ AeDoOptions ( switch (AcpiGbl_Optarg[0]) { + case 'd': + + AcpiGbl_DisplayDebugTimer = TRUE; + break; + case 'f': #ifdef ACPI_DBG_TRACK_ALLOCATIONS @@ -275,6 +282,11 @@ AeDoOptions ( AcpiGbl_LoadTestTables = TRUE; break; + case 'm': + + AcpiGbl_GroupModuleLevelCode = TRUE; + break; + case 's': AcpiGbl_EnableInterpreterSlack = TRUE; @@ -456,6 +468,7 @@ main ( /* Init ACPICA and start debugger thread */ + AcpiGbl_OverrideDefaultRegionHandlers = TRUE; Status = AcpiInitializeSubsystem (); ACPI_CHECK_OK (AcpiInitializeSubsystem, Status); if (ACPI_FAILURE (Status)) @@ -513,7 +526,7 @@ main ( { /* Get all ACPI AML tables in this file */ - Status = AcpiAcGetAllTablesFromFile (argv[AcpiGbl_Optind], + Status = AcGetAllTablesFromFile (argv[AcpiGbl_Optind], ACPI_GET_ONLY_AML_TABLES, &ListHead); if (ACPI_FAILURE (Status)) { @@ -534,28 +547,21 @@ main ( goto ErrorExit; } - Status = AeInstallTables (); + /* Install all of the ACPI tables */ - /* - * Exit namespace initialization for the "load namespace only" option. - * No control methods will be executed. However, still enter the - * the debugger. - */ - if (AcpiGbl_AeLoadOnly) - { - goto EnterDebugger; - } + Status = AeInstallTables (); if (ACPI_FAILURE (Status)) { - printf ("**** Could not load ACPI tables, %s\n", + printf ("**** Could not install ACPI tables, %s\n", AcpiFormatException (Status)); goto EnterDebugger; } /* - * Install most of the handlers. - * Override some default region handlers, especially SystemMemory + * Install most of the handlers (Regions, Notify, Table, etc.) + * Override the default region handlers, especially SystemMemory, + * which is simulated in this utility. */ Status = AeInstallEarlyHandlers (); if (ACPI_FAILURE (Status)) @@ -583,6 +589,25 @@ main ( goto EnterDebugger; } + Status = AeLoadTables (); + + /* + * Exit namespace initialization for the "load namespace only" option. + * No control methods will be executed. However, still enter the + * the debugger. + */ + if (AcpiGbl_AeLoadOnly) + { + goto EnterDebugger; + } + + if (ACPI_FAILURE (Status)) + { + printf ("**** Could not load ACPI tables, %s\n", + AcpiFormatException (Status)); + goto EnterDebugger; + } + /* * Install handlers for "device driver" space IDs (EC,SMBus, etc.) * and fixed event handlers @@ -637,6 +662,7 @@ EnterDebugger: break; } + (void) AcpiOsTerminate (); return (0); diff --git a/source/tools/acpiexec/aeregion.c b/source/tools/acpiexec/aeregion.c index a33e9e70def1c..31b4202974b05 100644 --- a/source/tools/acpiexec/aeregion.c +++ b/source/tools/acpiexec/aeregion.c @@ -149,59 +149,87 @@ AeRegionInit ( } +/****************************************************************************** + * + * FUNCTION: AeOverrideRegionHandlers + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Override the default region handlers for memory, i/o, and + * pci_config. Also install a handler for EC. This is part of + * the "install early handlers" functionality. + * + *****************************************************************************/ + void -AeInstallRegionHandlers ( +AeOverrideRegionHandlers ( void) { UINT32 i; ACPI_STATUS Status; /* - * Install handlers for some of the "device driver" address spaces - * such as SMBus, etc. + * Install handlers that will override the default handlers for some of + * the space IDs. */ - for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++) + for (i = 0; i < ACPI_ARRAY_LENGTH (DefaultSpaceIdList); i++) { /* Install handler at the root object */ Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT, - SpaceIdList[i], AeRegionHandler, + DefaultSpaceIdList[i], AeRegionHandler, AeRegionInit, &AeMyContext); + if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "Could not install an OpRegion handler for %s space(%u)", - AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i])); - return; + AcpiUtGetRegionName ((UINT8) DefaultSpaceIdList[i]), + DefaultSpaceIdList[i])); } } } +/****************************************************************************** + * + * FUNCTION: AeInstallRegionHandlers + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Install handlers for the address spaces other than memory, + * i/o, and pci_config. + * + *****************************************************************************/ + void -AeOverrideRegionHandlers ( +AeInstallRegionHandlers ( void) { UINT32 i; ACPI_STATUS Status; /* - * Install handlers that will override the default handlers for some of - * the space IDs. + * Install handlers for some of the "device driver" address spaces + * such as SMBus, etc. */ - for (i = 0; i < ACPI_ARRAY_LENGTH (DefaultSpaceIdList); i++) + for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++) { /* Install handler at the root object */ Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT, - DefaultSpaceIdList[i], AeRegionHandler, + SpaceIdList[i], AeRegionHandler, AeRegionInit, &AeMyContext); + if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Could not install a default OpRegion handler for %s space(%u)", - AcpiUtGetRegionName ((UINT8) DefaultSpaceIdList[i]), - DefaultSpaceIdList[i])); + "Could not install an OpRegion handler for %s space(%u)", + AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i])); return; } } diff --git a/source/tools/acpiexec/aetables.c b/source/tools/acpiexec/aetables.c index 7e81fc3cefd0a..a5129b896cdb3 100644 --- a/source/tools/acpiexec/aetables.c +++ b/source/tools/acpiexec/aetables.c @@ -229,9 +229,6 @@ AeBuildLocalTables ( /* * Install the user tables. The DSDT must be installed in the FADT. * All other tables are installed directly into the XSDT. - * - * Note: The tables are loaded in reverse order from the incoming - * input, which makes it match the command line order. */ NextTable = ListHead; while (NextTable) @@ -262,7 +259,7 @@ AeBuildLocalTables ( { /* Install the table in the XSDT */ - LocalXSDT->TableOffsetEntry[TableCount - NextIndex + 1] = + LocalXSDT->TableOffsetEntry[NextIndex] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); NextIndex++; } @@ -493,27 +490,6 @@ AeInstallTables ( Status = AcpiInitializeTables (NULL, ACPI_MAX_INIT_TABLES, TRUE); ACPI_CHECK_OK (AcpiInitializeTables, Status); - Status = AcpiLoadTables (); - ACPI_CHECK_OK (AcpiLoadTables, Status); - - /* - * Test run-time control method installation. Do it twice to test code - * for an existing name. - */ - Status = AcpiInstallMethod (MethodCode); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("%s, Could not install method\n", - AcpiFormatException (Status)); - } - - Status = AcpiInstallMethod (MethodCode); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("%s, Could not install method\n", - AcpiFormatException (Status)); - } - if (AcpiGbl_LoadTestTables) { /* Test multiple table/UEFI support. First, get the headers */ @@ -558,6 +534,50 @@ AeInstallTables ( /****************************************************************************** * + * FUNCTION: AeLoadTables + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Load the definition block ACPI tables + * + *****************************************************************************/ + +ACPI_STATUS +AeLoadTables ( + void) +{ + ACPI_STATUS Status; + + + Status = AcpiLoadTables (); + ACPI_CHECK_OK (AcpiLoadTables, Status); + + /* + * Test run-time control method installation. Do it twice to test code + * for an existing name. + */ + Status = AcpiInstallMethod (MethodCode); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("%s, Could not install method\n", + AcpiFormatException (Status)); + } + + Status = AcpiInstallMethod (MethodCode); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("%s, Could not install method\n", + AcpiFormatException (Status)); + } + + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: AcpiOsGetRootPointer * * PARAMETERS: Flags - not used |