Kernel: Enter ACPI mode with lai
This commit is contained in:
parent
1abf787596
commit
d45bf363f1
|
@ -16,6 +16,11 @@ public:
|
||||||
|
|
||||||
static void initialize(bool force_pic);
|
static void initialize(bool force_pic);
|
||||||
static InterruptController& get();
|
static InterruptController& get();
|
||||||
|
|
||||||
|
void enter_acpi_mode();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_using_apic { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
bool interrupts_enabled();
|
bool interrupts_enabled();
|
|
@ -94,7 +94,7 @@ namespace Kernel
|
||||||
void validate_stack() const;
|
void validate_stack() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr size_t m_kernel_stack_size = PAGE_SIZE * 1;
|
static constexpr size_t m_kernel_stack_size = PAGE_SIZE * 4;
|
||||||
static constexpr size_t m_userspace_stack_size = PAGE_SIZE * 2;
|
static constexpr size_t m_userspace_stack_size = PAGE_SIZE * 2;
|
||||||
static constexpr size_t m_interrupt_stack_size = PAGE_SIZE * 2;
|
static constexpr size_t m_interrupt_stack_size = PAGE_SIZE * 2;
|
||||||
BAN::UniqPtr<VirtualRange> m_interrupt_stack;
|
BAN::UniqPtr<VirtualRange> m_interrupt_stack;
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include <kernel/APIC.h>
|
#include <kernel/APIC.h>
|
||||||
#include <kernel/PIC.h>
|
#include <kernel/PIC.h>
|
||||||
|
|
||||||
|
#include <lai/helpers/sci.h>
|
||||||
|
|
||||||
static InterruptController* s_instance = nullptr;
|
static InterruptController* s_instance = nullptr;
|
||||||
|
|
||||||
InterruptController& InterruptController::get()
|
InterruptController& InterruptController::get()
|
||||||
|
@ -19,11 +21,26 @@ void InterruptController::initialize(bool force_pic)
|
||||||
PIC::remap();
|
PIC::remap();
|
||||||
|
|
||||||
if (!force_pic)
|
if (!force_pic)
|
||||||
|
{
|
||||||
s_instance = APIC::create();
|
s_instance = APIC::create();
|
||||||
if (s_instance)
|
if (s_instance)
|
||||||
return;
|
{
|
||||||
|
s_instance->m_using_apic = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dprintln("Using PIC instead of APIC");
|
dprintln("Using PIC instead of APIC");
|
||||||
s_instance = PIC::create();
|
s_instance = PIC::create();
|
||||||
|
ASSERT(s_instance);
|
||||||
|
|
||||||
|
s_instance->m_using_apic = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InterruptController::enter_acpi_mode()
|
||||||
|
{
|
||||||
|
if (lai_enable_acpi(m_using_apic ? 1 : 0) != 0)
|
||||||
|
dwarnln("could not enter acpi mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool interrupts_enabled()
|
bool interrupts_enabled()
|
||||||
|
|
|
@ -161,6 +161,8 @@ static void init2(void*)
|
||||||
|
|
||||||
dprintln("Scheduler started");
|
dprintln("Scheduler started");
|
||||||
|
|
||||||
|
InterruptController::get().enter_acpi_mode();
|
||||||
|
|
||||||
auto console = MUST(DevFileSystem::get().root_inode()->find_inode(cmdline.console));
|
auto console = MUST(DevFileSystem::get().root_inode()->find_inode(cmdline.console));
|
||||||
ASSERT(console->is_tty());
|
ASSERT(console->is_tty());
|
||||||
((TTY*)console.ptr())->set_as_current();
|
((TTY*)console.ptr())->set_as_current();
|
||||||
|
|
Loading…
Reference in New Issue