void EsifServices::throwIfNotSuccessful(const std::string& fileName, UIntN lineNumber, const std::string& executingFunctionName, eEsifError returnCode, esif_primitive_type primitive, UIntN participantIndex, UIntN domainIndex, UInt8 instance) { if (returnCode == ESIF_OK) { return; } ManagerMessage message = ManagerMessage(m_dptfManager, fileName, lineNumber, executingFunctionName, "Error returned from ESIF services interface function call"); message.setEsifPrimitive(primitive, instance); message.setParticipantAndDomainIndex(participantIndex, domainIndex); message.setEsifErrorCode(returnCode); if ((primitive == GET_TRIP_POINT_ACTIVE) && (returnCode == ESIF_I_ACPI_TRIP_POINT_NOT_PRESENT)) { // no message. we still throw an exception to inform the policy. } else { writeMessageWarning(message); } throw primitive_execution_failed(message); }
Temperature EsifServices::primitiveExecuteGetAsTemperatureC(esif_primitive_type primitive, UIntN participantIndex, UIntN domainIndex, UInt8 instance) { throwIfParticipantDomainCombinationInvalid(FLF, participantIndex, domainIndex); EsifDataTemperature esifResult; eEsifError rc = m_esifInterface.fPrimitiveFuncPtr(m_esifHandle, m_dptfManager, (void*)m_dptfManager->getIndexContainer()->getIndexPtr(participantIndex), (void*)m_dptfManager->getIndexContainer()->getIndexPtr(domainIndex), EsifDataVoid(), esifResult, primitive, instance); #ifdef ONLY_LOG_TEMPERATURE_THRESHOLDS // Added to help debug issue with missing temperature threshold events if (primitive == esif_primitive_type::GET_TEMPERATURE) { ManagerMessage message = ManagerMessage(m_dptfManager, FLF, "Requested participant temperature from ESIF."); message.addMessage("Temperature", esifResult); message.setEsifPrimitive(primitive, instance); message.setParticipantAndDomainIndex(participantIndex, domainIndex); message.setEsifErrorCode(rc); writeMessageDebug(message, MessageCategory::TemperatureThresholds); } #endif throwIfNotSuccessful(FLF, rc, primitive, participantIndex, domainIndex, instance); return esifResult; }
void EsifServices::writeConfigurationUInt32(const std::string& elementPath, UInt32 elementValue) { eEsifError rc = m_esifInterface.fSetConfigFuncPtr(m_esifHandle, m_dptfManager, EsifDataString("dptf"), EsifDataString(elementPath), EsifDataUInt32(elementValue), ESIF_SERVICE_CONFIG_PERSIST); if (rc != ESIF_OK) { ManagerMessage message = ManagerMessage(m_dptfManager, FLF, "Error returned from ESIF services interface function call"); message.addMessage("Element Path", elementPath); message.addMessage("Element Value", elementValue); message.setEsifErrorCode(rc); writeMessageWarning(message); throw dptf_exception(message); } }
void EsifServices::throwIfNotSuccessful(const std::string& fileName, UIntN lineNumber, const std::string& executingFunctionName, eEsifError returnCode, UIntN participantIndex, UIntN domainIndex) { if (returnCode == ESIF_OK) { return; } ManagerMessage message = ManagerMessage(m_dptfManager, fileName, lineNumber, executingFunctionName, "Error returned from ESIF services interface function call"); message.setParticipantAndDomainIndex(participantIndex, domainIndex); message.setEsifErrorCode(returnCode); writeMessageWarning(message); throw dptf_exception(message); }
std::string EsifServices::readConfigurationString(const std::string& elementPath) { EsifDataString esifResult(Constants::DefaultBufferSize); eEsifError rc = m_esifInterface.fGetConfigFuncPtr(m_esifHandle, m_dptfManager, EsifDataString("dptf"), EsifDataString(elementPath), esifResult); if (rc != ESIF_OK) { ManagerMessage message = ManagerMessage(m_dptfManager, FLF, "Error returned from ESIF services interface function call"); message.addMessage("Element Path", elementPath); message.setEsifErrorCode(rc); writeMessageWarning(message); throw dptf_exception(message); } return esifResult; }
void EsifServices::primitiveExecuteSetAsTemperatureC(esif_primitive_type primitive, Temperature temperature, UIntN participantIndex, UIntN domainIndex, UInt8 instance) { throwIfParticipantDomainCombinationInvalid(FLF, participantIndex, domainIndex); #ifdef ONLY_LOG_TEMPERATURE_THRESHOLDS // Added to help debug issue with missing temperature threshold events if (primitive == esif_primitive_type::SET_TEMPERATURE_THRESHOLDS) { ManagerMessage message = ManagerMessage(m_dptfManager, FLF, "Setting new temperature threshold for participant."); message.addMessage("Temperature", temperature.toString()); message.setEsifPrimitive(primitive, instance); message.setParticipantAndDomainIndex(participantIndex, domainIndex); writeMessageDebug(message, MessageCategory::TemperatureThresholds); } #endif eEsifError rc = m_esifInterface.fPrimitiveFuncPtr(m_esifHandle, m_dptfManager, (void*)m_dptfManager->getIndexContainer()->getIndexPtr(participantIndex), (void*)m_dptfManager->getIndexContainer()->getIndexPtr(domainIndex), EsifDataTemperature(temperature), EsifDataVoid(), primitive, instance); #ifdef ONLY_LOG_TEMPERATURE_THRESHOLDS // Added to help debug issue with missing temperature threshold events if (primitive == esif_primitive_type::SET_TEMPERATURE_THRESHOLDS && rc != ESIF_OK) { ManagerMessage message = ManagerMessage(m_dptfManager, FLF, "Failed to set new temperature threshold."); message.addMessage("Temperature", temperature.toString()); message.setEsifPrimitive(primitive, instance); message.setParticipantAndDomainIndex(participantIndex, domainIndex); message.setEsifErrorCode(rc); writeMessageError(message, MessageCategory::TemperatureThresholds); } #endif throwIfNotSuccessful(FLF, rc, primitive, participantIndex, domainIndex, instance); }
void EsifServices::unregisterEvent(FrameworkEvent::Type frameworkEvent, UIntN participantIndex, UIntN domainIndex) { throwIfParticipantDomainCombinationInvalid(FLF, participantIndex, domainIndex); Guid guid = FrameworkEventInfo::instance()->getGuid(frameworkEvent); eEsifError rc = m_esifInterface.fUnregisterEventFuncPtr(m_esifHandle, m_dptfManager, (void*)m_dptfManager->getIndexContainer()->getIndexPtr(participantIndex), (void*)m_dptfManager->getIndexContainer()->getIndexPtr(domainIndex), EsifDataGuid(guid)); // FIXME: this should throw an exception if we get an unexpected return code. For now we will just log an // error so we can see a list of items to correct. if (rc != ESIF_OK) { ManagerMessage message = ManagerMessage(m_dptfManager, FLF, "Error returned from ESIF unregister event function call"); message.setFrameworkEvent(frameworkEvent); message.addMessage("Guid", guid.toString()); message.setParticipantAndDomainIndex(participantIndex, domainIndex); message.setEsifErrorCode(rc); writeMessageWarning(message); } }