ACPI_STATUS ACPI_INIT_FUNCTION AcpiLoadTables ( void) { ACPI_STATUS Status; ACPI_FUNCTION_TRACE (AcpiLoadTables); /* * 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). * Note that we allow OSPMs to install their own region handlers * between AcpiInitializeSubsystem() and AcpiLoadTables() to use * their customized default region handlers. */ Status = AcpiEvInstallRegionHandlers (); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During Region initialization")); return_ACPI_STATUS (Status); } /* Load the namespace from the tables */ Status = AcpiTbLoadNamespace (); /* Don't let single failures abort the load */ if (Status == AE_CTRL_TERMINATE) { Status = AE_OK; } if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "While loading namespace from ACPI tables")); } if (AcpiGbl_ExecuteTablesAsMethods || !AcpiGbl_GroupModuleLevelCode) { /* * If the module-level code support is enabled, initialize the objects * in the namespace that remain uninitialized. This runs the executable * AML that may be part of the declaration of these name objects: * OperationRegions, BufferFields, Buffers, and Packages. * * Note: The module-level code is optional at this time, but will * become the default in the future. */ Status = AcpiNsInitializeObjects (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } AcpiGbl_NamespaceInitialized = TRUE; return_ACPI_STATUS (Status); }
ACPI_STATUS AcpiInitializeObjects ( UINT32 Flags) { ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE (AcpiInitializeObjects); /* * Run all _REG methods * * Note: Any objects accessed by the _REG methods will be automatically * initialized, even if they contain executable AML (see the call to * AcpiNsInitializeObjects below). */ if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Executing _REG OpRegion methods\n")); Status = AcpiEvInitializeOpRegions (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } #ifdef ACPI_EXEC_APP /* * This call implements the "initialization file" option for AcpiExec. * This is the precise point that we want to perform the overrides. */ AeDoObjectOverrides (); #endif /* * Execute any module-level code that was detected during the table load * phase. Although illegal since ACPI 2.0, there are many machines that * contain this type of code. Each block of detected executable AML code * outside of any control method is wrapped with a temporary control * method object and placed on a global list. The methods on this list * are executed below. * * This case executes the module-level code for all tables only after * all of the tables have been loaded. It is a legacy option and is * not compatible with other ACPI implementations. See AcpiNsLoadTable. */ if (AcpiGbl_GroupModuleLevelCode) { AcpiNsExecModuleCodeList (); } /* * Initialize the objects that remain uninitialized. This runs the * executable AML that may be part of the declaration of these objects: * OperationRegions, BufferFields, Buffers, and Packages. */ if (!(Flags & ACPI_NO_OBJECT_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Completing Initialization of ACPI Objects\n")); Status = AcpiNsInitializeObjects (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } /* * Initialize all device objects in the namespace. This runs the device * _STA and _INI methods. */ if (!(Flags & ACPI_NO_DEVICE_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Devices\n")); Status = AcpiNsInitializeDevices (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } /* * Empty the caches (delete the cached objects) on the assumption that * the table load filled them up more than they will be at runtime -- * thus wasting non-paged memory. */ Status = AcpiPurgeCachedObjects (); AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK; return_ACPI_STATUS (Status); }
ACPI_STATUS AcpiInitializeObjects ( UINT32 Flags) { ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE (AcpiInitializeObjects); /* * Run all _REG methods * * Note: Any objects accessed by the _REG methods will be automatically * initialized, even if they contain executable AML (see the call to * AcpiNsInitializeObjects below). */ if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Executing _REG OpRegion methods\n")); Status = AcpiEvInitializeOpRegions (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } /* * Initialize the objects that remain uninitialized. This runs the * executable AML that may be part of the declaration of these objects: * OperationRegions, BufferFields, Buffers, and Packages. */ if (!(Flags & ACPI_NO_OBJECT_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Completing Initialization of ACPI Objects\n")); Status = AcpiNsInitializeObjects (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } /* * Initialize all device objects in the namespace. This runs the device * _STA and _INI methods. */ if (!(Flags & ACPI_NO_DEVICE_INIT)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Devices\n")); Status = AcpiNsInitializeDevices (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } /* * Empty the caches (delete the cached objects) on the assumption that * the table load filled them up more than they will be at runtime -- * thus wasting non-paged memory. */ Status = AcpiPurgeCachedObjects (); AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK; return_ACPI_STATUS (Status); }