manager: Sync pvm_clear_nvram BIOS Attribute

This commit adds support to synchronize the pvm_clear_nvram BIOS
attribute to bit 2 in the UTIL/D1 keyword of the motherboard VPD.

The attribute will be used by PHYP to determine when to clear their
NVRAM content.

A value of "Disabled" in the BIOS attribute maps to the D1:2 bit being 0
and a value of "Enabled: maps to the D1:2 bit being 1.

Signed-off-by: Santosh Puranik <santosh.puranik@in.ibm.com>
Change-Id: Ia0f3cfa92a98a2a1a95dd67ca598770459b9b7f2
diff --git a/vpd-manager/bios_handler.hpp b/vpd-manager/bios_handler.hpp
index 86e3318..985daa7 100644
--- a/vpd-manager/bios_handler.hpp
+++ b/vpd-manager/bios_handler.hpp
@@ -135,13 +135,24 @@
     void saveCreateDefaultLparToVPD(const std::string& createDefaultLpar);
 
     /**
+     * @brief Persistently saves the Clear NVRAM setting
+     *
+     * Create default LPAR setting is saved to the UTIL/D1 keyword's 2nd bit in
+     * the motherboard VPD. If the clear NVRAM in BIOS is "Disabled",
+     * set D1:2 to 0, if "Enabled" set D1:2 to 1
+     *
+     * @param[in] createDefaultLpar - The mirror mode BIOS attribute.
+     */
+    void saveClearNVRAMToVPD(const std::string& clearNVRAM);
+
+    /**
      * @brief Writes Memory mirror mode to BIOS
      *
      * Writes to the hb_memory_mirror_mode BIOS attribute, if the value is
      * not already the same as we are trying to write.
      *
      * @param[in] ammVal - The mirror mode as read from VPD.
-     * @param[in] ammInBIOS - The mirror more in the BIOS table.
+     * @param[in] ammInBIOS - The mirror mode in the BIOS table.
      */
     void saveAMMToBIOS(const std::string& ammVal, const std::string& ammInBIOS);
 
@@ -162,8 +173,8 @@
      * Writes to the pvm_keep_and_clear BIOS attribute, if the value is
      * not already the same as we are trying to write.
      *
-     * @param[in] keepAndClear - The mirror mode as read from VPD.
-     * @param[in] keepAndClearInBIOS - The mirror more in the BIOS table.
+     * @param[in] keepAndClear - The keep and clear as read from VPD.
+     * @param[in] keepAndClearInBIOS - The keep and clear in the BIOS table.
      */
     void saveKeepAndClearToBIOS(const std::string& keepAndClear,
                                 const std::string& keepAndClearInBIOS);
@@ -174,14 +185,27 @@
      * Writes to the pvm_create_default_lpar BIOS attribute, if the value is
      * not already the same as we are trying to write.
      *
-     * @param[in] createDefaultLpar - The mirror mode as read from VPD.
-     * @param[in] createDefaultLparInBIOS - The mirror more in the BIOS table.
+     * @param[in] createDefaultLpar - The create default LPAR as read from VPD.
+     * @param[in] createDefaultLparInBIOS - The create default LPAR in the BIOS
+     * table.
      */
     void
         saveCreateDefaultLparToBIOS(const std::string& createDefaultLpar,
                                     const std::string& createDefaultLparInBIOS);
 
     /**
+     * @brief Writes Clear NVRAM setting to BIOS
+     *
+     * Writes to the pvm_clear_nvram BIOS attribute, if the value is
+     * not already the same as we are trying to write.
+     *
+     * @param[in] clearNVRAM - The clear NVRAM as read from VPD.
+     * @param[in] clearNVRAMInBIOS - The clear NVRAM in the BIOS table.
+     */
+    void saveClearNVRAMToBIOS(const std::string& clearNVRAM,
+                              const std::string& clearNVRAMInBIOS);
+
+    /**
      * @brief Reads the hb_memory_mirror_mode attribute
      *
      * @return std::string - The AMM BIOS attribute. Empty string on failure.
@@ -212,10 +236,18 @@
     std::string readBIOSCreateDefaultLpar();
 
     /**
+     * @brief Reads the pvm_clear_nvram attribute
+     *
+     * @return std::string - The Clear NVRAM BIOS attribute. Empty
+     * string on failure.
+     */
+    std::string readBIOSClearNVRAM();
+
+    /**
      * @brief Restore BIOS attributes
      *
      * This function checks if we are coming out of a factory reset. If yes,
-     * it checks the VPD cache for valid backed up copy of the FCO and AMM
+     * it checks the VPD cache for valid backed up copy of the applicable
      * BIOS attributes. If valid values are found in the VPD, it will apply
      * those to the BIOS attributes.
      */