feat: various power and thermal optimizations, fix Printers app regression

This commit is contained in:
2026-04-20 16:00:52 +02:00
parent ea4e3dbf96
commit 7d6f001659
10 changed files with 250 additions and 65 deletions
+8 -1
View File
@@ -49,6 +49,7 @@ namespace Drivers::USB::Xhci {
// Hot-plug deferred work
static volatile bool g_hotplugPending[MAX_PORTS] = {};
static volatile bool g_deferredWorkPending = false;
static bool g_hotplugProcessing = false;
// MMIO region pointers
@@ -302,6 +303,7 @@ namespace Drivers::USB::Xhci {
// Defer enumeration to ProcessDeferredWork (called from timer tick)
if (g_bootScanComplete && portId >= 1 && portId <= g_maxPorts) {
g_hotplugPending[portId - 1] = true;
g_deferredWorkPending = true;
}
break;
}
@@ -723,15 +725,20 @@ namespace Drivers::USB::Xhci {
return g_initialized;
}
bool HasDeferredWork() {
return g_initialized && g_deferredWorkPending;
}
// -------------------------------------------------------------------------
// ProcessDeferredWork - handle hot-plug outside interrupt context
// Called from timer tick (same pattern as E1000E::Poll)
// -------------------------------------------------------------------------
void ProcessDeferredWork() {
if (!g_initialized || !g_bootScanComplete) return;
if (!g_initialized || !g_bootScanComplete || !g_deferredWorkPending) return;
if (g_hotplugProcessing) return;
g_hotplugProcessing = true;
g_deferredWorkPending = false;
for (uint32_t port = 0; port < g_maxPorts; port++) {
if (!g_hotplugPending[port]) continue;