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 | |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 21 | class Manager; |
| 22 | |
| 23 | /** @class Entry |
| 24 | * @brief System Dump Entry implementation. |
| 25 | * @details A concrete implementation for the |
| 26 | * xyz.openbmc_project.Dump.Entry DBus API |
| 27 | */ |
| 28 | class Entry : virtual public EntryIfaces, virtual public phosphor::dump::Entry |
| 29 | { |
| 30 | public: |
| 31 | Entry() = delete; |
| 32 | Entry(const Entry&) = delete; |
| 33 | Entry& operator=(const Entry&) = delete; |
| 34 | Entry(Entry&&) = delete; |
| 35 | Entry& operator=(Entry&&) = delete; |
| 36 | ~Entry() = default; |
| 37 | |
| 38 | /** @brief Constructor for the Dump Entry Object |
| 39 | * @param[in] bus - Bus to attach to. |
| 40 | * @param[in] objPath - Object path to attach to |
| 41 | * @param[in] dumpId - Dump id. |
| 42 | * @param[in] timeStamp - Dump creation timestamp |
| 43 | * since the epoch. |
| 44 | * @param[in] dumpSize - Dump size in bytes. |
Dhruvaraj Subhashchandran | a6ab806 | 2020-10-29 15:29:10 -0500 | [diff] [blame] | 45 | * @param[in] sourceId - DumpId provided by the source. |
| 46 | * @param[in] status - status of the dump. |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 47 | * @param[in] parent - The dump entry's parent. |
| 48 | */ |
Patrick Williams | 9b18bf2 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 49 | Entry(sdbusplus::bus_t& bus, const std::string& objPath, uint32_t dumpId, |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 50 | uint64_t timeStamp, uint64_t dumpSize, const uint32_t sourceId, |
Dhruvaraj Subhashchandran | a6ab806 | 2020-10-29 15:29:10 -0500 | [diff] [blame] | 51 | phosphor::dump::OperationStatus status, |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 52 | phosphor::dump::Manager& parent) : |
Patrick Williams | 73f6407 | 2022-04-01 17:04:47 -0500 | [diff] [blame] | 53 | EntryIfaces(bus, objPath.c_str(), EntryIfaces::action::defer_emit), |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 54 | phosphor::dump::Entry(bus, objPath.c_str(), dumpId, timeStamp, dumpSize, |
Dhruvaraj Subhashchandran | a6ab806 | 2020-10-29 15:29:10 -0500 | [diff] [blame] | 55 | status, parent) |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 56 | { |
| 57 | sourceDumpId(sourceId); |
Dhruvaraj Subhashchandran | 2f8e276 | 2021-02-11 07:22:35 -0600 | [diff] [blame] | 58 | // Emit deferred signal. |
| 59 | this->openpower::dump::system::EntryIfaces::emit_object_added(); |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 60 | }; |
Dhruvaraj Subhashchandran | 69e6152 | 2020-02-04 06:39:11 -0600 | [diff] [blame] | 61 | |
| 62 | /** @brief Method to initiate the offload of dump |
| 63 | * @param[in] uri - URI to offload dump. |
| 64 | */ |
Dhruvaraj Subhashchandran | 2f8e276 | 2021-02-11 07:22:35 -0600 | [diff] [blame] | 65 | void initiateOffload(std::string uri) override; |
Dhruvaraj Subhashchandran | 6ccb50e | 2020-10-29 09:33:18 -0500 | [diff] [blame] | 66 | |
| 67 | /** @brief Method to update an existing dump entry |
| 68 | * @param[in] timeStamp - Dump creation timestamp |
| 69 | * @param[in] dumpSize - Dump size in bytes. |
| 70 | * @param[in] sourceId - DumpId provided by the source. |
| 71 | */ |
| 72 | void update(uint64_t timeStamp, uint64_t dumpSize, const uint32_t sourceId) |
| 73 | { |
| 74 | elapsed(timeStamp); |
| 75 | size(dumpSize); |
| 76 | sourceDumpId(sourceId); |
Dhruvaraj Subhashchandran | a6ab806 | 2020-10-29 15:29:10 -0500 | [diff] [blame] | 77 | // TODO: Handled dump failure case with |
| 78 | // #bm-openbmc/2808 |
| 79 | status(OperationStatus::Completed); |
| 80 | completedTime(timeStamp); |
Dhruvaraj Subhashchandran | 6ccb50e | 2020-10-29 09:33:18 -0500 | [diff] [blame] | 81 | } |
Ramesh Iyyar | 2279386 | 2020-12-04 04:03:03 -0600 | [diff] [blame] | 82 | |
| 83 | /** |
| 84 | * @brief Delete host system dump and it entry dbus object |
| 85 | */ |
| 86 | void delete_() override; |
Dhruvaraj Subhashchandran | f140f66 | 2020-01-30 00:29:01 -0600 | [diff] [blame] | 87 | }; |
| 88 | |
| 89 | } // namespace system |
| 90 | } // namespace dump |
Dhruvaraj Subhashchandran | 341d683 | 2021-01-15 06:28:04 -0600 | [diff] [blame] | 91 | } // namespace openpower |