MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / TakeOwnership

Method TakeOwnership

Kernel/src/usb/xhci.cpp:269–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267 }
268
269 bool XHCIController::TakeOwnership(){
270 volatile xhci_ext_cap_legacy_support_t* cap = reinterpret_cast<xhci_ext_cap_legacy_support_t*>(extCapabilities); // Legacy support should be the first entry in the extended capabilities
271
272 if(cap->capID != XHCIExtendedCapabilities::XHCIExtCapLegacySupport){
273 return true; // If there is no legacy support capability don't worry
274 }
275
276 if(cap->controllerBIOSSemaphore){
277 if(debugLevelXHCI >= DebugLevelVerbose){
278 Log::Info("[XHCI] BIOS owns host controller, attempting to take ownership...");
279 }
280
281 cap->controllerOSSemaphore = 1;
282 }
283
284 int timer = 20;
285 while(cap->controllerBIOSSemaphore && timer--){
286 Timer::Wait(1); // Wait 20ms to acquire controller
287 }
288
289 if(cap->controllerBIOSSemaphore){
290 return false;
291 }
292
293 return true;
294 }
295
296 void XHCIController::InitializeProtocols(){
297 auto initializeProto = [&](xhci_ext_cap_supported_protocol_t* cap){

Callers

nothing calls this directly

Calls 2

InfoFunction · 0.85
WaitFunction · 0.50

Tested by

no test coverage detected