hw/x86: re-init devices on resume

Issue #4669
This commit is contained in:
Alexander Boettcher 2023-01-23 14:56:45 +01:00 committed by Christian Helmuth
parent 1ea6708d84
commit 30c6feb86e
5 changed files with 20 additions and 1 deletions

View File

@ -22,6 +22,10 @@ void Kernel::Cpu::_arch_init()
Idt::init();
Tss::init();
_pic.init();
_timer.init();
_ipi_irq.init();
/* enable timer interrupt */
_pic.store_apic_id(id());
_pic.unmask(_timer.interrupt_id(), id());

View File

@ -42,6 +42,11 @@ Local_interrupt_controller(Global_interrupt_controller &global_irq_ctrl)
:
Mmio { Platform::mmio_to_virt(Hw::Cpu_memory_map::lapic_phys_base()) },
_global_irq_ctrl { global_irq_ctrl }
{
init();
}
void Local_interrupt_controller::init()
{
/* Start initialization sequence in cascade mode */
outb(PIC_CMD_MASTER, 0x11);

View File

@ -230,6 +230,8 @@ class Board::Local_interrupt_controller : public Genode::Mmio
}
void send_ipi(unsigned const);
void init();
};
#endif /* _CORE__SPEC__X86_64__PIC_H_ */

View File

@ -69,6 +69,12 @@ void Board::Timer::init()
write<Tmr_lvt::Mask>(0);
write<Tmr_lvt::Timer_mode>(0);
/* use very same divider after ACPI resume as used during initial boot */
if (divider) {
write<Divide_configuration::Divide_value>((uint8_t)divider);
return;
}
/* calibrate LAPIC frequency to fullfill our requirements */
for (Divide_configuration::access_t div = Divide_configuration::Divide_value::MAX;
div && ticks_per_ms < TIMER_MIN_TICKS_PER_MS; div--)
@ -81,6 +87,7 @@ void Board::Timer::init()
/* Calculate timer frequency */
ticks_per_ms = pit_calc_timer_freq();
divider = div;
}
/**

View File

@ -66,7 +66,8 @@ struct Board::Timer: Genode::Mmio
struct Calibration_failed : Genode::Exception { };
Genode::uint32_t ticks_per_ms = 0;
Divide_configuration::access_t divider = 0;
Genode::uint32_t ticks_per_ms = 0;
/* Measure LAPIC timer frequency using PIT channel 2 */
Genode::uint32_t pit_calc_timer_freq(void);