mpreboot: move to obmc-host-crash target

For phal based systems, move the memory preserving reboot function to
the obmc-host-crash target. This target is currently un-used on phal
based systems.

Make this move so that the obmc-host-diagnostic target can be utilized
as a more generic target. Dumps like hostboot, sbe, and hardware can now
utilize the obmc-host-diagnostic target to ensure the user knows when
any type of diagnostic event is occurring in the system.

Note that the obmc-host-diagnostic target will still be started as a
part of obmc-host-crash since that target is what communicates to
outside users that a diagnostic action is occurring.

To ensure we do not regress the dump functionality on our non-pHAL
systems, ensure the obmc-host-quiesce target remains within the
obmc-host-crash target. Our non pHAL systems go straight to quiesce on a
crash target call.

Tested:
- Verified with all commits in this Topic that the witherspoon system
  has the same service layout as before and the rainier system
  has the new layout (crash used for mpipl)

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: Ia2517736ef16af34d16cdb8515275235ec778d26
diff --git a/recipes-phosphor/host/op-proc-control-systemd-links.bb b/recipes-phosphor/host/op-proc-control-systemd-links.bb
index f493d3a..cae79be 100644
--- a/recipes-phosphor/host/op-proc-control-systemd-links.bb
+++ b/recipes-phosphor/host/op-proc-control-systemd-links.bb
@@ -47,11 +47,7 @@
 	TARGET="../op-continue-mpreboot@.service"
 	ln -s $TARGET $LINK
 
-	LINK="$D$systemd_system_unitdir/obmc-host-diagnostic-mode@0.target.requires/op-enter-mpreboot@0.service"
-	TARGET="../op-enter-mpreboot@.service"
-	ln -s $TARGET $LINK
-
-	# Only install phal reinit service if phal enabled
+	# Only install certain units if phal enabled
 	if [ "${@bb.utils.filter('OBMC_MACHINE_FEATURES', 'phal', d)}" = phal ]; then
 		mkdir -p $D$systemd_system_unitdir/obmc-host-start@0.target.requires
 		LINK="$D$systemd_system_unitdir/obmc-host-start@0.target.requires/phal-reinit-devtree.service"
@@ -61,6 +57,28 @@
 		LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@0.target.requires/proc-pre-poweroff@0.service"
 		TARGET="../proc-pre-poweroff@.service"
 		ln -s $TARGET $LINK
+
+		# on phal systems, obmc-host-crash@.target is used for MPIPL
+		mkdir -p $D$systemd_system_unitdir/obmc-host-crash@0.target.requires
+		LINK="$D$systemd_system_unitdir/obmc-host-crash@0.target.requires/obmc-host-force-warm-reboot@0.target"
+		TARGET="../obmc-host-force-warm-reboot@.target"
+		ln -s $TARGET $LINK
+
+		LINK="$D$systemd_system_unitdir/obmc-host-crash@0.target.requires/op-enter-mpreboot@0.service"
+		TARGET="../op-enter-mpreboot@.service"
+		ln -s $TARGET $LINK
+
+		# ensure diagnostic mode is shown for MPIPL
+		LINK="$D$systemd_system_unitdir/obmc-host-crash@0.target.requires/obmc-host-diagnostic-mode@0.target"
+		TARGET="../obmc-host-diagnostic-mode@.target"
+		ln -s $TARGET $LINK
+	else
+		# If not phal, default to quiesce target in crash target to support
+		# older system designs like witherspoon
+		mkdir -p $D$systemd_system_unitdir/obmc-host-crash@0.target.wants
+		LINK="$D$systemd_system_unitdir/obmc-host-crash@0.target.wants/obmc-host-quiesce@0.target"
+		TARGET="../obmc-host-quiesce@.target"
+		ln -s $TARGET $LINK
 	fi
 }
 
@@ -78,15 +96,22 @@
 	fi
 	LINK="$D$systemd_system_unitdir/obmc-host-startmin@0.target.requires/op-continue-mpreboot@0.service"
 	rm $LINK
-	LINK="$D$systemd_system_unitdir/obmc-host-diagnostic-mode@0.target.requires/op-enter-mpreboot@0.service"
-	rm $LINK
 
-	# Only phal reinit service if phal enabled
+	# Remove phal specific units if enabled
 	if [ "${@bb.utils.filter('OBMC_MACHINE_FEATURES', 'phal', d)}" = phal ]; then
 		LINK="$D$systemd_system_unitdir/obmc-host-start@0.target.requires/phal-reinit-devtree.service"
 		rm $LINK
 
 		LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@0.target.requires/proc-pre-poweroff@0.service"
 		rm $LINK
+
+		LINK="$D$systemd_system_unitdir/obmc-host-crash@0.target.requires/obmc-host-force-warm-reboot@0.target"
+		rm $LINK
+
+		LINK="$D$systemd_system_unitdir/obmc-host-crash@0.target.requires/op-enter-mpreboot@0.service"
+		rm $LINK
+	else
+		LINK="$D$systemd_system_unitdir/obmc-host-crash@0.target.wants/obmc-host-quiesce@0.target"
+		rm $LINK
 	fi
 }