primary-proc: move function to common utils

This is a useful function which can be utilized in upcoming work so move
to the common utilities

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I87873b4dbedbeef0a18474eba39798fde298ea36
diff --git a/procedures/phal/common_utils.cpp b/procedures/phal/common_utils.cpp
index 4ead474..ca37ace 100644
--- a/procedures/phal/common_utils.cpp
+++ b/procedures/phal/common_utils.cpp
@@ -2,6 +2,7 @@
 {
 #include <libpdbg.h>
 }
+#include "attributes_info.H"
 
 #include "phalerror/phal_error.hpp"
 #include "procedures/phal/common_utils.hpp"
@@ -58,5 +59,33 @@
     }
 }
 
+/**
+ *  @brief  Check if primary processor or not
+ *
+ *  @return True/False
+ */
+bool isPrimaryProc(struct pdbg_target* procTarget)
+{
+    ATTR_PROC_MASTER_TYPE_Type type;
+
+    // Get processor type (Primary or Secondary)
+    if (DT_GET_PROP(ATTR_PROC_MASTER_TYPE, procTarget, type))
+    {
+        log<level::ERR>("Attribute [ATTR_PROC_MASTER_TYPE] get failed");
+        throw std::runtime_error(
+            "Attribute [ATTR_PROC_MASTER_TYPE] get failed");
+    }
+
+    /* Attribute value 0 corresponds to primary processor */
+    if (type == ENUM_ATTR_PROC_MASTER_TYPE_ACTING_MASTER)
+    {
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}
+
 } // namespace phal
 } // namespace openpower
diff --git a/procedures/phal/common_utils.hpp b/procedures/phal/common_utils.hpp
index f9703bc..623d071 100644
--- a/procedures/phal/common_utils.hpp
+++ b/procedures/phal/common_utils.hpp
@@ -2,6 +2,11 @@
 
 #include <libipl.H>
 
+extern "C"
+{
+#include <libpdbg.h>
+}
+
 namespace openpower
 {
 namespace phal
@@ -17,5 +22,14 @@
  */
 void phal_init(enum ipl_mode mode = IPL_AUTOBOOT);
 
+/**
+ *  @brief  Check if primary processor or not
+ *
+ *  * @param[in] procTarget - Target to check if primary or not
+ *
+ *  @return True/False
+ */
+bool isPrimaryProc(struct pdbg_target* procTarget);
+
 } // namespace phal
 } // namespace openpower
diff --git a/procedures/phal/start_host.cpp b/procedures/phal/start_host.cpp
index 1b64295..152bd7e 100644
--- a/procedures/phal/start_host.cpp
+++ b/procedures/phal/start_host.cpp
@@ -24,34 +24,6 @@
 using namespace phosphor::logging;
 
 /**
- *  @brief  Check if master processor or not
- *
- *  @return True/False
- */
-bool isMasterProc(struct pdbg_target* procTarget)
-{
-    ATTR_PROC_MASTER_TYPE_Type type;
-
-    // Get processor type (Master or Alt-master)
-    if (DT_GET_PROP(ATTR_PROC_MASTER_TYPE, procTarget, type))
-    {
-        log<level::ERR>("Attribute [ATTR_PROC_MASTER_TYPE] get failed");
-        throw std::runtime_error(
-            "Attribute [ATTR_PROC_MASTER_TYPE] get failed");
-    }
-
-    /* Attribute value 0 corresponds to master processor */
-    if (type == 0)
-    {
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-/**
  *  @brief  Select BOOT SEEPROM and Measurement SEEPROM(PRIMARY/BACKUP) on POWER
  *          processor position 0/1 depending on boot count before kicking off
  *          the boot.
@@ -66,7 +38,7 @@
 
     pdbg_for_each_class_target("proc", procTarget)
     {
-        if (!isMasterProc(procTarget))
+        if (!isPrimaryProc(procTarget))
         {
             continue;
         }