void DomainDisplayControl_001::restore(void) { if (m_userPreferredIndex != Constants::Invalid) { try { getParticipantServices()->setUserPreferredDisplayCacheValue(getParticipantIndex(), getDomainIndex(), m_userPreferredIndex); auto displaySet = getDisplayControlSet(getParticipantIndex(), getDomainIndex()); auto upperLimitIndex = getDisplayControlDynamicCaps(getParticipantIndex(), getDomainIndex()).getCurrentUpperLimit(); if (m_userPreferredIndex < upperLimitIndex) { m_userPreferredIndex = upperLimitIndex; } Percentage newBrightness = displaySet[m_userPreferredIndex].getBrightness(); getParticipantServices()->writeMessageDebug(ParticipantMessage( FLF, "Saved the user preferred index of " + StlOverride::to_string(m_userPreferredIndex) + ". Attempting to set the brightness to the user preferred value .")); getParticipantServices()->primitiveExecuteSetAsPercentage( esif_primitive_type::SET_DISPLAY_BRIGHTNESS, newBrightness, getDomainIndex()); } catch (...) { // best effort getParticipantServices()->writeMessageDebug(ParticipantMessage( FLF, "Failed to restore the user preferred display status. ")); } } }
void DomainPerformanceControl_002::restore(void) { if (m_initialStatus.isValid()) { try { auto restoreIndex = m_initialStatus.get().getCurrentUpperLimitIndex(); auto domainIndex = getDomainIndex(); getParticipantServices()->writeMessageDebug(ParticipantMessage( FLF, "Restoring... P-state = P" + StlOverride::to_string(restoreIndex) + " & T-state = T0.")); auto throttlingStateSet = getThrottlingStateSet(domainIndex); // Set T0 if (throttlingStateSet.getCount() > 0) { getParticipantServices()->primitiveExecuteSetAsUInt32( esif_primitive_type::SET_TSTATE_CURRENT, throttlingStateSet[0].getControlId(), domainIndex); } getParticipantServices()->primitiveExecuteSetAsUInt32( esif_primitive_type::SET_PERF_PRESENT_CAPABILITY, restoreIndex, domainIndex); } catch (...) { // best effort getParticipantServices()->writeMessageDebug(ParticipantMessage( FLF, "Failed to restore the initial performance control status. ")); } } }
void DomainPlatformPowerControlBase::updateEnabled(PlatformPowerLimitType::Type limitType) { try { UInt32 plEnabled = getParticipantServices()->primitiveExecuteGetAsUInt32( GET_PLATFORM_POWER_LIMIT_ENABLE, getDomainIndex(), (UInt8)limitType); Bool enabled = plEnabled > 0 ? true : false; switch (limitType) { case PlatformPowerLimitType::PSysPL1: m_pl1Enabled = enabled; break; case PlatformPowerLimitType::PSysPL2: m_pl2Enabled = enabled; break; case PlatformPowerLimitType::PSysPL3: m_pl3Enabled = enabled; break; default: break; } } catch (...) { } }
void WIDomainCreate::execute(void) { writeDomainWorkItemStartingInfoMessage(); Bool domainCreated = false; try { getParticipantPtr()->createDomain(getDomainIndex(), m_domainDataPtr, m_domainEnabled); domainCreated = true; } catch (std::exception& ex) { writeDomainWorkItemErrorMessage(ex, "Participant::createDomain"); } *m_domainCreated = domainCreated; if (domainCreated == true) { // // Iterate through the list of policies and let them know about the new domain // auto policyManager = getPolicyManager(); UIntN policyListCount = policyManager->getPolicyListCount(); for (UIntN i = 0; i < policyListCount; i++) { try { Policy* policy = policyManager->getPolicyPtr(i); policy->bindDomain(getParticipantIndex(), getDomainIndex()); } catch (policy_index_invalid ex) { // do nothing. No item in the policy list at this index. } catch (std::exception& ex) { writeDomainWorkItemErrorMessagePolicy(ex, "Policy::bindDomain", i); } } } }
void WIDomainDestroy::execute(void) { writeDomainWorkItemStartingInfoMessage(); if (getParticipantPtr()->isDomainValid(getDomainIndex()) == false) { writeDomainWorkItemErrorMessage("Received request to remove a domain that is invalid."); } else { auto policyManager = getPolicyManager(); auto policyIndexes = policyManager->getPolicyIndexes(); // Let each policy know that the domain is going away for (auto i = policyIndexes.begin(); i != policyIndexes.end(); ++i) { try { Policy* policy = policyManager->getPolicyPtr(*i); policy->unbindDomain(getParticipantIndex(), getDomainIndex()); } catch (policy_index_invalid& ex) { // do nothing. No item in the policy list at this index. } catch (std::exception& ex) { writeDomainWorkItemErrorMessagePolicy(ex, "Policy::unbindDomain", *i); } } // Let the participant know to remove the domain try { getParticipantPtr()->destroyDomain(getDomainIndex()); } catch (std::exception& ex) { writeDomainWorkItemErrorMessage(ex, "Participant::destroyDomain"); } } }
void DomainPlatformPowerControlBase::setEnabled(PlatformPowerLimitType::Type limitType, Bool enable) { try { getParticipantServices()->primitiveExecuteSetAsUInt32( SET_PLATFORM_POWER_LIMIT_ENABLE, enable ? (UInt32)1 : (UInt32)0, getDomainIndex(), (UInt8)limitType); } catch (...) { } }
void WIDptfParticipantActivityLoggingEnabled::execute(void) { writeDomainWorkItemStartingInfoMessage(); try { getParticipantPtr()->activityLoggingEnabled(getDomainIndex(), m_capabilityBitMask); } catch (std::exception& ex) { writeDomainWorkItemErrorMessage(ex, "Participant::activityLoggingEnabled"); } }
void DomainPerformanceControl_003::capture(void) { try { m_initialStatus.set(getPerformanceControlDynamicCaps(getParticipantIndex(), getDomainIndex())); } catch (dptf_exception& e) { m_initialStatus.invalidate(); std::string warningMsg = e.what(); getParticipantServices()->writeMessageWarning(ParticipantMessage( FLF, "Failed to get the initial graphics performance control dynamic capabilities. " + warningMsg)); } }
void DomainCoreControl_001::restore(void) { try { getParticipantServices()->primitiveExecuteSetAsUInt32( esif_primitive_type::SET_PROC_NUMBER_OFFLINE_CORES, 0, // No cores are parked getDomainIndex()); } catch (...) { // best effort getParticipantServices()->writeMessageWarning( ParticipantMessage(FLF, "Failed to restore the initial core status. ")); } }
void DomainPerformanceControl_002::capture(void) { try { m_initialStatus.set(getPerformanceControlDynamicCaps(getParticipantIndex(), getDomainIndex())); getParticipantServices()->writeMessageDebug(ParticipantMessage( FLF, "Initial performance capabilities are captured. MIN = " + StlOverride::to_string(m_initialStatus.get().getCurrentLowerLimitIndex()) + " & MAX = " + StlOverride::to_string(m_initialStatus.get().getCurrentUpperLimitIndex()))); } catch (dptf_exception& e) { m_initialStatus.invalidate(); std::string warningMsg = e.what(); getParticipantServices()->writeMessageWarning(ParticipantMessage( FLF, "Failed to get the initial processor performance control dynamic capabilities. " + warningMsg)); } }
void DomainPerformanceControl_003::restore(void) { if (m_initialStatus.isValid()) { try { getParticipantServices()->primitiveExecuteSetAsUInt32( esif_primitive_type::SET_PERF_PRESENT_CAPABILITY, m_initialStatus.get().getCurrentUpperLimitIndex(), getDomainIndex()); } catch (...) { // best effort getParticipantServices()->writeMessageDebug(ParticipantMessage( FLF, "Failed to restore the initial performance control status. ")); } } }