[kernel] Make serial driver interrupt based

Move the in-kernel serial driver code to be completely interrupt based.
The next step will be to move this to a userspace driver.
This commit is contained in:
Justin C. Miller
2021-07-17 23:54:23 -07:00
parent 972a35bdef
commit 12e893e11f
4 changed files with 159 additions and 32 deletions

View File

@@ -12,6 +12,7 @@
#include "kernel_memory.h"
#include "log.h"
#include "objects/endpoint.h"
#include "serial.h"
static endpoint * const ignore_endpoint = reinterpret_cast<endpoint*>(-1ull);
@@ -50,17 +51,6 @@ acpi_table_header::validate(uint32_t expected_type) const
return !expected_type || (expected_type == type);
}
void irq2_callback(void *)
{
}
void irq4_callback(void *)
{
// TODO: move this to a real serial driver
console *cons = console::get();
cons->echo();
}
device_manager::device_manager() :
m_lapic_base(0)
@@ -269,6 +259,9 @@ device_manager::load_apic(const acpi_table_header *header)
p += length;
}
m_ioapics[0].mask(3, false);
m_ioapics[0].mask(4, false);
}
void
@@ -384,6 +377,11 @@ device_manager::init_drivers()
bool
device_manager::dispatch_irq(unsigned irq)
{
if (irq == 4) {
g_com1.handle_interrupt();
return true;
}
if (irq >= m_irqs.count())
return false;