Adhoc fixes in pfr-manager

1) Rename intel-pfr-manager to pfr-manger for syncing
   with recipe name.
2) Removed intel namespace for wider OEM's usage.
3) fix for anti-pattern in systemd service files.

Tested:
pfr-manager service works fine.

Change-Id: Ibeccf38116148dc2d270505d4197620330ab3330
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
diff --git a/service/src/mainapp.cpp b/service/src/mainapp.cpp
index 52e0b85..790162a 100644
--- a/service/src/mainapp.cpp
+++ b/service/src/mainapp.cpp
@@ -21,6 +21,8 @@
 
 #include <boost/asio.hpp>
 
+namespace pfr
+{
 // Caches the last Recovery/Panic Count to
 // identify any new Recovery/panic actions.
 /* TODO: When BMC Reset's, these values will be lost
@@ -37,10 +39,9 @@
 std::unique_ptr<boost::asio::steady_timer> stateTimer = nullptr;
 std::unique_ptr<boost::asio::steady_timer> initTimer = nullptr;
 
-std::vector<std::unique_ptr<intel::pfr::PfrVersion>> pfrVersionObjects;
-std::unique_ptr<intel::pfr::PfrConfig> pfrConfigObject;
+std::vector<std::unique_ptr<PfrVersion>> pfrVersionObjects;
+std::unique_ptr<PfrConfig> pfrConfigObject;
 
-using namespace intel::pfr;
 // List holds <ObjPath> <ImageType> <VersionPurpose>
 static std::vector<std::tuple<std::string, ImageType, std::string>>
     verComponentList = {
@@ -127,8 +128,7 @@
 static void logLastRecoveryEvent()
 {
     uint8_t reason = 0;
-    if (0 !=
-        intel::pfr::readCpldReg(intel::pfr::ActionType::recoveryReason, reason))
+    if (0 != readCpldReg(ActionType::recoveryReason, reason))
     {
         return;
     }
@@ -149,8 +149,7 @@
 static void logLastPanicEvent()
 {
     uint8_t reason = 0;
-    if (0 !=
-        intel::pfr::readCpldReg(intel::pfr::ActionType::panicReason, reason))
+    if (0 != readCpldReg(ActionType::panicReason, reason))
     {
         return;
     }
@@ -191,8 +190,7 @@
 static void checkAndLogEvents()
 {
     uint8_t currPanicCount = 0;
-    if (0 == intel::pfr::readCpldReg(intel::pfr::ActionType::panicCount,
-                                     currPanicCount))
+    if (0 == readCpldReg(ActionType::panicCount, currPanicCount))
     {
         if (lastPanicCount != currPanicCount)
         {
@@ -203,8 +201,7 @@
     }
 
     uint8_t currRecoveryCount = 0;
-    if (0 == intel::pfr::readCpldReg(intel::pfr::ActionType::recoveryCount,
-                                     currRecoveryCount))
+    if (0 == readCpldReg(ActionType::recoveryCount, currRecoveryCount))
     {
         if (lastRecoveryCount != currRecoveryCount)
         {
@@ -216,10 +213,8 @@
 
     uint8_t majorErr = 0;
     uint8_t minorErr = 0;
-    if ((0 == intel::pfr::readCpldReg(intel::pfr::ActionType::majorError,
-                                      majorErr)) &&
-        (0 ==
-         intel::pfr::readCpldReg(intel::pfr::ActionType::minorError, minorErr)))
+    if ((0 == readCpldReg(ActionType::majorError, majorErr)) &&
+        (0 == readCpldReg(ActionType::minorError, minorErr)))
     {
         if ((lastMajorErr != majorErr) || (lastMinorErr != minorErr))
         {
@@ -270,8 +265,7 @@
                     if (!finishedSettingChkPoint)
                     {
                         finishedSettingChkPoint = true;
-                        intel::pfr::setBMCBootCheckpoint(
-                            bmcBootFinishedChkPoint);
+                        setBMCBootCheckpoint(bmcBootFinishedChkPoint);
                     }
                     return;
                 }
@@ -330,7 +324,7 @@
                     "PFR: BMC boot completed(StartupFinished). Setting "
                     "checkpoint 9.");
                 finishedSettingChkPoint = true;
-                intel::pfr::setBMCBootCheckpoint(bmcBootFinishedChkPoint);
+                setBMCBootCheckpoint(bmcBootFinishedChkPoint);
             }
         });
     checkAndSetCheckpoint(server, conn);
@@ -465,27 +459,29 @@
     checkAndLogEvents();
 }
 
+} // namespace pfr
+
 int main()
 {
     // setup connection to dbus
     boost::asio::io_service io;
     auto conn = std::make_shared<sdbusplus::asio::connection>(io);
-    stateTimer = std::make_unique<boost::asio::steady_timer>(io);
-    initTimer = std::make_unique<boost::asio::steady_timer>(io);
+    pfr::stateTimer = std::make_unique<boost::asio::steady_timer>(io);
+    pfr::initTimer = std::make_unique<boost::asio::steady_timer>(io);
     auto server = sdbusplus::asio::object_server(conn, true);
-    monitorSignals(server, conn);
+    pfr::monitorSignals(server, conn);
 
     auto rootInterface = server.add_interface("/xyz/openbmc_project/pfr", "");
     rootInterface->initialize();
     server.add_manager("/xyz/openbmc_project/pfr");
 
     // Create PFR attributes object and interface
-    pfrConfigObject = std::make_unique<intel::pfr::PfrConfig>(server, conn);
+    pfr::pfrConfigObject = std::make_unique<pfr::PfrConfig>(server, conn);
 
     // Create Software objects using Versions interface
-    for (const auto& entry : verComponentList)
+    for (const auto& entry : pfr::verComponentList)
     {
-        pfrVersionObjects.emplace_back(std::make_unique<intel::pfr::PfrVersion>(
+        pfr::pfrVersionObjects.emplace_back(std::make_unique<pfr::PfrVersion>(
             server, conn, std::get<0>(entry), std::get<1>(entry),
             std::get<2>(entry)));
     }