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