vector<LpmEntry> LpmConfigurationReaderV0::convertV0LpmEntriesToV1Format( CoreControlOffliningMode::Type cpuOffliningMode, UInt32 cpuPercentageActiveLogicalProcessors, UInt32 cpuTargetFrequency, Bool cpuUseTStateThrottling, UInt32 packagePowerLimit, UInt32 gfxTargetFrequency) { vector<LpmEntry> lpmEntries; string acpiScope; // ACPI scope - we do not have this. DomainType::Type domainType; ControlKnobType::Type controlKnob; UIntN controlKnobValue; domainType = DomainType::Processor; if (cpuUseTStateThrottling == false) { controlKnob = ControlKnobType::PerformanceControlPerfFrequency; } else { controlKnob = ControlKnobType::PerformanceControlThrottleFrequency; } controlKnobValue = cpuTargetFrequency; lpmEntries.push_back(LpmEntry(acpiScope, domainType, controlKnob, controlKnobValue)); domainType = DomainType::Graphics; controlKnob = ControlKnobType::PerformanceControlPerfFrequency; controlKnobValue = gfxTargetFrequency; lpmEntries.push_back(LpmEntry(acpiScope, domainType, controlKnob, controlKnobValue)); domainType = DomainType::MultiFunction; controlKnob = ControlKnobType::PowerControlPl1; // TODO: Only PL1? controlKnobValue = packagePowerLimit; lpmEntries.push_back(LpmEntry(acpiScope, domainType, controlKnob, controlKnobValue)); domainType = DomainType::Processor; controlKnob = ControlKnobType::CoreControlLpo; controlKnobValue = cpuPercentageActiveLogicalProcessors; lpmEntries.push_back(LpmEntry(acpiScope, domainType, controlKnob, controlKnobValue)); // TODO: cpuOffliningMode -> ? V1 does not have this? return lpmEntries; }
vector<LpmEntry> LpmConfigurationReaderV1::readLpmEntries(void) { vector<LpmEntry> lpmEntries; string target; DomainType::Type domainType; ControlKnobType::Type controlKnob; UInt32 controlValue; UIntN lpmEntryIndex; string inputKeyPath = keyPath(); try { for (lpmEntryIndex = 0; ; lpmEntryIndex++) { setLpmEntryKeyPath(inputKeyPath, lpmEntryIndex); target = readTargetDeviceAcpiScope(); domainType = readDomainType(); controlKnob = readControlKnob(); controlValue = readControlValue(); lpmEntries.push_back(LpmEntry(target, domainType, controlKnob, controlValue)); if (lpmEntryIndex >= LpmEntriesIndexLimit::MaxLpmEntryIndex) { throw dptf_exception("LPM entries exceeded max value"); } } } catch (dptf_exception& e) { string msg = e.what(); postInfoMessage(PolicyMessage(FLF, "Error msg (" + msg + "). Last lpmEntryIndex = " + to_string(lpmEntryIndex), Constants::Invalid)); return lpmEntries; } return (lpmEntries); }