Decouple HPET init from ACPI

This commit is contained in:
Baptiste Wicht 2016-08-06 12:22:39 +02:00
parent 450e45bf31
commit e99326db0e
4 changed files with 10 additions and 7 deletions

View File

@ -13,6 +13,8 @@ namespace hpet {
bool install();
void late_install();
void init();
} //end of namespace hpet
#endif

View File

@ -16,8 +16,6 @@
#include "arch.hpp"
#include "assert.hpp"
#include "drivers/hpet.hpp"
namespace {
// This is copied from acexcep.h
@ -106,11 +104,6 @@ void initialize_acpica(){
acpi_initialized = true;
logging::logf(logging::log_level::DEBUG, "acpi:: Finished initialization of ACPICA\n");
// Here we initialize the drivers that need ACPI
// TODO This is not good coupling: Find a better solution
hpet::late_install();
}
uint64_t acpi_read(const ACPI_GENERIC_ADDRESS& address){

View File

@ -11,6 +11,7 @@
#include "logging.hpp"
#include "mmap.hpp"
#include "arch.hpp"
#include "scheduler.hpp" // For async init
namespace {
@ -43,6 +44,11 @@ void clear_register_bits(size_t reg, uint64_t bits){
} //End of anonymous namespace
void hpet::init(){
// HPET needs ACPI
scheduler::queue_async_init_task(hpet::late_install);
}
bool hpet::install(){
// Find the HPET table
auto status = AcpiGetTable(ACPI_SIG_HPET, 0, reinterpret_cast<ACPI_TABLE_HEADER **>(&hpet_table));

View File

@ -28,6 +28,7 @@
#include "network.hpp"
#include "vfs/vfs.hpp"
#include "fs/sysfs.hpp"
#include "drivers/hpet.hpp"
extern "C" {
@ -100,6 +101,7 @@ void kernel_main(){
// Asynchronously initialized drivers
acpi::init();
hpet::init();
//Install drivers
timer::install();