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