Lei YU | 322f3f4 | 2019-02-21 16:10:41 +0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "item_updater.hpp" |
| 4 | |
Andrew Geissler | ab139ce | 2020-05-16 13:22:09 -0500 | [diff] [blame] | 5 | #include <string> |
| 6 | |
Lei YU | 322f3f4 | 2019-02-21 16:10:41 +0800 | [diff] [blame] | 7 | namespace openpower |
| 8 | { |
| 9 | namespace software |
| 10 | { |
| 11 | namespace updater |
| 12 | { |
| 13 | |
Lei YU | 716de5b | 2019-03-01 16:03:53 +0800 | [diff] [blame] | 14 | class GardResetStatic : public GardReset |
| 15 | { |
| 16 | public: |
| 17 | using GardReset::GardReset; |
| 18 | virtual ~GardResetStatic() = default; |
| 19 | |
| 20 | protected: |
| 21 | /** |
Manojkiran Eda | 96442c8 | 2024-06-17 10:24:05 +0530 | [diff] [blame^] | 22 | * @brief GUARD factory reset - clears the PNOR GUARD partition. |
Lei YU | 716de5b | 2019-03-01 16:03:53 +0800 | [diff] [blame] | 23 | */ |
| 24 | void reset() override; |
| 25 | }; |
| 26 | |
Lei YU | 322f3f4 | 2019-02-21 16:10:41 +0800 | [diff] [blame] | 27 | /** @class ItemUpdaterStatic |
| 28 | * @brief Manages the activation of the host version items for static layout |
| 29 | */ |
| 30 | class ItemUpdaterStatic : public ItemUpdater |
| 31 | { |
| 32 | public: |
Patrick Williams | 0dea199 | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 33 | ItemUpdaterStatic(sdbusplus::bus_t& bus, const std::string& path) : |
Lei YU | 322f3f4 | 2019-02-21 16:10:41 +0800 | [diff] [blame] | 34 | ItemUpdater(bus, path) |
| 35 | { |
| 36 | processPNORImage(); |
Lei YU | 716de5b | 2019-03-01 16:03:53 +0800 | [diff] [blame] | 37 | gardReset = std::make_unique<GardResetStatic>(bus, GARD_PATH); |
Lei YU | 322f3f4 | 2019-02-21 16:10:41 +0800 | [diff] [blame] | 38 | volatileEnable = std::make_unique<ObjectEnable>(bus, volatilePath); |
| 39 | |
| 40 | // Emit deferred signal. |
| 41 | emit_object_added(); |
| 42 | } |
| 43 | virtual ~ItemUpdaterStatic() = default; |
| 44 | |
| 45 | void freePriority(uint8_t value, const std::string& versionId) override; |
| 46 | |
| 47 | void processPNORImage() override; |
| 48 | |
| 49 | void deleteAll() override; |
| 50 | |
Lei YU | 6da3dae | 2019-02-28 14:26:37 +0800 | [diff] [blame] | 51 | bool freeSpace() override; |
Lei YU | 322f3f4 | 2019-02-21 16:10:41 +0800 | [diff] [blame] | 52 | |
Lei YU | a2e6716 | 2019-02-22 17:35:24 +0800 | [diff] [blame] | 53 | void updateFunctionalAssociation(const std::string& versionId) override; |
| 54 | |
Lei YU | 322f3f4 | 2019-02-21 16:10:41 +0800 | [diff] [blame] | 55 | bool isVersionFunctional(const std::string& versionId) override; |
| 56 | |
| 57 | private: |
| 58 | /** @brief Create Activation object */ |
| 59 | std::unique_ptr<Activation> createActivationObject( |
| 60 | const std::string& path, const std::string& versionId, |
| 61 | const std::string& extVersion, |
| 62 | sdbusplus::xyz::openbmc_project::Software::server::Activation:: |
| 63 | Activations activationStatus, |
| 64 | AssociationList& assocs) override; |
| 65 | |
| 66 | /** @brief Create Version object */ |
| 67 | std::unique_ptr<Version> |
| 68 | createVersionObject(const std::string& objPath, |
| 69 | const std::string& versionId, |
| 70 | const std::string& versionString, |
| 71 | sdbusplus::xyz::openbmc_project::Software::server:: |
| 72 | Version::VersionPurpose versionPurpose, |
| 73 | const std::string& filePath) override; |
| 74 | |
| 75 | /** @brief Validate if image is valid or not */ |
| 76 | bool validateImage(const std::string& path); |
| 77 | |
| 78 | /** @brief Host factory reset - clears PNOR partitions for each |
| 79 | * Activation D-Bus object */ |
| 80 | void reset() override; |
Lei YU | a2e6716 | 2019-02-22 17:35:24 +0800 | [diff] [blame] | 81 | |
| 82 | /** @brief The functional version ID */ |
| 83 | std::string functionalVersionId; |
Lei YU | 322f3f4 | 2019-02-21 16:10:41 +0800 | [diff] [blame] | 84 | }; |
| 85 | |
| 86 | } // namespace updater |
| 87 | } // namespace software |
| 88 | } // namespace openpower |