feat: further kernel power and power optimizations
This commit is contained in:
@@ -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);
|
||||
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user