feat: support for USB mass storage devices, hotplugging

This commit is contained in:
2026-05-18 17:47:12 +02:00
parent f8e8af1d78
commit 41d2841cc9
36 changed files with 1537 additions and 130 deletions
+9 -3
View File
@@ -105,9 +105,6 @@ namespace Timekeeping {
if (Drivers::Net::E1000E::RequiresPolling()) {
Drivers::Net::E1000E::Poll();
}
if (Drivers::USB::Xhci::HasDeferredWork()) {
Drivers::USB::Xhci::ProcessDeferredWork();
}
Drivers::USB::HidKeyboard::Tick();
}
@@ -246,6 +243,15 @@ namespace Timekeeping {
void IdleOnce(bool hasMwait, volatile uint64_t* monitorAddr) {
auto* cpu = Smp::GetCurrentCpuData();
// Drain USB hot-plug deferred work from any idle core, not just the BSP.
// ProcessDeferredWork uses an atomic CAS so only one core runs it at a
// time; the rest return immediately. This keeps hot-plug latency bounded
// by *any* core's idle gap instead of being pinned to BSP idle.
if (Drivers::USB::Xhci::HasDeferredWork()) {
Drivers::USB::Xhci::ProcessDeferredWork();
}
if (cpu == nullptr || cpu->cpuIndex != 0 || !g_schedEnabled || g_ticksPerMs == 0) {
Hal::CpuIdle::Wait(BSP_TICK_INTERVAL_MS, hasMwait, monitorAddr);
return;