diff options
author | Matt Spinler <spinler@us.ibm.com> | 2019-12-16 10:39:32 -0600 |
---|---|---|
committer | Matt Spinler <spinler@us.ibm.com> | 2020-01-27 08:25:12 -0600 |
commit | a34ab72c40382f98ff0d1badf909013ab3a458f5 (patch) | |
tree | 0b61fe093462f667facf9a882d72b28cbd56b7e4 /extensions/openpower-pels/manager.hpp | |
parent | 17ed2ed18c774878f20fed3cf033f900794827ed (diff) | |
download | phosphor-logging-a34ab72c40382f98ff0d1badf909013ab3a458f5.tar.gz phosphor-logging-a34ab72c40382f98ff0d1badf909013ab3a458f5.zip |
PEL: Add PEL D-Bus methods
Implement the org.open_power.Logging.PEL D-Bus interface on
/xyz/openbmc_project/logging.
It provides the following methods:
* getPEL - Return a unix FD to the PEL data based on the PEL id.
* getPELFromOBMCID - Return PEL data in a vector based on the
corresponding OpenBMC event log id.
* hostAck - Called when the host has sent the PEL up to the OS,
which is the final step in the reporting process.
* hostReject - Called when the host has an issue with a PEL, either:
- The host doesn't have any more room for PELs at this moment.
- The PEL was malformed.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I633ae9e26d8336973363a1a207e8fd493f7ff7d2
Diffstat (limited to 'extensions/openpower-pels/manager.hpp')
-rw-r--r-- | extensions/openpower-pels/manager.hpp | 65 |
1 files changed, 62 insertions, 3 deletions
diff --git a/extensions/openpower-pels/manager.hpp b/extensions/openpower-pels/manager.hpp index 731dd16..7f1fcda 100644 --- a/extensions/openpower-pels/manager.hpp +++ b/extensions/openpower-pels/manager.hpp @@ -1,5 +1,7 @@ #pragma once +#include "config.h" + #include "data_interface.hpp" #include "host_notifier.hpp" #include "log_manager.hpp" @@ -7,15 +9,21 @@ #include "registry.hpp" #include "repository.hpp" +#include <org/open_power/Logging/PEL/server.hpp> +#include <sdbusplus/server.hpp> + namespace openpower { namespace pels { +using PELInterface = sdbusplus::server::object::object< + sdbusplus::org::open_power::Logging::server::PEL>; + /** * @brief PEL manager object */ -class Manager +class Manager : public PELInterface { public: Manager() = delete; @@ -33,8 +41,8 @@ class Manager */ Manager(phosphor::logging::internal::Manager& logManager, std::unique_ptr<DataInterfaceBase> dataIface) : - _logManager(logManager), - _repo(getPELRepoPath()), + PELInterface(logManager.getBus(), OBJ_LOGGING), + _logManager(logManager), _repo(getPELRepoPath()), _registry(getMessageRegistryPath() / message::registryFileName), _dataIface(std::move(dataIface)) { @@ -91,6 +99,57 @@ class Manager */ bool isDeleteProhibited(uint32_t obmcLogID); + /** + * @brief Return a file descriptor to the raw PEL data + * + * Throws InvalidArgument if the PEL ID isn't found, + * and InternalFailure if anything else fails. + * + * @param[in] pelID - The PEL ID to get the data for + * + * @return unix_fd - File descriptor to the file that contains the PEL + */ + sdbusplus::message::unix_fd getPEL(uint32_t pelID) override; + + /** + * @brief Returns data for the PEL corresponding to an OpenBMC + * event log. + * + * @param[in] obmcLogID - The OpenBMC event log ID + * + * @return vector<uint8_t> - The raw PEL data + */ + std::vector<uint8_t> getPELFromOBMCID(uint32_t obmcLogID) override; + + /** + * @brief The D-Bus method called when a host successfully processes + * a PEL. + * + * This D-Bus method is called from the PLDM daemon when they get an + * 'Ack PEL' PLDM message from the host, which indicates the host + * firmware successfully sent it to the OS and this code doesn't need + * to send it to the host again. + * + * @param[in] pelID - The PEL ID + */ + void hostAck(uint32_t pelID) override; + + /** + * @brief D-Bus method called when the host rejects a PEL. + * + * This D-Bus method is called from the PLDM daemon when they get an + * 'Ack PEL' PLDM message from the host with a payload that says + * something when wrong. + * + * The choices are either: + * * Host Full - The host's staging area is full - try again later + * * Malrformed PEL - The host received an invalid PEL + * + * @param[in] pelID - The PEL ID + * @param[in] reason - One of the above two reasons + */ + void hostReject(uint32_t pelID, RejectionReason reason) override; + private: /** * @brief Adds a received raw PEL to the PEL repository |