pldm: Meson option for system specific bios attributes
PLDM users who want to use bios attributes based on the system type
can enable this meson option.
With disabled option default bios json files are picked to build
bios attribute tables.
Added meson option "system-specific-bios-json" to add the support
for system specific bios attributes.
Below is the pre-requisite to support system specific bios
attributes:
1. Entity Manager service is active
2. Entity Manager should have Decorator.Compatible interface
and system type in Names property under this interface
3. BIOS Attribute json files are added into the folder(Named on
the System Type property value) and should be installed
under /usr/share/pldm/bios/
With disabled "system-specific-bios-json" option default bios
attributes are populated.
Tested:
Poweron system-specific-bios-json enabled/disabled
Change-Id: I95a953cdb12c344d22f487b83040356a1b5fa937
Signed-off-by: Archana Kakani <archana.kakani@ibm.com>
diff --git a/libpldmresponder/bios_config.cpp b/libpldmresponder/bios_config.cpp
index 6cc9c24..991b5c0 100644
--- a/libpldmresponder/bios_config.cpp
+++ b/libpldmresponder/bios_config.cpp
@@ -55,33 +55,38 @@
{
fs::create_directories(tableDir);
removeTables();
- if (isSystemTypeAvailable())
- {
- initBIOSAttributes(sysType);
- }
+
+#ifdef SYSTEM_SPECIFIC_BIOS_JSON
+ checkSystemTypeAvailability();
+#else
+ initBIOSAttributes(sysType, false);
+#endif
+
listenPendingAttributes();
}
-bool BIOSConfig::isSystemTypeAvailable()
+void BIOSConfig::checkSystemTypeAvailability()
{
if (platformConfigHandler)
{
auto systemType = platformConfigHandler->getPlatformName();
if (systemType.has_value())
{
+ // Received System Type from Entity Manager
sysType = systemType.value();
+ initBIOSAttributes(sysType, true);
}
else
{
- platformConfigHandler->registerSystemTypeCallback(std::bind(
- &BIOSConfig::initBIOSAttributes, this, std::placeholders::_1));
- return false;
+ platformConfigHandler->registerSystemTypeCallback(
+ std::bind(&BIOSConfig::initBIOSAttributes, this,
+ std::placeholders::_1, std::placeholders::_2));
}
}
- return true;
}
-void BIOSConfig::initBIOSAttributes(const std::string& systemType)
+void BIOSConfig::initBIOSAttributes(const std::string& systemType,
+ bool registerService)
{
sysType = systemType;
fs::path dir{jsonDir / sysType};
@@ -93,7 +98,10 @@
}
constructAttributes();
buildTables();
- requestPLDMServiceName();
+ if (registerService)
+ {
+ requestPLDMServiceName();
+ }
}
void BIOSConfig::buildTables()