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 /** 19 * @brief GUARD factory reset - clears the PNOR GUARD partition. 20 */ 21 void reset() override; 22 23 private: 24 /** 25 * @brief During host factory reset, host clears the guard records in the 26 * guard partition. BMC is not notified about host factory reset so 27 * it continues to disable the guarded items. Now modified to enable 28 * back CpuCore and DIMM items during factory reset. 29 */ 30 void enableInventoryItems(); 31 32 /** 33 * @brief Helper function to set enable flag for all the subtree objects 34 * implementing the specified interface. 35 * 36 * @param[in] - service D-Bus service name 37 * @param[in] - intf find objects that implement this interface 38 * @param[in] - objPath find subtree objects from this object path 39 * @return none 40 */ 41 void enableInventoryItemsHelper(const std::string& service, 42 const std::string& intf, 43 const std::string& objPath); 44 }; 45 46 /** @class ItemUpdaterMMC 47 * @brief Manages the activation of the host version items for static layout 48 */ 49 class ItemUpdaterMMC : public ItemUpdater 50 { 51 public: ItemUpdaterMMC(sdbusplus::bus_t & bus,const std::string & path)52 ItemUpdaterMMC(sdbusplus::bus_t& bus, const std::string& path) : 53 ItemUpdater(bus, path) 54 { 55 processPNORImage(); 56 gardReset = std::make_unique<GardResetMMC>(bus, GARD_PATH); 57 volatileEnable = std::make_unique<ObjectEnable>(bus, volatilePath); 58 59 // Emit deferred signal. 60 emit_object_added(); 61 } 62 virtual ~ItemUpdaterMMC() = default; 63 64 void freePriority(uint8_t value, const std::string& versionId) override; 65 66 void processPNORImage() override; 67 68 void deleteAll() override; 69 70 bool freeSpace() override; 71 72 void updateFunctionalAssociation(const std::string& versionId) override; 73 74 bool isVersionFunctional(const std::string& versionId) override; 75 76 private: 77 /** @brief Create Activation object */ 78 std::unique_ptr<Activation> createActivationObject( 79 const std::string& path, const std::string& versionId, 80 const std::string& extVersion, 81 sdbusplus::xyz::openbmc_project::Software::server::Activation:: 82 Activations activationStatus, 83 AssociationList& assocs) override; 84 85 /** @brief Create Version object */ 86 std::unique_ptr<Version> createVersionObject( 87 const std::string& objPath, const std::string& versionId, 88 const std::string& versionString, 89 sdbusplus::xyz::openbmc_project::Software::server::Version:: 90 VersionPurpose versionPurpose, 91 const std::string& filePath) override; 92 93 /** @brief Validate if image is valid or not */ 94 bool validateImage(const std::string& path); 95 96 /** @brief Host factory reset - clears PNOR partitions for each 97 * Activation D-Bus object */ 98 void reset() override; 99 100 /** @brief The functional version ID */ 101 std::string functionalVersionId; 102 }; 103 104 } // namespace updater 105 } // namespace software 106 } // namespace openpower 107