1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:47:37 +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

@ -16,13 +16,14 @@ class HPETComparator final : public HardwareTimer<IRQHandler> {
friend class HPET;
public:
static NonnullRefPtr<HPETComparator> create(u8 number, u8 irq, bool periodic_capable);
static NonnullRefPtr<HPETComparator> create(u8 number, u8 irq, bool periodic_capable, bool is_64bit_capable);
virtual HardwareTimerType timer_type() const override { return HardwareTimerType::HighPrecisionEventTimer; }
virtual const char* model() const override { return "HPET"; }
u8 comparator_number() const { return m_comparator_number; }
bool is_enabled() const { return m_enabled; }
bool is_64bit_capable() const { return m_is_64bit_capable; }
virtual size_t ticks_per_second() const override;
@ -43,10 +44,11 @@ public:
private:
void set_new_countdown();
virtual void handle_irq(const RegisterState&) override;
HPETComparator(u8 number, u8 irq, bool periodic_capable);
HPETComparator(u8 number, u8 irq, bool periodic_capable, bool is_64bit_capable);
bool m_periodic : 1;
bool m_periodic_capable : 1;
bool m_enabled : 1;
bool m_is_64bit_capable : 1;
u8 m_comparator_number { 0 };
};
}