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/CMakeLists.txt b/service/CMakeLists.txt
index 10377f1..7b58e9e 100644
--- a/service/CMakeLists.txt
+++ b/service/CMakeLists.txt
@@ -1,5 +1,5 @@
 cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
-project(intel-pfr-manager CXX)
+project(pfr-manager CXX)
 set(CMAKE_CXX_STANDARD 17)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
diff --git a/service/inc/pfr_mgr.hpp b/service/inc/pfr_mgr.hpp
index 8a0acf6..13091d7 100644
--- a/service/inc/pfr_mgr.hpp
+++ b/service/inc/pfr_mgr.hpp
@@ -24,8 +24,6 @@
 
 #include <string>
 
-namespace intel
-{
 namespace pfr
 {
 
@@ -85,4 +83,3 @@
 };
 
 } // namespace pfr
-} // namespace intel
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)));
     }
diff --git a/service/src/pfr_mgr.cpp b/service/src/pfr_mgr.cpp
index bb31b5c..4d77c0e 100644
--- a/service/src/pfr_mgr.cpp
+++ b/service/src/pfr_mgr.cpp
@@ -16,8 +16,6 @@
 
 #include "pfr_mgr.hpp"
 
-namespace intel
-{
 namespace pfr
 {
 
@@ -175,4 +173,3 @@
 }
 
 } // namespace pfr
-} // namespace intel