1 #pragma once 2 3 #include "dump_entry.hpp" 4 #include "xyz/openbmc_project/Dump/Entry/System/server.hpp" 5 6 #include <sdbusplus/bus.hpp> 7 #include <sdbusplus/server/object.hpp> 8 9 namespace openpower 10 { 11 namespace dump 12 { 13 namespace system 14 { 15 template <typename T> 16 using ServerObject = typename sdbusplus::server::object_t<T>; 17 18 using EntryIfaces = sdbusplus::server::object_t< 19 sdbusplus::xyz::openbmc_project::Dump::Entry::server::System>; 20 21 using originatorTypes = sdbusplus::xyz::openbmc_project::Common::server:: 22 OriginatedBy::OriginatorTypes; 23 24 class Manager; 25 26 /** @class Entry 27 * @brief System Dump Entry implementation. 28 * @details A concrete implementation for the 29 * xyz.openbmc_project.Dump.Entry DBus API 30 */ 31 class Entry : virtual public EntryIfaces, virtual public phosphor::dump::Entry 32 { 33 public: 34 Entry() = delete; 35 Entry(const Entry&) = delete; 36 Entry& operator=(const Entry&) = delete; 37 Entry(Entry&&) = delete; 38 Entry& operator=(Entry&&) = delete; 39 ~Entry() = default; 40 41 /** @brief Constructor for the Dump Entry Object 42 * @param[in] bus - Bus to attach to. 43 * @param[in] objPath - Object path to attach to 44 * @param[in] dumpId - Dump id. 45 * @param[in] timeStamp - Dump creation timestamp 46 * since the epoch. 47 * @param[in] dumpSize - Dump size in bytes. 48 * @param[in] sourceId - DumpId provided by the source. 49 * @param[in] status - status of the dump. 50 * @param[in] originatorId - Id of the originator of the dump 51 * @param[in] originatorType - Originator type 52 * @param[in] parent - The dump entry's parent. 53 */ 54 Entry(sdbusplus::bus_t& bus, const std::string& objPath, uint32_t dumpId, 55 uint64_t timeStamp, uint64_t dumpSize, const uint32_t sourceId, 56 phosphor::dump::OperationStatus status, std::string originatorId, 57 originatorTypes originatorType, phosphor::dump::Manager& parent) : 58 EntryIfaces(bus, objPath.c_str(), EntryIfaces::action::defer_emit), 59 phosphor::dump::Entry(bus, objPath.c_str(), dumpId, timeStamp, dumpSize, 60 status, originatorId, originatorType, parent) 61 { 62 sourceDumpId(sourceId); 63 // Emit deferred signal. 64 this->openpower::dump::system::EntryIfaces::emit_object_added(); 65 }; 66 67 /** @brief Method to initiate the offload of dump 68 * @param[in] uri - URI to offload dump. 69 */ 70 void initiateOffload(std::string uri) override; 71 72 /** @brief Method to update an existing dump entry 73 * @param[in] timeStamp - Dump creation timestamp 74 * @param[in] dumpSize - Dump size in bytes. 75 * @param[in] sourceId - DumpId provided by the source. 76 */ 77 void update(uint64_t timeStamp, uint64_t dumpSize, const uint32_t sourceId) 78 { 79 elapsed(timeStamp); 80 size(dumpSize); 81 sourceDumpId(sourceId); 82 // TODO: Handled dump failure case with 83 // #bm-openbmc/2808 84 status(OperationStatus::Completed); 85 completedTime(timeStamp); 86 } 87 88 /** 89 * @brief Delete host system dump and it entry dbus object 90 */ 91 void delete_() override; 92 }; 93 94 } // namespace system 95 } // namespace dump 96 } // namespace openpower 97