Exemplo n.º 1
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));
}
Exemplo n.º 2
0
LpmTable BinaryParse::lpmTableObject(UInt32 dataLength, void* binaryData)
{
    std::vector<LpmEntry> lpmTableEntries;
    UInt8* data = reinterpret_cast<UInt8*>(binaryData);
    struct EsifDataBinaryLpmtPackage* currentRow = reinterpret_cast<struct EsifDataBinaryLpmtPackage*>(data);
    esif_data_variant* dataVariant;
    LpmConfigurationVersion::Type version;

    validateData(dataLength);

    UIntN rows = countLpmtRows(dataLength, data);

    dataVariant = reinterpret_cast<esif_data_variant*>(binaryData);
    version = static_cast<LpmConfigurationVersion::Type>(dataVariant->integer.value);

    // Reset currentRow to point to the beginning of the data block
    data = reinterpret_cast<UInt8*>(binaryData);
    data += sizeof(esif_data_variant);
    currentRow = reinterpret_cast<struct EsifDataBinaryLpmtPackage*>(data);

    for (UIntN i = 0; i < rows; i++)
    {
        std::string target(
            reinterpret_cast<const char*>(&(currentRow->targetDevice)) + sizeof(union esif_data_variant),
            currentRow->targetDevice.string.length);

        data += currentRow->targetDevice.string.length;
        currentRow = reinterpret_cast<struct EsifDataBinaryLpmtPackage*>(data);

        // Convert from esif/acpi type to dptf type.
        esif_domain_type esifDomainType =
            static_cast<esif_domain_type>(currentRow->domainType.integer.value);
        DomainType::Type domainType = EsifDomainTypeToDptfDomainType(esifDomainType);
        LpmEntry lpmEntry(
            normalizeAcpiScope(target),
            domainType,
            static_cast<ControlKnobType::Type>(currentRow->controlKnob.integer.value),
            static_cast<UInt32>(currentRow->controlValue.integer.value));

        lpmTableEntries.push_back(lpmEntry);

        // Since we've already accounted for the strings, we now move the pointer by the size of the structure
        //  to get to the next row.
        data += sizeof(struct EsifDataBinaryLpmtPackage);
        currentRow = reinterpret_cast<struct EsifDataBinaryLpmtPackage*>(data);
    }

    return (LpmTable(version, lpmTableEntries));
}