mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-12 14:10:36 -04:00
Initialize ACPICA in an asynchronous thread
This commit is contained in:
parent
3beff6ac02
commit
fe40319cdc
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
namespace acpi {
|
namespace acpi {
|
||||||
|
|
||||||
bool init();
|
void init();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
bool initialized();
|
bool initialized();
|
||||||
|
@ -12,10 +12,11 @@
|
|||||||
#include "paging.hpp"
|
#include "paging.hpp"
|
||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
#include "logging.hpp"
|
#include "logging.hpp"
|
||||||
|
#include "scheduler.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool acpi_initialized = false;
|
volatile bool acpi_initialized = false;
|
||||||
|
|
||||||
uint32_t SMI_CMD; //ptr
|
uint32_t SMI_CMD; //ptr
|
||||||
uint8_t ACPI_ENABLE;
|
uint8_t ACPI_ENABLE;
|
||||||
@ -272,32 +273,22 @@ int init_acpi(){
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool initialize_acpica(){
|
void initialize_acpica(){
|
||||||
auto status = AcpiInitializeSubsystem();
|
auto status = AcpiInitializeSubsystem();
|
||||||
if(ACPI_FAILURE(status)){
|
if(ACPI_FAILURE(status)){
|
||||||
logging::logf(logging::log_level::ERROR, "Impossible to initialize ACPICA subsystem\n");
|
logging::logf(logging::log_level::ERROR, "Impossible to initialize ACPICA subsystem\n");
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO COntinue
|
//TODO COntinue
|
||||||
|
|
||||||
|
|
||||||
acpi_initialized = true;
|
acpi_initialized = true;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //end of anonymous namespace
|
} //end of anonymous namespace
|
||||||
|
|
||||||
bool acpi::init(){
|
void acpi::init(){
|
||||||
if(!initialize_acpica()){
|
// ACPICA needs scheduling to be started
|
||||||
logging::logf(logging::log_level::ERROR, "Impossible to initialize ACPICA\n");
|
scheduler::queue_async_init_task(initialize_acpica);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Nothing else to init for now
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void acpi::shutdown(){
|
void acpi::shutdown(){
|
||||||
|
@ -87,10 +87,12 @@ void kernel_main(){
|
|||||||
virtual_allocator::finalize();
|
virtual_allocator::finalize();
|
||||||
kalloc::finalize();
|
kalloc::finalize();
|
||||||
|
|
||||||
|
// Asynchronously initialized drivers
|
||||||
|
acpi::init();
|
||||||
|
|
||||||
//Install drivers
|
//Install drivers
|
||||||
serial::init();
|
serial::init();
|
||||||
timer::install();
|
timer::install();
|
||||||
//acpi::init();
|
|
||||||
keyboard::install_driver();
|
keyboard::install_driver();
|
||||||
disks::detect_disks();
|
disks::detect_disks();
|
||||||
pci::detect_devices();
|
pci::detect_devices();
|
||||||
@ -118,7 +120,7 @@ void kernel_main(){
|
|||||||
scheduler::start();
|
scheduler::start();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} //end of extern "C"
|
||||||
|
|
||||||
void suspend_boot(){
|
void suspend_boot(){
|
||||||
k_print_line("Impossible to continue boot...");
|
k_print_line("Impossible to continue boot...");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user