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

This commit is contained in:
2026-04-20 16:00:52 +02:00
parent ad68f99b74
commit d1fffecff6
10 changed files with 250 additions and 65 deletions
+4
View File
@@ -735,6 +735,10 @@ namespace Drivers::Net::E1000E {
return g_initialized;
}
bool RequiresPolling() {
return g_initialized && g_pollingMode;
}
void SetRxCallback(RxCallback callback) {
g_rxCallback = callback;
}
+3
View File
@@ -147,6 +147,9 @@ namespace Drivers::Net::E1000E {
// Check if the device was found and initialized
bool IsInitialized();
// Returns true only when the driver had to fall back to timer polling.
bool RequiresPolling();
// RX callback type: called with (packet data, length)
using RxCallback = void(*)(const uint8_t* data, uint16_t length);
+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;
+1
View File
@@ -292,6 +292,7 @@ namespace Drivers::USB::Xhci {
void Initialize();
bool Probe(const Pci::PciDevice& dev);
bool IsInitialized();
bool HasDeferredWork();
// Deferred hot-plug processing (call from timer tick, not interrupt context)
void ProcessDeferredWork();