Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 3 | #include "config.h" |
| 4 | |
| 5 | #include "flash.hpp" |
Jayashankar Padath | a013560 | 2019-04-22 16:22:58 +0530 | [diff] [blame] | 6 | #include "utils.hpp" |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 7 | #include "xyz/openbmc_project/Software/ActivationProgress/server.hpp" |
| 8 | #include "xyz/openbmc_project/Software/RedundancyPriority/server.hpp" |
| 9 | |
Jagpal Singh Gill | 6397c09 | 2025-07-16 21:18:00 -0700 | [diff] [blame] | 10 | #include <sdbusplus/async.hpp> |
Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 11 | #include <sdbusplus/server.hpp> |
John Wang | 85c356f | 2019-09-11 16:20:13 +0800 | [diff] [blame] | 12 | #include <xyz/openbmc_project/Association/Definitions/server.hpp> |
Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 13 | #include <xyz/openbmc_project/Software/Activation/server.hpp> |
Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 14 | #include <xyz/openbmc_project/Software/ActivationBlocksTransition/server.hpp> |
Jagpal Singh Gill | bb024eb | 2024-04-07 23:34:00 -0700 | [diff] [blame] | 15 | #include <xyz/openbmc_project/Software/ApplyTime/common.hpp> |
Lei YU | 9053225 | 2018-05-24 11:15:24 +0800 | [diff] [blame] | 16 | |
| 17 | #ifdef WANT_SIGNATURE_VERIFY |
Adriana Kobylak | c98d912 | 2020-05-05 10:36:01 -0500 | [diff] [blame] | 18 | #include <filesystem> |
Lei YU | 9053225 | 2018-05-24 11:15:24 +0800 | [diff] [blame] | 19 | #endif |
| 20 | |
Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 21 | namespace phosphor |
| 22 | { |
| 23 | namespace software |
| 24 | { |
| 25 | namespace updater |
| 26 | { |
| 27 | |
Lei YU | 9053225 | 2018-05-24 11:15:24 +0800 | [diff] [blame] | 28 | #ifdef WANT_SIGNATURE_VERIFY |
Adriana Kobylak | c98d912 | 2020-05-05 10:36:01 -0500 | [diff] [blame] | 29 | namespace fs = std::filesystem; |
Lei YU | 9053225 | 2018-05-24 11:15:24 +0800 | [diff] [blame] | 30 | #endif |
| 31 | |
Gunnar Mills | b60add1 | 2017-08-24 16:41:42 -0500 | [diff] [blame] | 32 | using AssociationList = |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 33 | std::vector<std::tuple<std::string, std::string, std::string>>; |
Patrick Williams | bf2bb2b | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 34 | using ActivationInherit = sdbusplus::server::object_t< |
Patrick Williams | 1e9a5f1 | 2023-08-23 16:53:06 -0500 | [diff] [blame] | 35 | sdbusplus::server::xyz::openbmc_project::software::Activation, |
| 36 | sdbusplus::server::xyz::openbmc_project::association::Definitions>; |
Patrick Williams | bf2bb2b | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 37 | using ActivationBlocksTransitionInherit = |
Adriana Kobylak | ce82de5 | 2024-01-16 13:56:38 -0600 | [diff] [blame] | 38 | sdbusplus::server::object_t<sdbusplus::server::xyz::openbmc_project:: |
| 39 | software::ActivationBlocksTransition>; |
Patrick Williams | bf2bb2b | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 40 | using RedundancyPriorityInherit = sdbusplus::server::object_t< |
Patrick Williams | 1e9a5f1 | 2023-08-23 16:53:06 -0500 | [diff] [blame] | 41 | sdbusplus::server::xyz::openbmc_project::software::RedundancyPriority>; |
Patrick Williams | bf2bb2b | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 42 | using ActivationProgressInherit = sdbusplus::server::object_t< |
Patrick Williams | 1e9a5f1 | 2023-08-23 16:53:06 -0500 | [diff] [blame] | 43 | sdbusplus::server::xyz::openbmc_project::software::ActivationProgress>; |
Jagpal Singh Gill | bb024eb | 2024-04-07 23:34:00 -0700 | [diff] [blame] | 44 | using ApplyTimeIntf = |
| 45 | sdbusplus::common::xyz::openbmc_project::software::ApplyTime; |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame] | 46 | |
Jayashankar Padath | a013560 | 2019-04-22 16:22:58 +0530 | [diff] [blame] | 47 | constexpr auto applyTimeImmediate = |
| 48 | "xyz.openbmc_project.Software.ApplyTime.RequestedApplyTimes.Immediate"; |
| 49 | constexpr auto applyTimeIntf = "xyz.openbmc_project.Software.ApplyTime"; |
| 50 | constexpr auto dbusPropIntf = "org.freedesktop.DBus.Properties"; |
| 51 | constexpr auto applyTimeObjPath = "/xyz/openbmc_project/software/apply_time"; |
| 52 | constexpr auto applyTimeProp = "RequestedApplyTime"; |
| 53 | |
Michael Tritz | bed88af | 2017-07-19 16:00:06 -0500 | [diff] [blame] | 54 | namespace sdbusRule = sdbusplus::bus::match::rules; |
| 55 | |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame] | 56 | class ItemUpdater; |
| 57 | class Activation; |
| 58 | class RedundancyPriority; |
| 59 | |
| 60 | /** @class RedundancyPriority |
| 61 | * @brief OpenBMC RedundancyPriority implementation |
| 62 | * @details A concrete implementation for |
| 63 | * xyz.openbmc_project.Software.RedundancyPriority DBus API. |
| 64 | */ |
| 65 | class RedundancyPriority : public RedundancyPriorityInherit |
| 66 | { |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 67 | public: |
| 68 | /** @brief Constructs RedundancyPriority. |
| 69 | * |
| 70 | * @param[in] bus - The Dbus bus object |
| 71 | * @param[in] path - The Dbus object path |
| 72 | * @param[in] parent - Parent object. |
| 73 | * @param[in] value - The redundancyPriority value |
| 74 | * @param[in] freePriority - Call freePriorioty, default to true |
| 75 | */ |
Patrick Williams | bf2bb2b | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 76 | RedundancyPriority(sdbusplus::bus_t& bus, const std::string& path, |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 77 | Activation& parent, uint8_t value, |
| 78 | bool freePriority = true) : |
Lei YU | 29d84b0 | 2020-02-13 15:13:09 +0800 | [diff] [blame] | 79 | RedundancyPriorityInherit(bus, path.c_str(), |
| 80 | action::emit_interface_added), |
| 81 | parent(parent) |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 82 | { |
| 83 | // Set Property |
| 84 | if (freePriority) |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame] | 85 | { |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 86 | priority(value); |
| 87 | } |
| 88 | else |
| 89 | { |
| 90 | sdbusPriority(value); |
Saqib Khan | 140fcb1 | 2017-08-07 09:06:57 -0500 | [diff] [blame] | 91 | } |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 92 | } |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame] | 93 | |
Gunnar Mills | e11a202 | 2018-03-23 12:04:48 -0500 | [diff] [blame] | 94 | /** @brief Overridden Priority property set function, calls freePriority |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 95 | * to bump the duplicated priority values. |
| 96 | * |
| 97 | * @param[in] value - uint8_t |
| 98 | * |
| 99 | * @return Success or exception thrown |
| 100 | */ |
| 101 | uint8_t priority(uint8_t value) override; |
Adriana Kobylak | b77551c | 2017-10-27 12:46:23 -0500 | [diff] [blame] | 102 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 103 | /** @brief Non-Overriden Priority property set function |
| 104 | * |
| 105 | * @param[in] value - uint8_t |
| 106 | * |
| 107 | * @return Success or exception thrown |
| 108 | */ |
| 109 | uint8_t sdbusPriority(uint8_t value); |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame] | 110 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 111 | /** @brief Priority property get function |
| 112 | * |
| 113 | * @returns uint8_t - The Priority value |
| 114 | */ |
| 115 | using RedundancyPriorityInherit::priority; |
Saqib Khan | 140fcb1 | 2017-08-07 09:06:57 -0500 | [diff] [blame] | 116 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 117 | /** @brief Parent Object. */ |
| 118 | Activation& parent; |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame] | 119 | }; |
Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 120 | |
| 121 | /** @class ActivationBlocksTransition |
| 122 | * @brief OpenBMC ActivationBlocksTransition implementation. |
| 123 | * @details A concrete implementation for |
| 124 | * xyz.openbmc_project.Software.ActivationBlocksTransition DBus API. |
| 125 | */ |
| 126 | class ActivationBlocksTransition : public ActivationBlocksTransitionInherit |
| 127 | { |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 128 | public: |
| 129 | /** @brief Constructs ActivationBlocksTransition. |
| 130 | * |
| 131 | * @param[in] bus - The Dbus bus object |
| 132 | * @param[in] path - The Dbus object path |
| 133 | */ |
Patrick Williams | bf2bb2b | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 134 | ActivationBlocksTransition(sdbusplus::bus_t& bus, const std::string& path) : |
Lei YU | 29d84b0 | 2020-02-13 15:13:09 +0800 | [diff] [blame] | 135 | ActivationBlocksTransitionInherit(bus, path.c_str(), |
| 136 | action::emit_interface_added), |
| 137 | bus(bus) |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 138 | { |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 139 | enableRebootGuard(); |
| 140 | } |
Saqib Khan | 140fcb1 | 2017-08-07 09:06:57 -0500 | [diff] [blame] | 141 | |
Pavithra Barithaya | 272bc1c | 2024-06-22 06:46:35 -0500 | [diff] [blame] | 142 | ~ActivationBlocksTransition() override |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 143 | { |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 144 | disableRebootGuard(); |
| 145 | } |
Saqib Khan | 140fcb1 | 2017-08-07 09:06:57 -0500 | [diff] [blame] | 146 | |
Pavithra Barithaya | 48de55f | 2024-06-22 05:30:44 -0500 | [diff] [blame] | 147 | ActivationBlocksTransition(const ActivationBlocksTransition&) = delete; |
Patrick Williams | eae5ec9 | 2025-02-01 08:21:45 -0500 | [diff] [blame] | 148 | ActivationBlocksTransition& operator=(const ActivationBlocksTransition&) = |
| 149 | delete; |
Pavithra Barithaya | 48de55f | 2024-06-22 05:30:44 -0500 | [diff] [blame] | 150 | ActivationBlocksTransition(ActivationBlocksTransition&&) = delete; |
Patrick Williams | eae5ec9 | 2025-02-01 08:21:45 -0500 | [diff] [blame] | 151 | ActivationBlocksTransition& operator=(ActivationBlocksTransition&&) = |
| 152 | delete; |
Pavithra Barithaya | 48de55f | 2024-06-22 05:30:44 -0500 | [diff] [blame] | 153 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 154 | private: |
Patrick Williams | bf2bb2b | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 155 | sdbusplus::bus_t& bus; |
Saqib Khan | f37cefc | 2017-09-12 08:44:41 -0500 | [diff] [blame] | 156 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 157 | /** @brief Enables a Guard that blocks any BMC reboot commands */ |
| 158 | void enableRebootGuard(); |
Saqib Khan | f37cefc | 2017-09-12 08:44:41 -0500 | [diff] [blame] | 159 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 160 | /** @brief Disables any guard that was blocking the BMC reboot */ |
| 161 | void disableRebootGuard(); |
Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 162 | }; |
Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 163 | |
Michael Tritz | 0edd4ad | 2017-07-26 14:27:42 -0500 | [diff] [blame] | 164 | class ActivationProgress : public ActivationProgressInherit |
| 165 | { |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 166 | public: |
| 167 | /** @brief Constructs ActivationProgress. |
| 168 | * |
| 169 | * @param[in] bus - The Dbus bus object |
| 170 | * @param[in] path - The Dbus object path |
| 171 | */ |
Patrick Williams | bf2bb2b | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 172 | ActivationProgress(sdbusplus::bus_t& bus, const std::string& path) : |
Lei YU | 29d84b0 | 2020-02-13 15:13:09 +0800 | [diff] [blame] | 173 | ActivationProgressInherit(bus, path.c_str(), |
| 174 | action::emit_interface_added) |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 175 | { |
| 176 | progress(0); |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 177 | } |
Michael Tritz | 0edd4ad | 2017-07-26 14:27:42 -0500 | [diff] [blame] | 178 | }; |
| 179 | |
Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 180 | /** @class Activation |
| 181 | * @brief OpenBMC activation software management implementation. |
| 182 | * @details A concrete implementation for |
| 183 | * xyz.openbmc_project.Software.Activation DBus API. |
| 184 | */ |
Lei YU | 1be8d50 | 2018-06-20 11:48:36 +0800 | [diff] [blame] | 185 | class Activation : public ActivationInherit, public Flash |
Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 186 | { |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 187 | public: |
| 188 | /** @brief Constructs Activation Software Manager |
| 189 | * |
| 190 | * @param[in] bus - The Dbus bus object |
| 191 | * @param[in] path - The Dbus object path |
| 192 | * @param[in] parent - Parent object. |
| 193 | * @param[in] versionId - The software version id |
| 194 | * @param[in] activationStatus - The status of Activation |
| 195 | * @param[in] assocs - Association objects |
| 196 | */ |
Jagpal Singh Gill | 6397c09 | 2025-07-16 21:18:00 -0700 | [diff] [blame] | 197 | Activation(sdbusplus::async::context& ctx, const std::string& path, |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 198 | ItemUpdater& parent, std::string& versionId, |
Patrick Williams | 1e9a5f1 | 2023-08-23 16:53:06 -0500 | [diff] [blame] | 199 | sdbusplus::server::xyz::openbmc_project::software::Activation:: |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 200 | Activations activationStatus, |
| 201 | AssociationList& assocs) : |
Jagpal Singh Gill | 6397c09 | 2025-07-16 21:18:00 -0700 | [diff] [blame] | 202 | ActivationInherit(ctx.get_bus(), path.c_str(), |
Patrick Williams | 35aa9a8 | 2022-04-05 15:55:30 -0500 | [diff] [blame] | 203 | ActivationInherit::action::defer_emit), |
Jagpal Singh Gill | 6397c09 | 2025-07-16 21:18:00 -0700 | [diff] [blame] | 204 | ctx(ctx), bus(ctx.get_bus()), path(path), parent(parent), |
| 205 | versionId(versionId), |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 206 | systemdSignals( |
| 207 | bus, |
| 208 | sdbusRule::type::signal() + sdbusRule::member("JobRemoved") + |
| 209 | sdbusRule::path("/org/freedesktop/systemd1") + |
| 210 | sdbusRule::interface("org.freedesktop.systemd1.Manager"), |
| 211 | std::bind(std::mem_fn(&Activation::unitStateChange), this, |
| 212 | std::placeholders::_1)) |
| 213 | { |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 214 | // Set Properties. |
| 215 | activation(activationStatus); |
| 216 | associations(assocs); |
Gunnar Mills | b60add1 | 2017-08-24 16:41:42 -0500 | [diff] [blame] | 217 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 218 | // Emit deferred signal. |
| 219 | emit_object_added(); |
| 220 | } |
Gunnar Mills | 2ce7da2 | 2017-05-04 15:37:56 -0500 | [diff] [blame] | 221 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 222 | /** @brief Overloaded Activation property setter function |
| 223 | * |
| 224 | * @param[in] value - One of Activation::Activations |
| 225 | * |
| 226 | * @return Success or exception thrown |
| 227 | */ |
| 228 | Activations activation(Activations value) override; |
Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 229 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 230 | /** @brief Activation */ |
| 231 | using ActivationInherit::activation; |
Leonel Gonzalez | e423368 | 2017-07-07 14:38:25 -0500 | [diff] [blame] | 232 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 233 | /** @brief Overloaded requestedActivation property setter function |
| 234 | * |
| 235 | * @param[in] value - One of Activation::RequestedActivations |
| 236 | * |
| 237 | * @return Success or exception thrown |
| 238 | */ |
Patrick Williams | eae5ec9 | 2025-02-01 08:21:45 -0500 | [diff] [blame] | 239 | RequestedActivations requestedActivation( |
| 240 | RequestedActivations value) override; |
Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 241 | |
Adriana Kobylak | 9f89e2e | 2018-05-30 13:16:20 -0500 | [diff] [blame] | 242 | /** @brief Overloaded write flash function */ |
| 243 | void flashWrite() override; |
| 244 | |
Adriana Kobylak | b824b2f | 2020-05-14 14:57:53 -0500 | [diff] [blame] | 245 | /** |
| 246 | * @brief Handle the success of the flashWrite() function |
| 247 | * |
| 248 | * @details Perform anything that is necessary to mark the activation |
| 249 | * successful after the image has been written to flash. Sets the Activation |
| 250 | * value to Active. |
| 251 | */ |
| 252 | void onFlashWriteSuccess(); |
| 253 | |
Vijay Khemka | e9f6c84 | 2020-01-14 14:32:39 -0800 | [diff] [blame] | 254 | #ifdef HOST_BIOS_UPGRADE |
| 255 | /* @brief write to Host flash function */ |
| 256 | void flashWriteHost(); |
| 257 | |
| 258 | /** @brief Function that acts on Bios upgrade service file state changes */ |
Pavithra Barithaya | f9a6925 | 2024-06-25 00:35:36 -0500 | [diff] [blame] | 259 | void onStateChangesBios(sdbusplus::message_t& /*msg*/); |
Vijay Khemka | e9f6c84 | 2020-01-14 14:32:39 -0800 | [diff] [blame] | 260 | #endif |
| 261 | |
Adriana Kobylak | 3ce563a | 2018-06-06 16:41:15 -0500 | [diff] [blame] | 262 | /** @brief Overloaded function that acts on service file state changes */ |
Pavithra Barithaya | f9a6925 | 2024-06-25 00:35:36 -0500 | [diff] [blame] | 263 | void onStateChanges(sdbusplus::message_t& /*msg*/) override; |
Adriana Kobylak | 3ce563a | 2018-06-06 16:41:15 -0500 | [diff] [blame] | 264 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 265 | /** @brief Check if systemd state change is relevant to this object |
| 266 | * |
| 267 | * Instance specific interface to handle the detected systemd state |
| 268 | * change |
| 269 | * |
| 270 | * @param[in] msg - Data associated with subscribed signal |
| 271 | * |
| 272 | */ |
Patrick Williams | bf2bb2b | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 273 | void unitStateChange(sdbusplus::message_t& msg); |
Michael Tritz | bed88af | 2017-07-19 16:00:06 -0500 | [diff] [blame] | 274 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 275 | /** |
| 276 | * @brief subscribe to the systemd signals |
| 277 | * |
| 278 | * This object needs to capture when it's systemd targets complete |
| 279 | * so it can keep it's state updated |
| 280 | * |
| 281 | */ |
| 282 | void subscribeToSystemdSignals(); |
Michael Tritz | bed88af | 2017-07-19 16:00:06 -0500 | [diff] [blame] | 283 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 284 | /** |
| 285 | * @brief unsubscribe from the systemd signals |
| 286 | * |
| 287 | * systemd signals are only of interest during the activation process. |
| 288 | * Once complete, we want to unsubscribe to avoid unnecessary calls of |
| 289 | * unitStateChange(). |
| 290 | * |
| 291 | */ |
| 292 | void unsubscribeFromSystemdSignals(); |
Michael Tritz | f2b5e0d | 2017-07-25 14:39:34 -0500 | [diff] [blame] | 293 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 294 | /** |
| 295 | * @brief Deletes the version from Image Manager and the |
| 296 | * untar image from image upload dir. |
| 297 | */ |
| 298 | void deleteImageManagerObject(); |
Saqib Khan | ee13e83 | 2017-10-23 12:53:11 -0500 | [diff] [blame] | 299 | |
Jayashankar Padath | a013560 | 2019-04-22 16:22:58 +0530 | [diff] [blame] | 300 | /** |
| 301 | * @brief Determine the configured image apply time value |
| 302 | * |
| 303 | * @return true if the image apply time value is immediate |
| 304 | **/ |
| 305 | bool checkApplyTimeImmediate(); |
| 306 | |
| 307 | /** |
| 308 | * @brief Reboot the BMC. Called when ApplyTime is immediate. |
| 309 | * |
| 310 | * @return none |
| 311 | **/ |
| 312 | void rebootBmc(); |
| 313 | |
Jagpal Singh Gill | 6397c09 | 2025-07-16 21:18:00 -0700 | [diff] [blame] | 314 | /** @brief D-Bus context */ |
| 315 | sdbusplus::async::context& ctx; |
| 316 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 317 | /** @brief Persistent sdbusplus DBus bus connection */ |
Patrick Williams | bf2bb2b | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 318 | sdbusplus::bus_t& bus; |
Gunnar Mills | 2ce7da2 | 2017-05-04 15:37:56 -0500 | [diff] [blame] | 319 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 320 | /** @brief Persistent DBus object path */ |
| 321 | std::string path; |
Gunnar Mills | 2ce7da2 | 2017-05-04 15:37:56 -0500 | [diff] [blame] | 322 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 323 | /** @brief Parent Object. */ |
| 324 | ItemUpdater& parent; |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame] | 325 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 326 | /** @brief Version id */ |
| 327 | std::string versionId; |
Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 328 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 329 | /** @brief Persistent ActivationBlocksTransition dbus object */ |
| 330 | std::unique_ptr<ActivationBlocksTransition> activationBlocksTransition; |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame] | 331 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 332 | /** @brief Persistent RedundancyPriority dbus object */ |
| 333 | std::unique_ptr<RedundancyPriority> redundancyPriority; |
Michael Tritz | bed88af | 2017-07-19 16:00:06 -0500 | [diff] [blame] | 334 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 335 | /** @brief Persistent ActivationProgress dbus object */ |
| 336 | std::unique_ptr<ActivationProgress> activationProgress; |
Michael Tritz | 0edd4ad | 2017-07-26 14:27:42 -0500 | [diff] [blame] | 337 | |
Jagpal Singh Gill | bb024eb | 2024-04-07 23:34:00 -0700 | [diff] [blame] | 338 | /** @brief Apply time */ |
| 339 | ApplyTimeIntf::RequestedApplyTimes applyTime; |
| 340 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 341 | /** @brief Used to subscribe to dbus systemd signals **/ |
| 342 | sdbusplus::bus::match_t systemdSignals; |
Michael Tritz | bed88af | 2017-07-19 16:00:06 -0500 | [diff] [blame] | 343 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 344 | /** @brief Tracks whether the read-write volume has been created as |
| 345 | * part of the activation process. **/ |
| 346 | bool rwVolumeCreated = false; |
Michael Tritz | bed88af | 2017-07-19 16:00:06 -0500 | [diff] [blame] | 347 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 348 | /** @brief Tracks whether the read-only volume has been created as |
| 349 | * part of the activation process. **/ |
| 350 | bool roVolumeCreated = false; |
Adriana Kobylak | 166bdf3 | 2018-04-09 14:24:06 -0500 | [diff] [blame] | 351 | |
| 352 | /** @brief Tracks if the service that updates the U-Boot environment |
| 353 | * variables has completed. **/ |
| 354 | bool ubootEnvVarsUpdated = false; |
Lei YU | 9053225 | 2018-05-24 11:15:24 +0800 | [diff] [blame] | 355 | |
| 356 | #ifdef WANT_SIGNATURE_VERIFY |
| 357 | private: |
| 358 | /** @brief Verify signature of the images. |
| 359 | * |
| 360 | * @param[in] imageDir - The path of images to verify |
| 361 | * @param[in] confDir - The path of configs for verification |
| 362 | * |
| 363 | * @return true if verification successful and false otherwise |
| 364 | */ |
Pavithra Barithaya | c5f6e7e | 2024-06-24 09:50:21 -0500 | [diff] [blame] | 365 | static bool verifySignature(const fs::path& imageDir, |
| 366 | const fs::path& confDir); |
Lei YU | 9053225 | 2018-05-24 11:15:24 +0800 | [diff] [blame] | 367 | |
| 368 | /** @brief Called when image verification fails. */ |
| 369 | void onVerifyFailed(); |
| 370 | #endif |
Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 371 | }; |
| 372 | |
| 373 | } // namespace updater |
| 374 | } // namespace software |
| 375 | } // namespace phosphor |