phal: Added service to reinit CEC device tree

The phal will initialize the required targets (hardware) as functional
in POWER CEC system device tree during ipling but, later timeframe of
ipling those targets may be marked as non-functional (for example,
based on available guard records or hwp's failure case) so, when
doing normal ipl next time then ipling will behave differently due to
those marked targets as non-functional. So, before doing normal ipl
need to reinitialize the POWER CEC system device tree.

Hence, the added service will try phal to make reinitialize the device
tree.

Signed-off-by: Ramesh Iyyar <rameshi1@in.ibm.com>
Change-Id: Iaf04af076b61f3c4aa9cee641d951e2d843e996b
diff --git a/Makefile.am b/Makefile.am
index 3257f33..cded7eb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,7 +9,8 @@
   op-enter-mpreboot@.service
 
 if ENABLE_PHAL
-  systemdsystemunit_DATA += set-spi-mux.service
+  systemdsystemunit_DATA += set-spi-mux.service \
+                            phal-reinit-devtree.service
 endif
 
 bin_PROGRAMS = \
diff --git a/configure.ac b/configure.ac
index 971be69..79b2eae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,6 +79,7 @@
 
        CHIPS+=" phal common"
        AC_CONFIG_FILES([set-spi-mux.service])
+       AC_CONFIG_FILES([phal-reinit-devtree.service])
       ]
      )
 
diff --git a/phal-reinit-devtree.service.in b/phal-reinit-devtree.service.in
new file mode 100644
index 0000000..5e44aba
--- /dev/null
+++ b/phal-reinit-devtree.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Reinit POWER CEC system device tree
+Before=start_host@0.service
+ConditionPathExists=!/run/openbmc/host@0-on
+
+[Service]
+Type=oneshot
+RemainAfterExit=no
+ExecStart=/bin/rm -f /var/lib/phal/genesisboot
+
+[Install]
+RequiredBy=obmc-host-start@0.target