PLDM: System specific BIOS attributes
This commit adds code to populate BIOS attributes
based on the system type that is the platform.
The BIOS Jsons are installed based on the platform/
system type. The system type is populated by entity
manager.
TESTED on hardware across different platform/system type.
On systems where the compatible system interface is not
implemented or entity manager not running, then the BIOS
Jsons with default values are installed.
Signed-off-by: Sagar Srinivas <sagar.srinivas@ibm.com>
Change-Id: I179dad34537ed0d1fb263584d687a1b8cb64c335
diff --git a/libpldmresponder/bios_config.cpp b/libpldmresponder/bios_config.cpp
index a9d7723..094b5e5 100644
--- a/libpldmresponder/bios_config.cpp
+++ b/libpldmresponder/bios_config.cpp
@@ -44,12 +44,21 @@
BIOSConfig::BIOSConfig(
const char* jsonDir, const char* tableDir, DBusHandler* const dbusHandler,
int fd, uint8_t eid, pldm::InstanceIdDb* instanceIdDb,
- pldm::requester::Handler<pldm::requester::Request>* handler) :
+ pldm::requester::Handler<pldm::requester::Request>* handler,
+ pldm::responder::oem_bios::Handler* oemBiosHandler) :
jsonDir(jsonDir),
tableDir(tableDir), dbusHandler(dbusHandler), fd(fd), eid(eid),
- instanceIdDb(instanceIdDb), handler(handler)
+ instanceIdDb(instanceIdDb), handler(handler), oemBiosHandler(oemBiosHandler)
{
+ if (oemBiosHandler)
+ {
+ auto systemType = oemBiosHandler->getPlatformName();
+ if (systemType.has_value())
+ {
+ sysType = systemType.value();
+ }
+ }
fs::create_directories(tableDir);
constructAttributes();
listenPendingAttributes();
@@ -473,13 +482,13 @@
void BIOSConfig::constructAttributes()
{
- load(jsonDir / stringJsonFile, [this](const Json& entry) {
+ load(jsonDir / sysType / stringJsonFile, [this](const Json& entry) {
constructAttribute<BIOSStringAttribute>(entry);
});
- load(jsonDir / integerJsonFile, [this](const Json& entry) {
+ load(jsonDir / sysType / integerJsonFile, [this](const Json& entry) {
constructAttribute<BIOSIntegerAttribute>(entry);
});
- load(jsonDir / enumJsonFile, [this](const Json& entry) {
+ load(jsonDir / sysType / enumJsonFile, [this](const Json& entry) {
constructAttribute<BIOSEnumAttribute>(entry);
});
}
@@ -561,9 +570,9 @@
strings.emplace(entry.at("attribute_name"));
};
- load(jsonDir / stringJsonFile, handler);
- load(jsonDir / integerJsonFile, handler);
- load(jsonDir / enumJsonFile, [&strings](const Json& entry) {
+ load(jsonDir / sysType / stringJsonFile, handler);
+ load(jsonDir / sysType / integerJsonFile, handler);
+ load(jsonDir / sysType / enumJsonFile, [&strings](const Json& entry) {
strings.emplace(entry.at("attribute_name"));
auto possibleValues = entry.at("possible_values");
for (auto& pv : possibleValues)