1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:27:34 +00:00

Kernel: Fix issues supporting HPETs with 32-bit-only main counter

If the HPET main counter does not support full 64 bits, we should
not expect the upper 32 bit to work. This is a problem when writing
to the upper 32 bit of the comparator value, which requires the
TimerConfiguration::ValueSet bit to be set, but if it's not 64 bit
capable then the bit will not be cleared and leave it in a bad state.

Fixes #6990
This commit is contained in:
Tom 2021-05-11 21:20:06 -06:00 committed by Andreas Kling
parent a6a57830d0
commit 3f9927b0c3
4 changed files with 51 additions and 18 deletions

View file

@ -56,6 +56,7 @@ private:
void global_enable();
bool is_periodic_capable(u8 comparator_number) const;
bool is_64bit_capable(u8 comparator_number) const;
void set_comparators_to_optimal_interrupt_state(size_t timers_count);
u64 nanoseconds_to_raw_ticks() const;
@ -68,12 +69,13 @@ private:
u64 m_main_counter_last_read { 0 };
u64 m_main_counter_drift { 0 };
u32 m_32bit_main_counter_wraps { 0 };
u16 m_vendor_id;
u16 m_minimum_tick;
u64 m_frequency;
u8 m_revision_id;
bool counter_is_64_bit_capable : 1;
bool m_main_counter_64bits : 1;
bool legacy_replacement_route_capable : 1;
NonnullRefPtrVector<HPETComparator> m_comparators;