UInt32 LpmConfigurationReaderV0::readCpuPercentageActiveLogicalProcessors()
{
    string key = "CpuPercentageActiveLogicalProcessors";
    UInt32 cpuPercentageActiveLogicalProcessors;
    try
    {
        cpuPercentageActiveLogicalProcessors =
            getPolicyServices().platformConfigurationData->readConfigurationUInt32(
                root() + keyPath() + key);
    }
    catch(dptf_exception& e)
    {
        string msg = e.what();

        m_policyServices.messageLogging->writeMessageDebug(PolicyMessage(FLF,
            "No CpuPercentageActiveLogicalProcessors - defaulting to 1%. msg - " + msg,
            Constants::Invalid));

        // Default to 1% (translates to 1 core).
        cpuPercentageActiveLogicalProcessors = 1;
    }

    if (cpuPercentageActiveLogicalProcessors < 1)
    {
        cpuPercentageActiveLogicalProcessors = 1;
    }
    else if (cpuPercentageActiveLogicalProcessors > 100)
    {
        cpuPercentageActiveLogicalProcessors = 100;
    }

    return cpuPercentageActiveLogicalProcessors;
}
UInt32 LpmConfigurationReaderV0::readGfxTargetFrequency()
{
    string key = "GfxTargetFrequency";
    UInt32 gfxTargetFrequency;
    try
    {
        gfxTargetFrequency =
            getPolicyServices().platformConfigurationData->readConfigurationUInt32(
            root() + keyPath() + key);
    }
    catch(dptf_exception& e)
    {
        string msg = e.what();

        m_policyServices.messageLogging->writeMessageError(PolicyMessage(FLF,
            "Error in reading GfxTargetFrequency, default 100Mhz. msg - " + msg,
            Constants::Invalid));

        //
        // if not found, we default to 100 mhz,
        // which will be the lowest graphics p-state (since we round up)
        //
        gfxTargetFrequency = 100;
    }

    return gfxTargetFrequency;
}
CoreControlOffliningMode::Type LpmConfigurationReaderV0::readCpuOffliningMode()
{
    string key = "CpuOffLiningMode";
    CoreControlOffliningMode::Type cpuOffliningMode;
    try
    {
        UIntN valueInt = getPolicyServices().platformConfigurationData->readConfigurationUInt32(
            root() + keyPath() + key);
        if (valueInt > CoreControlOffliningMode::Core)
        {
            m_policyServices.messageLogging->writeMessageError(PolicyMessage(FLF,
            "Invalid CoreControlOffliningMode returned (" + to_string(valueInt) + ")" +
                " - defaulting to core", Constants::Invalid));
            cpuOffliningMode = CoreControlOffliningMode::Core;
        }
        else
        {
            cpuOffliningMode = (CoreControlOffliningMode::Type)valueInt;
        }
    }
    catch(dptf_exception& e)
    {
        string msg = e.what();
        m_policyServices.messageLogging->writeMessageDebug(PolicyMessage(FLF,
            "No CoreControlOffliningMode returned - defaulting to core. msg - " + msg,
            Constants::Invalid));
        cpuOffliningMode = CoreControlOffliningMode::Core;
    }

    return cpuOffliningMode;
}
Bool LpmConfigurationReaderV0::readCpuUseTStateThrottling()
{
    string key = "CpuUseTStateThrottling";
    Bool cpuUseTStateThrottling;
    try
    {
        UIntN valueInt =
            getPolicyServices().platformConfigurationData->readConfigurationUInt32(
            root() + keyPath() + key);
        if (valueInt)
        {
            cpuUseTStateThrottling = true;
        }
        else
        {
            cpuUseTStateThrottling = false;
        }
    }
    catch(dptf_exception& e)
    {
        string msg = e.what();
        m_policyServices.messageLogging->writeMessageDebug(PolicyMessage(FLF,
            "No CpuUseTStateThrottling - defaulting to false. msg - " + msg,
            Constants::Invalid));
        cpuUseTStateThrottling = false;
    }

    if ((cpuUseTStateThrottling != true) && (cpuUseTStateThrottling != false))
    {
        cpuUseTStateThrottling = false;
    }

    return cpuUseTStateThrottling;
}
示例#5
0
UIntN LpmConfigurationReaderV1::readControlValue(void)
{
    string key = "ControlValue";
    UIntN controlValue = getPolicyServices().platformConfigurationData->readConfigurationUInt32(
        root() + keyPath() + key);
    return controlValue;
}
示例#6
0
DomainType::Type LpmConfigurationReaderV1::readDomainType(void)
{
    string key = "DomainType";
    UIntN valueInt = getPolicyServices().platformConfigurationData->readConfigurationUInt32(
        root() + keyPath() + key);
    // Convert from esif/acpi type to dptf type.
    esif_domain_type esifDomainType = static_cast<esif_domain_type>(valueInt);
    return(EsifDomainTypeToDptfDomainType(esifDomainType));
}
示例#7
0
ControlKnobType::Type LpmConfigurationReaderV1::readControlKnob(void)
{
    string key = "ControlKnob";
    UIntN valueInt = getPolicyServices().platformConfigurationData->readConfigurationUInt32(
        root() + keyPath() + key);
    if (validControlKnob(valueInt) == false)
    {
        throw dptf_exception("Invalid control knob returned");
    }
    return(ControlKnobType::Type(valueInt));
}
示例#8
0
std::string LpmConfigurationReaderV1::readTargetDeviceAcpiScope(void)
{
    string key = "TargetDeviceObjectId";
    string target = getPolicyServices().platformConfigurationData->readConfigurationString(
        root() + keyPath() + key);
    if (target.empty())
    {
        throw dptf_exception("Empty ACPI scope string returned");
    }

    string normalizedTarget = BinaryParse::normalizeAcpiScope(target);
    return normalizedTarget;
}
示例#9
0
vector<string> LpmConfigurationReaderV1::readAppNames(UInt32 entryIndex)
{
    string indexAsString = getIndexAsString(entryIndex);
    string path = "AppSpecificLpm" + indexAsString + "/";
    setKeyPath(path);

    string key = "ExecutableNames";
    string execNames = getPolicyServices().platformConfigurationData->readConfigurationString(
        root() + keyPath() + key);
    if (execNames.empty())
    {
        throw dptf_exception("Empty execNames string returned");
    }

    // Parse the string, it contains app names each separated by space.
    vector<string> appNames = tokenize(execNames, ' ');
    return appNames;
}
示例#10
0
vector<AppSpecificEntry> LpmConfigurationReaderV1::readAppSpecificEntries(void)
{
    vector<AppSpecificEntry> appSpecificEntries;

    //
    // Since this configuration does not have the numAppSpecificEntries we loop through
    // till we fail to read. We handle it in the catch block.
    //
    UIntN appIndex;
    try
    {
        for (appIndex = 0; ; appIndex++)
        {
            vector<string> appNames = readAppNames(appIndex);

            string key = "LPMSet";
            UIntN lpmSetIndex = getPolicyServices().platformConfigurationData->readConfigurationUInt32(
                root() + keyPath() + key);

            appSpecificEntries.push_back(AppSpecificEntry(appNames, lpmSetIndex));

            if (appIndex >= LpmEntriesIndexLimit::MaxAppEntryIndex)
            {
                throw dptf_exception("App Entries exceeded max value");
            }
        }
    }
    catch (dptf_exception& e)
    {
        string msg = e.what();
        postInfoMessage(PolicyMessage(FLF,
            "Error msg (" + msg + "). Last appIndex = " + to_string(appIndex),
            Constants::Invalid));
        return appSpecificEntries;
    }

    return appSpecificEntries;

}
示例#11
0
vector<string> LpmConfigurationReaderV0::readAppNames(UInt32 entryIndex)
{
    string key = "AppName";
    vector<string> appNames;
    string indexAsString = getIndexAsString(entryIndex);

    setKeyPath("AppSpecificMode" + indexAsString + "/");
    try
    {
        // TODO: Error check for appname?
        string appName = getPolicyServices().platformConfigurationData->readConfigurationString(
            root() + keyPath() + key);
        appNames.push_back(appName);
    }
    catch (dptf_exception& e)
    {
        string msg = e.what();
        m_policyServices.messageLogging->writeMessageDebug(PolicyMessage(FLF,
            "Error msg (" + msg + "). Error in reading AppName", Constants::Invalid));
    }

    return appNames;
}
示例#12
0
vector<AppSpecificEntry> LpmConfigurationReaderV0::readAppSpecificEntries(void)
{
    m_lpmSets.clear();

    vector<AppSpecificEntry> appSpecificEntries;
    UIntN entryIndex = 0;
    try
    {
        string key = "NumAppSpecificEntries";
        UIntN numEntries = getPolicyServices().platformConfigurationData->readConfigurationUInt32(
            root() + key);

        if (numEntries == 0)
        {
            throw dptf_exception("No app specific entries for v0");
        }

        for (entryIndex = 0; entryIndex < numEntries; entryIndex++)
        {
            vector<string> appNames = readAppNames(entryIndex);
            vector<LpmEntry> lpmEntries = readLpmEntries();

            appSpecificEntries.push_back(AppSpecificEntry(appNames, entryIndex));
            m_lpmSets.push_back(LpmSet(entryIndex, lpmEntries));
        }
    }
    catch (dptf_exception& e)
    {
        string msg = e.what();
        m_policyServices.messageLogging->writeMessageDebug(PolicyMessage(FLF,
            "Error msg (" + msg + "). Last entryIndex = " + to_string(entryIndex),
            Constants::Invalid));
    }

    return appSpecificEntries;
}
示例#13
0
UInt32 LpmConfigurationReaderV0::readPackagePowerLimit()
{
    // TODO: Check regarding PL -> string/uint? Do we need to sku check like 7.0?
    UInt32 packagePowerLimit;
    string key = "PackagePowerLimit";

    try
    {
        string valueString = getPolicyServices().platformConfigurationData->readConfigurationString(
            root() + keyPath() + key);
        packagePowerLimit = extractPowerLimit(valueString);
    }
    catch (dptf_exception& e)
    {
        string msg = e.what();

        m_policyServices.messageLogging->writeMessageError(PolicyMessage(FLF,
            "Error in reading PackagePowerLimit, default 10000000. msg - " + msg,
            Constants::Invalid));
        packagePowerLimit = 10000000; // Max valid power
    }

    return packagePowerLimit;
}
示例#14
0
UInt32 LpmConfigurationReaderV0::readCpuTargetFrequency()
{
    string key = "CpuTargetFrequency";
    UInt32 cpuTargetFrequency;
    try
    {
        cpuTargetFrequency =
          getPolicyServices().platformConfigurationData->readConfigurationUInt32(
              root() + keyPath() + key);
    }
    catch(dptf_exception& e)
    {
        string msg = e.what();

        m_policyServices.messageLogging->writeMessageDebug(PolicyMessage(FLF,
        "No CpuTargetFrequency - defaulting to 800Mhz. msg - " + msg,
        Constants::Invalid));

        // if not found, we default to 800 mhz (MFM or LFM)
        cpuTargetFrequency = 800;
    }

    return cpuTargetFrequency;
}