bool GPUSensors::start(IOService *provider) { HWSensorsDebugLog("Starting..."); int arg_value = 1; if (PE_parse_boot_argn("-gpusensors-disable", &arg_value, sizeof(arg_value))) { return false; } if (!provider || !super::start(provider)) return false; if (!(pciDevice = OSDynamicCast(IOPCIDevice, provider))) { HWSensorsFatalLog("no PCI device"); return false; } if (!onStartUp(provider)) return false; if (shouldWaitForAccelerator()) { if (!(workloop = getWorkLoop())) { HWSensorsFatalLog("failed to obtain workloop"); return false; } if (!(timerEventSource = IOTimerEventSource::timerEventSource( this, OSMemberFunctionCast(IOTimerEventSource::Action, this, &GPUSensors::probeEvent)))) { HWSensorsFatalLog("failed to initialize startup check timer event source"); return false; } if (kIOReturnSuccess != workloop->addEventSource(timerEventSource)) { HWSensorsFatalLog("failed to add startup check timer event source into workloop"); timerEventSource->release(); return false; } timerEventSource->setTimeoutMS(100); } else return managedStart(provider); return true; }
bool GPUSensors::start(IOService *provider) { HWSensorsDebugLog("Starting..."); if (!provider || !super::start(provider)) return false; if (!(pciDevice = OSDynamicCast(IOPCIDevice, provider))) { HWSensorsFatalLog("no PCI device"); return false; } if (shouldWaitForAccelerator()) { if (!(workloop = getWorkLoop())) { HWSensorsFatalLog("failed to obtain workloop"); return false; } if (!(timerEventSource = IOTimerEventSource::timerEventSource( this, OSMemberFunctionCast(IOTimerEventSource::Action, this, &GPUSensors::probeEvent)))) { HWSensorsFatalLog("failed to initialize timer event source"); return false; } if (kIOReturnSuccess != workloop->addEventSource(timerEventSource)) { HWSensorsFatalLog("failed to add timer event source into workloop"); timerEventSource->release(); return false; } timerEventSource->setTimeoutMS(kGPUSensorsAcceleratorWaitCycle * 2); } else return managedStart(provider); return true; }
void GPUSensors::onTimeoutExceeded(IOService *provider) { managedStart(provider); }
void GPUSensors::onAcceleratorFound(IOService *provider) { managedStart(provider); }