Support numeric effecters in dbus-to-host-effecter
Adds support of the numeric effecter PDR (section `28.11 Numeric
Effecter PDR` DSP0248 V1.3.0) type in dbus-to-host-effecter handler.
This handler will be applied for all PLDM termini but not only host.
The setting for one numeric effecter of one device can be:
{
"mctp_eid": 20,
"effecter_info": {
"effecterPdrType": 9,
"effecterID": 2,
"entityType": 32903,
"entityInstance": 2,
"containerID": 2,
"compositeEffecterCount": 1,
"checkHostState": false
},
"effecters": [
{
"dbus_info": {
"object_path": "/xyz/openbmc_project/sensors/power/A",
"interface": "xyz.openbmc_project.Sensor.Value",
"property_name": "Value",
"property_type": "double"
},
"effecterDataSize": 5,
"resolution": 1,
"offset": 0,
"unitModifier": 0
}
]
}
Where:
+ effecterPdrType to difference state/numeric effecter type. Default
is state effecter.
+ effecterID should be effecter ID and should not empty.
+ checkHostState can be set to false to bypass checking host state.
+ effecterDataSize, resolution, offset, unitModifier are from numeric
effecter PDR (section `28.11 Numeric Effecter PDR` DSP0248 V1.3.0)
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
Change-Id: I438d7f204643edd4066e8a6ba28d53a97503fc4b
diff --git a/pldmd/pldmd.cpp b/pldmd/pldmd.cpp
index 8637a15..8941418 100644
--- a/pldmd/pldmd.cpp
+++ b/pldmd/pldmd.cpp
@@ -48,7 +48,7 @@
#ifdef LIBPLDMRESPONDER
#include "dbus_impl_pdr.hpp"
#include "host-bmc/dbus_to_event_handler.hpp"
-#include "host-bmc/dbus_to_host_effecters.hpp"
+#include "host-bmc/dbus_to_terminus_effecters.hpp"
#include "host-bmc/host_condition.hpp"
#include "host-bmc/host_pdr_handler.hpp"
#include "libpldmresponder/base.hpp"
@@ -209,15 +209,21 @@
requester::Handler<requester::Request> reqHandler(&pldmTransport, event,
instanceIdDb, verbose);
-#ifdef LIBPLDMRESPONDER
- using namespace pldm::state_sensor;
- dbus_api::Host dbusImplHost(bus, "/xyz/openbmc_project/pldm");
std::unique_ptr<pldm_pdr, decltype(&pldm_pdr_destroy)> pdrRepo(
pldm_pdr_init(), pldm_pdr_destroy);
if (!pdrRepo)
{
throw std::runtime_error("Failed to instantiate PDR repository");
}
+ DBusHandler dbusHandler;
+ std::unique_ptr<pldm::host_effecters::HostEffecterParser>
+ hostEffecterParser =
+ std::make_unique<pldm::host_effecters::HostEffecterParser>(
+ &instanceIdDb, pldmTransport.getEventSource(), pdrRepo.get(),
+ &dbusHandler, HOST_JSONS_DIR, &reqHandler);
+#ifdef LIBPLDMRESPONDER
+ using namespace pldm::state_sensor;
+ dbus_api::Host dbusImplHost(bus, "/xyz/openbmc_project/pldm");
std::unique_ptr<pldm_entity_association_tree,
decltype(&pldm_entity_association_tree_destroy)>
entityTree(pldm_entity_association_tree_init(),
@@ -237,10 +243,7 @@
"Failed to instantiate BMC PDR entity association tree");
}
std::shared_ptr<HostPDRHandler> hostPDRHandler;
- std::unique_ptr<pldm::host_effecters::HostEffecterParser>
- hostEffecterParser;
std::unique_ptr<DbusToPLDMEvent> dbusToPLDMEventHandler;
- DBusHandler dbusHandler;
std::unique_ptr<platform_config::Handler> platformConfigHandler{};
platformConfigHandler =
std::make_unique<platform_config::Handler>(PDR_JSONS_DIR);
@@ -256,10 +259,6 @@
// is running
dbusImplHost.setHostPdrObj(hostPDRHandler);
- hostEffecterParser =
- std::make_unique<pldm::host_effecters::HostEffecterParser>(
- &instanceIdDb, pldmTransport.getEventSource(), pdrRepo.get(),
- &dbusHandler, HOST_JSONS_DIR, &reqHandler);
dbusToPLDMEventHandler = std::make_unique<DbusToPLDMEvent>(
pldmTransport.getEventSource(), hostEID, instanceIdDb, &reqHandler);
}