Fix BIOS to allow updating attributers via D-Bus
BIOS attribute is changed by pending attributes and the new value
should be shown in D-Bus.
Also BaseBIOSTable should be updated.
Tested:
busctl call xyz.openbmc_project.BIOSConfigManager /xyz/openbmc_project/bios_config/manager org.freedesktop.DBus.Properties Set ssv xyz.openbmc_project.BIOSConfig.Manager PendingAttributes a{s\(sv\)} 1 "pvm_stop_at_standby" "xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Enumeration" s "Enabled"
busctl get-property xyz.openbmc_project.BIOSConfigManager /xyz/openbmc_project/bios_config/manager xyz.openbmc_project.BIOSConfig.Manager BaseBIOSTable --verbose
```
DICT_ENTRY "s(sbsssvva(sv))" {
STRING "pvm_stop_at_standby";
STRUCT "sbsssvva(sv)" {
STRING "xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Enumeration";
BOOLEAN false;
STRING "pvm_stop_at_standby";
STRING "pvm_stop_at_standby";
STRING "";
VARIANT "s" {
STRING "Enabled";
};
VARIANT "s" {
STRING "Enabled";
};
ARRAY "(sv)" {
STRUCT "sv" {
STRING "xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf";
VARIANT "s" {
STRING "Disabled";
};
};
STRUCT "sv" {
STRING "xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf";
VARIANT "s" {
STRING "Enabled";
};
};
};
};
};
```
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I74ee9ff843fa9d588f94e4334d015cf55b52aea6
diff --git a/libpldmresponder/bios_config.cpp b/libpldmresponder/bios_config.cpp
index b3d827f..c7c408e 100644
--- a/libpldmresponder/bios_config.cpp
+++ b/libpldmresponder/bios_config.cpp
@@ -683,7 +683,7 @@
};
}
-int BIOSConfig::setAttrValue(const void* entry, size_t size,
+int BIOSConfig::setAttrValue(const void* entry, size_t size, bool updateDBus,
bool updateBaseBIOSTable)
{
auto attrValueTable = getBIOSTable(PLDM_BIOS_ATTR_VAL_TABLE);
@@ -735,7 +735,11 @@
{
return PLDM_ERROR;
}
- (*iter)->setAttrValueOnDbus(attrValueEntry, attrEntry, biosStringTable);
+ if (updateDBus)
+ {
+ (*iter)->setAttrValueOnDbus(attrValueEntry, attrEntry,
+ biosStringTable);
+ }
}
catch (const std::exception& e)
{
@@ -838,10 +842,11 @@
storeTable(tableDir / attrValueTableFile, *destTable);
}
- rc = setAttrValue(newValue.data(), newValue.size());
+ rc = setAttrValue(newValue.data(), newValue.size(), false);
if (rc != PLDM_SUCCESS)
{
- std::cerr << "could not setAttrValue on base bios table and dbus \n";
+ std::cerr << "could not setAttrValue on base bios table and dbus, rc = "
+ << rc << "\n";
}
}
@@ -912,7 +917,7 @@
(*iter)->generateAttributeEntry(attributevalue, attrValueEntry);
- setAttrValue(attrValueEntry.data(), attrValueEntry.size(), false);
+ setAttrValue(attrValueEntry.data(), attrValueEntry.size());
}
if (listOfHandles.size())
@@ -925,7 +930,6 @@
return;
}
#endif
- updateBaseBIOSTableProperty();
}
}