[kernel] Fix clock period vs frequency error

Calling `spinwait()` was hanging due to improper computation of the
clock rate because justin did a dumb at math. Also the period can be
greater than 1ns, so the clock's units were updated to microseconds.
This commit is contained in:
2020-07-12 17:43:37 -07:00
parent 794c86f9b4
commit f4cbb9498f
7 changed files with 41 additions and 23 deletions

View File

@@ -47,7 +47,6 @@ acpi_table_header::validate(uint32_t expected_type) const
return !expected_type || (expected_type == type);
}
void irq2_callback(void *)
{
}
@@ -344,6 +343,7 @@ device_manager::init_drivers()
log::info(logs::clock, "Created master clock using HPET 0: Rate %d", h.rate());
} else {
//TODO: APIC clock?
kassert(0, "No HPET master clock");
}
}
@@ -360,6 +360,20 @@ device_manager::install_irq(unsigned irq, const char *name, irq_callback cb, voi
return true;
}
bool
device_manager::uninstall_irq(unsigned irq, irq_callback cb, void *data)
{
if (irq >= m_irqs.count())
return false;
const irq_allocation &existing = m_irqs[irq];
if (existing.callback != cb || existing.data != data)
return false;
m_irqs[irq] = {nullptr, nullptr, nullptr};
return true;
}
bool
device_manager::allocate_msi(const char *name, pci_device &device, irq_callback cb, void *data)
{