feat: further kernel power and power optimizations

This commit is contained in:
2026-04-21 20:51:12 +02:00
parent 7d6f001659
commit 38b1f8a7ef
31 changed files with 895 additions and 52 deletions
+33
View File
@@ -0,0 +1,33 @@
/*
* CpuIdle.hpp
* ACPI-guided CPU idle-state selection
* Copyright (c) 2026 Daniel Hammer
*/
#pragma once
#include <cstdint>
#include <ACPI/ACPI.hpp>
namespace Hal {
namespace CpuIdle {
// Initialize ACPI idle-state policy from the AML namespace and FADT.
void Initialize(ACPI::CommonSDTHeader* xsdt);
// Enter an idle state chosen for the predicted idle duration.
// Falls back to MWAIT/HLT when ACPI data is unavailable.
void Wait(uint32_t predictedIdleMs, bool hasMwait,
volatile uint64_t* monitorAddr = nullptr);
// Same as Wait(), but called with interrupts disabled and returns with
// interrupts disabled. Used by tickless idle paths that need atomic
// STI+HLT/MWAIT semantics.
void WaitWithInterruptsDisabled(uint32_t predictedIdleMs, bool hasMwait,
volatile uint64_t* monitorAddr = nullptr);
// Shallow atomic idle for latency-sensitive interactive bursts.
void WaitShallowWithInterruptsDisabled(bool hasMwait,
volatile uint64_t* monitorAddr = nullptr);
};
};