Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 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 | |
Dhruvaraj Subhashchandran | 341d683 | 2021-01-15 06:28:04 -0600 | [diff] [blame] | 9 | namespace openpower |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 10 | { |
| 11 | namespace dump |
| 12 | { |
| 13 | namespace system |
| 14 | { |
| 15 | template <typename T> |
Patrick Williams | 9b18bf2 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 16 | using ServerObject = typename sdbusplus::server::object_t<T>; |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 17 | |
Patrick Williams | 9b18bf2 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 18 | using EntryIfaces = sdbusplus::server::object_t< |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 19 | sdbusplus::xyz::openbmc_project::Dump::Entry::server::System>; |
| 20 | |
Asmitha Karunanithi | 74a1f39 | 2021-10-27 03:23:59 -0500 | [diff] [blame] | 21 | using originatorTypes = sdbusplus::xyz::openbmc_project::Common::server:: |
| 22 | OriginatedBy::OriginatorTypes; |
| 23 | |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 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. |
Dhruvaraj Subhashchandran | a6ab806 | 2020-10-29 15:29:10 -0500 | [diff] [blame] | 48 | * @param[in] sourceId - DumpId provided by the source. |
| 49 | * @param[in] status - status of the dump. |
Asmitha Karunanithi | 74a1f39 | 2021-10-27 03:23:59 -0500 | [diff] [blame] | 50 | * @param[in] originatorId - Id of the originator of the dump |
| 51 | * @param[in] originatorType - Originator type |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 52 | * @param[in] parent - The dump entry's parent. |
| 53 | */ |
Patrick Williams | 9b18bf2 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 54 | Entry(sdbusplus::bus_t& bus, const std::string& objPath, uint32_t dumpId, |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 55 | uint64_t timeStamp, uint64_t dumpSize, const uint32_t sourceId, |
Asmitha Karunanithi | 74a1f39 | 2021-10-27 03:23:59 -0500 | [diff] [blame] | 56 | phosphor::dump::OperationStatus status, std::string originatorId, |
| 57 | originatorTypes originatorType, phosphor::dump::Manager& parent) : |
Patrick Williams | 73f6407 | 2022-04-01 17:04:47 -0500 | [diff] [blame] | 58 | EntryIfaces(bus, objPath.c_str(), EntryIfaces::action::defer_emit), |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 59 | phosphor::dump::Entry(bus, objPath.c_str(), dumpId, timeStamp, dumpSize, |
Dhruvaraj Subhashchandran | 64f8da9 | 2021-12-08 03:48:23 -0600 | [diff] [blame] | 60 | std::string(), status, originatorId, |
| 61 | originatorType, parent) |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 62 | { |
| 63 | sourceDumpId(sourceId); |
Dhruvaraj Subhashchandran | 2f8e276 | 2021-02-11 07:22:35 -0600 | [diff] [blame] | 64 | // Emit deferred signal. |
| 65 | this->openpower::dump::system::EntryIfaces::emit_object_added(); |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 66 | }; |
Dhruvaraj Subhashchandran | 69e6152 | 2020-02-04 06:39:11 -0600 | [diff] [blame] | 67 | |
| 68 | /** @brief Method to initiate the offload of dump |
| 69 | * @param[in] uri - URI to offload dump. |
| 70 | */ |
Dhruvaraj Subhashchandran | 2f8e276 | 2021-02-11 07:22:35 -0600 | [diff] [blame] | 71 | void initiateOffload(std::string uri) override; |
Dhruvaraj Subhashchandran | 6ccb50e | 2020-10-29 09:33:18 -0500 | [diff] [blame] | 72 | |
| 73 | /** @brief Method to update an existing dump entry |
| 74 | * @param[in] timeStamp - Dump creation timestamp |
| 75 | * @param[in] dumpSize - Dump size in bytes. |
| 76 | * @param[in] sourceId - DumpId provided by the source. |
| 77 | */ |
| 78 | void update(uint64_t timeStamp, uint64_t dumpSize, const uint32_t sourceId) |
| 79 | { |
| 80 | elapsed(timeStamp); |
| 81 | size(dumpSize); |
| 82 | sourceDumpId(sourceId); |
Dhruvaraj Subhashchandran | a6ab806 | 2020-10-29 15:29:10 -0500 | [diff] [blame] | 83 | // TODO: Handled dump failure case with |
| 84 | // #bm-openbmc/2808 |
| 85 | status(OperationStatus::Completed); |
| 86 | completedTime(timeStamp); |
Dhruvaraj Subhashchandran | 6ccb50e | 2020-10-29 09:33:18 -0500 | [diff] [blame] | 87 | } |
Ramesh Iyyar | 2279386 | 2020-12-04 04:03:03 -0600 | [diff] [blame] | 88 | |
| 89 | /** |
| 90 | * @brief Delete host system dump and it entry dbus object |
| 91 | */ |
| 92 | void delete_() override; |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 93 | }; |
| 94 | |
| 95 | } // namespace system |
| 96 | } // namespace dump |
Dhruvaraj Subhashchandran | 341d683 | 2021-01-15 06:28:04 -0600 | [diff] [blame] | 97 | } // namespace openpower |