feat: various power and thermal optimizations, fix Printers app regression
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user