ACPI_STATUS AcpiEnableSubsystem ( UINT32 Flags) { ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE (AcpiEnableSubsystem); #if (!ACPI_REDUCED_HARDWARE) /* Enable ACPI mode */ if (!(Flags & ACPI_NO_ACPI_ENABLE)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); AcpiGbl_OriginalMode = AcpiHwGetMode(); Status = AcpiEnable (); if (ACPI_FAILURE (Status)) { ACPI_WARNING ((AE_INFO, "AcpiEnable failed")); return_ACPI_STATUS (Status); } } /* * Obtain a permanent mapping for the FACS. This is required for the * Global Lock and the Firmware Waking Vector */ Status = AcpiTbInitializeFacs (); if (ACPI_FAILURE (Status)) { ACPI_WARNING ((AE_INFO, "Could not map the FACS table")); return_ACPI_STATUS (Status); } #endif /* !ACPI_REDUCED_HARDWARE */ /* * Install the default OpRegion handlers. These are installed unless * other handlers have already been installed via the * InstallAddressSpaceHandler interface. */ if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n")); Status = AcpiEvInstallRegionHandlers (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } #if (!ACPI_REDUCED_HARDWARE) /* * Initialize ACPI Event handling (Fixed and General Purpose) * * Note1: We must have the hardware and events initialized before we can * execute any control methods safely. Any control method can require * ACPI hardware support, so the hardware must be fully initialized before * any method execution! * * Note2: Fixed events are initialized and enabled here. GPEs are * initialized, but cannot be enabled until after the hardware is * completely initialized (SCI and GlobalLock activated) and the various * initialization control methods are run (_REG, _STA, _INI) on the * entire namespace. */ if (!(Flags & ACPI_NO_EVENT_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI events\n")); Status = AcpiEvInitializeEvents (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } /* * Install the SCI handler and Global Lock handler. This completes the * hardware initialization. */ if (!(Flags & ACPI_NO_HANDLER_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing SCI/GL handlers\n")); Status = AcpiEvInstallXruptHandlers (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } #endif /* !ACPI_REDUCED_HARDWARE */ return_ACPI_STATUS (Status); }
ACPI_STATUS AcpiDbCommandDispatch ( char *InputBuffer, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op) { UINT32 Temp; UINT32 CommandIndex; UINT32 ParamCount; char *CommandLine; ACPI_STATUS Status = AE_CTRL_TRUE; /* If AcpiTerminate has been called, terminate this thread */ if (AcpiGbl_DbTerminateLoop) { return (AE_CTRL_TERMINATE); } /* Find command and add to the history buffer */ ParamCount = AcpiDbGetLine (InputBuffer); CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]); Temp = 0; /* * We don't want to add the !! command to the history buffer. It * would cause an infinite loop because it would always be the * previous command. */ if (CommandIndex != CMD_HISTORY_LAST) { AcpiDbAddToHistory (InputBuffer); } /* Verify that we have the minimum number of params */ if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs) { AcpiOsPrintf ("%u parameters entered, [%s] requires %u parameters\n", ParamCount, AcpiGbl_DbCommands[CommandIndex].Name, AcpiGbl_DbCommands[CommandIndex].MinArgs); AcpiDbDisplayCommandInfo ( AcpiGbl_DbCommands[CommandIndex].Name, FALSE); return (AE_CTRL_TRUE); } /* Decode and dispatch the command */ switch (CommandIndex) { case CMD_NULL: if (Op) { return (AE_OK); } break; case CMD_ALLOCATIONS: #ifdef ACPI_DBG_TRACK_ALLOCATIONS AcpiUtDumpAllocations ((UINT32) -1, NULL); #endif break; case CMD_ARGS: case CMD_ARGUMENTS: AcpiDbDisplayArguments (); break; case CMD_BREAKPOINT: AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op); break; case CMD_BUSINFO: AcpiDbGetBusInfo (); break; case CMD_CALL: AcpiDbSetMethodCallBreakpoint (Op); Status = AE_OK; break; case CMD_DEBUG: AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_SINGLE_STEP); break; case CMD_DISASSEMBLE: case CMD_DISASM: (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]); break; case CMD_DUMP: AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; case CMD_EVALUATE: case CMD_EXECUTE: AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP); break; case CMD_FIND: Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]); break; case CMD_GO: AcpiGbl_CmSingleStep = FALSE; return (AE_OK); case CMD_HANDLERS: AcpiDbDisplayHandlers (); break; case CMD_HELP: case CMD_HELP2: AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]); break; case CMD_HISTORY: AcpiDbDisplayHistory (); break; case CMD_HISTORY_EXE: /* ! command */ CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]); if (!CommandLine) { return (AE_CTRL_TRUE); } Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); return (Status); case CMD_HISTORY_LAST: /* !! command */ CommandLine = AcpiDbGetFromHistory (NULL); if (!CommandLine) { return (AE_CTRL_TRUE); } Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); return (Status); case CMD_INFORMATION: AcpiDbDisplayMethodInfo (Op); break; case CMD_INTEGRITY: AcpiDbCheckIntegrity (); break; case CMD_INTO: if (Op) { AcpiGbl_CmSingleStep = TRUE; return (AE_OK); } break; case CMD_LEVEL: if (ParamCount == 0) { AcpiOsPrintf ( "Current debug level for file output is: %8.8lX\n", AcpiGbl_DbDebugLevel); AcpiOsPrintf ( "Current debug level for console output is: %8.8lX\n", AcpiGbl_DbConsoleDebugLevel); } else if (ParamCount == 2) { Temp = AcpiGbl_DbConsoleDebugLevel; AcpiGbl_DbConsoleDebugLevel = strtoul (AcpiGbl_DbArgs[1], NULL, 16); AcpiOsPrintf ( "Debug Level for console output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbConsoleDebugLevel); } else { Temp = AcpiGbl_DbDebugLevel; AcpiGbl_DbDebugLevel = strtoul (AcpiGbl_DbArgs[1], NULL, 16); AcpiOsPrintf ( "Debug Level for file output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbDebugLevel); } break; case CMD_LIST: AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op); break; case CMD_LOCKS: AcpiDbDisplayLocks (); break; case CMD_LOCALS: AcpiDbDisplayLocals (); break; case CMD_METHODS: Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]); break; case CMD_NAMESPACE: AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; case CMD_NOTIFY: Temp = strtoul (AcpiGbl_DbArgs[2], NULL, 0); AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp); break; case CMD_OBJECTS: AcpiUtStrupr (AcpiGbl_DbArgs[1]); Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; case CMD_OSI: AcpiDbDisplayInterfaces (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; case CMD_OWNER: AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; case CMD_PATHS: AcpiDbDumpNamespacePaths (); break; case CMD_PREFIX: AcpiDbSetScope (AcpiGbl_DbArgs[1]); break; case CMD_REFERENCES: AcpiDbFindReferences (AcpiGbl_DbArgs[1]); break; case CMD_RESOURCES: AcpiDbDisplayResources (AcpiGbl_DbArgs[1]); break; case CMD_RESULTS: AcpiDbDisplayResults (); break; case CMD_SET: AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); break; case CMD_STATS: Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]); break; case CMD_STOP: return (AE_NOT_IMPLEMENTED); case CMD_TABLES: AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]); break; case CMD_TEMPLATE: AcpiDbDisplayTemplate (AcpiGbl_DbArgs[1]); break; case CMD_TRACE: AcpiDbTrace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); break; case CMD_TREE: AcpiDbDisplayCallingTree (); break; case CMD_TYPE: AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]); break; #ifdef ACPI_APPLICATION /* Hardware simulation commands. */ case CMD_ENABLEACPI: #if (!ACPI_REDUCED_HARDWARE) Status = AcpiEnable(); if (ACPI_FAILURE(Status)) { AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status); return (Status); } #endif /* !ACPI_REDUCED_HARDWARE */ break; case CMD_EVENT: AcpiOsPrintf ("Event command not implemented\n"); break; case CMD_GPE: AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; case CMD_GPES: AcpiDbDisplayGpes (); break; case CMD_SCI: AcpiDbGenerateSci (); break; case CMD_SLEEP: Status = AcpiDbSleep (AcpiGbl_DbArgs[1]); break; /* File I/O commands. */ case CMD_CLOSE: AcpiDbCloseDebugFile (); break; case CMD_LOAD: { ACPI_NEW_TABLE_DESC *ListHead = NULL; Status = AcGetAllTablesFromFile (AcpiGbl_DbArgs[1], ACPI_GET_ALL_TABLES, &ListHead); if (ACPI_SUCCESS (Status)) { AcpiDbLoadTables (ListHead); } } break; case CMD_OPEN: AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]); break; /* User space commands. */ case CMD_TERMINATE: AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); AcpiUtSubsystemShutdown (); /* * TBD: [Restructure] Need some way to re-initialize without * re-creating the semaphores! */ AcpiGbl_DbTerminateLoop = TRUE; /* AcpiInitialize (NULL); */ break; case CMD_BACKGROUND: AcpiDbCreateExecutionThread (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2]); break; case CMD_THREADS: AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); break; /* Debug test commands. */ case CMD_PREDEFINED: AcpiDbCheckPredefinedNames (); break; case CMD_TEST: AcpiDbExecuteTest (AcpiGbl_DbArgs[1]); break; case CMD_UNLOAD: AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1]); break; #endif case CMD_EXIT: case CMD_QUIT: if (Op) { AcpiOsPrintf ("Method execution terminated\n"); return (AE_CTRL_TERMINATE); } if (!AcpiGbl_DbOutputToFile) { AcpiDbgLevel = ACPI_DEBUG_DEFAULT; } #ifdef ACPI_APPLICATION AcpiDbCloseDebugFile (); #endif AcpiGbl_DbTerminateLoop = TRUE; return (AE_CTRL_TERMINATE); case CMD_NOT_FOUND: default: AcpiOsPrintf ("%s: unknown command\n", AcpiGbl_DbArgs[0]); return (AE_CTRL_TRUE); } if (ACPI_SUCCESS (Status)) { Status = AE_CTRL_TRUE; } return (Status); }
ACPI_STATUS AcpiDbCommandDispatch ( char *InputBuffer, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op) { UINT32 Temp; UINT32 CommandIndex; UINT32 ParamCount; char *CommandLine; ACPI_STATUS Status = AE_CTRL_TRUE; /* If AcpiTerminate has been called, terminate this thread */ if (AcpiGbl_DbTerminateThreads) { return (AE_CTRL_TERMINATE); } ParamCount = AcpiDbGetLine (InputBuffer); CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]); Temp = 0; /* Verify that we have the minimum number of params */ if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs) { AcpiOsPrintf ("%d parameters entered, [%s] requires %d parameters\n", ParamCount, AcpiGbl_DbCommands[CommandIndex].Name, AcpiGbl_DbCommands[CommandIndex].MinArgs); return (AE_CTRL_TRUE); } /* Decode and dispatch the command */ switch (CommandIndex) { case CMD_NULL: if (Op) { return (AE_OK); } break; case CMD_ALLOCATIONS: #ifdef ACPI_DBG_TRACK_ALLOCATIONS AcpiUtDumpAllocations ((UINT32) -1, NULL); #endif break; case CMD_ARGS: case CMD_ARGUMENTS: AcpiDbDisplayArguments (); break; case CMD_BREAKPOINT: AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op); break; case CMD_CALL: AcpiDbSetMethodCallBreakpoint (Op); Status = AE_OK; break; case CMD_CLOSE: AcpiDbCloseDebugFile (); break; case CMD_DEBUG: AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], EX_SINGLE_STEP); break; case CMD_DUMP: AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; case CMD_ENABLEACPI: Status = AcpiEnable(); if (ACPI_FAILURE(Status)) { AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status); return (Status); } break; case CMD_EVENT: AcpiOsPrintf ("Event command not implemented\n"); break; case CMD_EXECUTE: AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], EX_NO_SINGLE_STEP); break; case CMD_FIND: AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]); break; case CMD_GO: AcpiGbl_CmSingleStep = FALSE; return (AE_OK); case CMD_GPE: AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; case CMD_GPES: AcpiDbDisplayGpes (); break; case CMD_HELP: case CMD_HELP2: AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]); break; case CMD_HISTORY: AcpiDbDisplayHistory (); break; case CMD_HISTORY_EXE: CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]); if (!CommandLine) { return (AE_CTRL_TRUE); } Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); if (ACPI_SUCCESS (Status)) { Status = AE_CTRL_TRUE; } return (Status); case CMD_HISTORY_LAST: CommandLine = AcpiDbGetFromHistory (NULL); if (!CommandLine) { return (AE_CTRL_TRUE); } Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); if (ACPI_SUCCESS (Status)) { Status = AE_CTRL_TRUE; } return (Status); case CMD_INFORMATION: AcpiDbDisplayMethodInfo (Op); break; case CMD_INTEGRITY: AcpiDbCheckIntegrity (); break; case CMD_INTO: if (Op) { AcpiGbl_CmSingleStep = TRUE; return (AE_OK); } break; case CMD_LEVEL: if (ParamCount == 0) { AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n", AcpiGbl_DbDebugLevel); AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n", AcpiGbl_DbConsoleDebugLevel); } else if (ParamCount == 2) { Temp = AcpiGbl_DbConsoleDebugLevel; AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16); AcpiOsPrintf ("Debug Level for console output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbConsoleDebugLevel); } else { Temp = AcpiGbl_DbDebugLevel; AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16); AcpiOsPrintf ("Debug Level for file output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbDebugLevel); } break; case CMD_LIST: AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op); break; case CMD_LOAD: Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL); if (ACPI_FAILURE (Status)) { return (Status); } break; case CMD_LOCKS: AcpiDbDisplayLocks (); break; case CMD_LOCALS: AcpiDbDisplayLocals (); break; case CMD_METHODS: AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]); break; case CMD_NAMESPACE: AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; case CMD_NOTIFY: Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0); AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp); break; case CMD_OBJECT: ACPI_STRUPR (AcpiGbl_DbArgs[1]); AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; case CMD_OPEN: AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]); break; case CMD_OWNER: AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; case CMD_PREFIX: AcpiDbSetScope (AcpiGbl_DbArgs[1]); break; case CMD_REFERENCES: AcpiDbFindReferences (AcpiGbl_DbArgs[1]); break; case CMD_RESOURCES: AcpiDbDisplayResources (AcpiGbl_DbArgs[1]); break; case CMD_RESULTS: AcpiDbDisplayResults (); break; case CMD_SET: AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); break; case CMD_STATS: AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]); break; case CMD_STOP: return (AE_NOT_IMPLEMENTED); case CMD_TABLES: AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]); break; case CMD_TERMINATE: AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); AcpiUtSubsystemShutdown (); /* TBD: [Restructure] Need some way to re-initialize without re-creating the semaphores! */ /* AcpiInitialize (NULL); */ break; case CMD_THREADS: AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); break; case CMD_TREE: AcpiDbDisplayCallingTree (); break; case CMD_UNLOAD: AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; case CMD_EXIT: case CMD_QUIT: if (Op) { AcpiOsPrintf ("Method execution terminated\n"); return (AE_CTRL_TERMINATE); } if (!AcpiGbl_DbOutputToFile) { AcpiDbgLevel = ACPI_DEBUG_DEFAULT; } /* Shutdown */ /* AcpiUtSubsystemShutdown (); */ AcpiDbCloseDebugFile (); AcpiGbl_DbTerminateThreads = TRUE; return (AE_CTRL_TERMINATE); case CMD_NOT_FOUND: default: AcpiOsPrintf ("Unknown Command\n"); return (AE_CTRL_TRUE); } /* Add all commands that come here to the history buffer */ AcpiDbAddToHistory (InputBuffer); return (Status); }
ACPI_STATUS AcpiEnableSubsystem ( UINT32 Flags) { ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE (AcpiEnableSubsystem); /* * The early initialization phase is complete. The namespace is loaded, * and we can now support address spaces other than Memory, I/O, and * PCI_Config. */ AcpiGbl_EarlyInitialization = FALSE; /* * Install the default operation region handlers. These are the * handlers that are defined by the ACPI specification to be * "always accessible" -- namely, SystemMemory, SystemIO, and * PCI_Config. This also means that no _REG methods need to be * run for these address spaces. We need to have these handlers * installed before any AML code can be executed, especially any * module-level code (11/2015). */ if (!AcpiGbl_GroupModuleLevelCode) { Status = AcpiEvInstallRegionHandlers (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During Region initialization")); return_ACPI_STATUS (Status); } } #if (!ACPI_REDUCED_HARDWARE) /* Enable ACPI mode */ if (!(Flags & ACPI_NO_ACPI_ENABLE)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); AcpiGbl_OriginalMode = AcpiHwGetMode(); Status = AcpiEnable (); if (ACPI_FAILURE (Status)) { ACPI_WARNING ((AE_INFO, "AcpiEnable failed")); return_ACPI_STATUS (Status); } } /* * Obtain a permanent mapping for the FACS. This is required for the * Global Lock and the Firmware Waking Vector */ if (!(Flags & ACPI_NO_FACS_INIT)) { Status = AcpiTbInitializeFacs (); if (ACPI_FAILURE (Status)) { ACPI_WARNING ((AE_INFO, "Could not map the FACS table")); return_ACPI_STATUS (Status); } } /* * Initialize ACPI Event handling (Fixed and General Purpose) * * Note1: We must have the hardware and events initialized before we can * execute any control methods safely. Any control method can require * ACPI hardware support, so the hardware must be fully initialized before * any method execution! * * Note2: Fixed events are initialized and enabled here. GPEs are * initialized, but cannot be enabled until after the hardware is * completely initialized (SCI and GlobalLock activated) and the various * initialization control methods are run (_REG, _STA, _INI) on the * entire namespace. */ if (!(Flags & ACPI_NO_EVENT_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI events\n")); Status = AcpiEvInitializeEvents (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } /* * Install the SCI handler and Global Lock handler. This completes the * hardware initialization. */ if (!(Flags & ACPI_NO_HANDLER_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing SCI/GL handlers\n")); Status = AcpiEvInstallXruptHandlers (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } #endif /* !ACPI_REDUCED_HARDWARE */ return_ACPI_STATUS (Status); }
ACPI_STATUS AcpiEnableSubsystem ( UINT32 Flags) { ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE (AcpiEnableSubsystem); /* Enable ACPI mode */ if (!(Flags & ACPI_NO_ACPI_ENABLE)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); AcpiGbl_OriginalMode = AcpiHwGetMode(); Status = AcpiEnable (); if (ACPI_FAILURE (Status)) { ACPI_WARNING ((AE_INFO, "AcpiEnable failed")); return_ACPI_STATUS (Status); } } /* * Install the default OpRegion handlers. These are installed unless * other handlers have already been installed via the * InstallAddressSpaceHandler interface. */ if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n")); Status = AcpiEvInstallRegionHandlers (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } /* * Initialize ACPI Event handling (Fixed and General Purpose) * * Note1: We must have the hardware and events initialized before we can * execute any control methods safely. Any control method can require * ACPI hardware support, so the hardware must be fully initialized before * any method execution! * * Note2: Fixed events are initialized and enabled here. GPEs are * initialized, but cannot be enabled until after the hardware is * completely initialized (SCI and GlobalLock activated) */ if (!(Flags & ACPI_NO_EVENT_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI events\n")); Status = AcpiEvInitializeEvents (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } /* * Install the SCI handler and Global Lock handler. This completes the * hardware initialization. */ if (!(Flags & ACPI_NO_HANDLER_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing SCI/GL handlers\n")); Status = AcpiEvInstallXruptHandlers (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } /* * Complete the GPE initialization for the GPE blocks defined in the FADT * (GPE block 0 and 1). * * Note1: This is where the _PRW methods are executed for the GPEs. These * methods can only be executed after the SCI and Global Lock handlers are * installed and initialized. * * Note2: Currently, there seems to be no need to run the _REG methods * before execution of the _PRW methods and enabling of the GPEs. */ if (!(Flags & ACPI_NO_EVENT_INIT)) { Status = AcpiEvInstallFadtGpes (); if (ACPI_FAILURE (Status)) { return (Status); } } return_ACPI_STATUS (Status); }