/******************************************************************************* * * FUNCTION: acpi_enable_subsystem * * PARAMETERS: Flags - Init/enable Options * * RETURN: Status * * DESCRIPTION: Completes the subsystem initialization including hardware. * Puts system into ACPI mode if it isn't already. * ******************************************************************************/ acpi_status acpi_enable_subsystem(u32 flags) { acpi_status status = AE_OK; ACPI_FUNCTION_TRACE(acpi_enable_subsystem); /* Enable ACPI mode */ if (!(flags & ACPI_NO_ACPI_ENABLE)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); acpi_gbl_original_mode = acpi_hw_get_mode(); status = acpi_enable(); 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 = acpi_tb_initialize_facs(); if (ACPI_FAILURE(status)) { ACPI_WARNING((AE_INFO, "Could not map the FACS table")); return_ACPI_STATUS(status); } /* * Install the default op_region handlers. These are installed unless * other handlers have already been installed via the * install_address_space_handler interface. */ if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n")); status = acpi_ev_install_region_handlers(); 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 global_lock activated) */ if (!(flags & ACPI_NO_EVENT_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Initializing ACPI events\n")); status = acpi_ev_initialize_events(); 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 = acpi_ev_install_xrupt_handlers(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } } return_ACPI_STATUS(status); }
/******************************************************************************* * * FUNCTION: acpi_enable_subsystem * * PARAMETERS: flags - Init/enable Options * * RETURN: Status * * DESCRIPTION: Completes the subsystem initialization including hardware. * Puts system into ACPI mode if it isn't already. * ******************************************************************************/ acpi_status ACPI_INIT_FUNCTION acpi_enable_subsystem(u32 flags) { acpi_status status = AE_OK; ACPI_FUNCTION_TRACE(acpi_enable_subsystem); /* * 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. */ acpi_gbl_early_initialization = FALSE; #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")); acpi_gbl_original_mode = acpi_hw_get_mode(); status = acpi_enable(); 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 = acpi_tb_initialize_facs(); 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 global_lock 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 = acpi_ev_initialize_events(); 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 = acpi_ev_install_xrupt_handlers(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } } #endif /* !ACPI_REDUCED_HARDWARE */ return_ACPI_STATUS(status); }
acpi_status acpi_enable_subsystem(u32 flags) { acpi_status status = AE_OK; ACPI_FUNCTION_TRACE("acpi_enable_subsystem"); /* * We must initialize the hardware before we can enable ACPI. * The values from the FADT are validated here. */ if (!(flags & ACPI_NO_HARDWARE_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Initializing ACPI hardware\n")); status = acpi_hw_initialize(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } } /* Enable ACPI mode */ if (!(flags & ACPI_NO_ACPI_ENABLE)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); acpi_gbl_original_mode = acpi_hw_get_mode(); status = acpi_enable(); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "acpi_enable failed.\n")); return_ACPI_STATUS(status); } } /* * Install the default op_region handlers. These are installed unless * other handlers have already been installed via the * install_address_space_handler interface. */ if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n")); status = acpi_ev_install_region_handlers(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } } /* * Initialize ACPI Event handling (Fixed and General Purpose) * * NOTE: 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 initialized before * execution! */ if (!(flags & ACPI_NO_EVENT_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Initializing ACPI events\n")); status = acpi_ev_initialize_events(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } } /* Install the SCI handler and Global Lock handler */ if (!(flags & ACPI_NO_HANDLER_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Installing SCI/GL handlers\n")); status = acpi_ev_install_xrupt_handlers(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } } return_ACPI_STATUS(status); }
/**ltl * 功能:使能ACPI子系统 * 参数: * 返回值: * 说明: */ acpi_status acpi_enable_subsystem(u32 flags) { acpi_status status = AE_OK; ACPI_FUNCTION_TRACE(acpi_enable_subsystem); /* * We must initialize the hardware before we can enable ACPI. * The values from the FADT are validated here. */ if (!(flags & ACPI_NO_HARDWARE_INIT)) { /* 初始化ACPI硬件模块 */ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Initializing ACPI hardware\n")); status = acpi_hw_initialize(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } } /* Enable ACPI mode */ if (!(flags & ACPI_NO_ACPI_ENABLE)) { /* 使能ACPI硬件模块 */ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); /* 返回值模式 */ acpi_gbl_original_mode = acpi_hw_get_mode(); /* 设置ACPI模式 */ status = acpi_enable(); if (ACPI_FAILURE(status)) { ACPI_WARNING((AE_INFO, "AcpiEnable failed")); return_ACPI_STATUS(status); } } /* * Install the default op_region handlers. These are installed unless * other handlers have already been installed via the * install_address_space_handler interface. */ if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n")); /* 为四个地址空间设置默认处理句柄 */ status = acpi_ev_install_region_handlers(); 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 global_lock activated) */ if (!(flags & ACPI_NO_EVENT_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Initializing ACPI events\n")); /* 初始化ACPI事件(设置相关寄存器) */ status = acpi_ev_initialize_events(); 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")); /* 为ACPI模块安装中断处理函数 */ status = acpi_ev_install_xrupt_handlers(); 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 = acpi_ev_install_fadt_gpes(); /* 使能通用寄存器 */ if (ACPI_FAILURE(status)) { return (status); } } return_ACPI_STATUS(status); }