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