Move chassis power on/off services into new targets

Change-Id: I42049c092e4a852b94b6d3f96b9dea3884c21333
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
diff --git a/meta-phosphor/common/recipes-core/systemd/obmc-targets.bb b/meta-phosphor/common/recipes-core/systemd/obmc-targets.bb
index bbafa3d..4317037 100644
--- a/meta-phosphor/common/recipes-core/systemd/obmc-targets.bb
+++ b/meta-phosphor/common/recipes-core/systemd/obmc-targets.bb
@@ -7,20 +7,26 @@
 inherit obmc-phosphor-license
 inherit allarch
 
+# Overall chassis and host control
 CHASSIS_TARGETS = "start stop"
-POWER_TARGETS = "start-pre start on stop-pre stop off"
+# Synchronization targets
+SYNCH_POWER_TARGETS = "start-pre start on stop-pre stop off"
+# Control chassis power
+CHASSIS_POWER_TARGETS = "on off"
 # Track all host synchronization point target
 HOST_SYNCH_TARGETS = "start-pre start started stop-pre stop stopped"
 # Track all host action targets
 HOST_ACTION_TARGETS = "stop"
 
 CHASSIS_FMT = "obmc-chassis-{0}@.target"
-POWER_FMT = "obmc-power-{0}@.target"
+SYNCH_POWER_FMT = "obmc-power-{0}@.target"
+CHASSIS_POWER_FMT = "obmc-power-chassis-{0}@.target"
 HOST_SYNCH_FMT = "obmc-host-{0}@.target"
 HOST_ACTION_FMT = "obmc-{0}-host@.target"
 
 CHASSIS_LINK_FMT = "${CHASSIS_FMT}:obmc-chassis-{0}@{1}.target"
-POWER_LINK_FMT = "${POWER_FMT}:obmc-power-{0}@{1}.target"
+SYNCH_POWER_LINK_FMT = "${SYNCH_POWER_FMT}:obmc-power-{0}@{1}.target"
+CHASSIS_POWER_LINK_FMT = "${CHASSIS_POWER_FMT}:obmc-power-chassis-{0}@{1}.target"
 HOST_LINK_SYNCH_FMT = "${HOST_SYNCH_FMT}:obmc-host-{0}@{1}.target"
 HOST_LINK_ACTION_FMT = "${HOST_ACTION_FMT}:obmc-{0}-host@{1}.target"
 
@@ -33,11 +39,13 @@
         "
 
 SYSTEMD_SERVICE_${PN} += "${@compose_list(d, 'CHASSIS_FMT', 'CHASSIS_TARGETS')}"
-SYSTEMD_SERVICE_${PN} += "${@compose_list(d, 'POWER_FMT', 'POWER_TARGETS')}"
+SYSTEMD_SERVICE_${PN} += "${@compose_list(d, 'SYNCH_POWER_FMT', 'SYNCH_POWER_TARGETS')}"
+SYSTEMD_SERVICE_${PN} += "${@compose_list(d, 'CHASSIS_POWER_FMT', 'CHASSIS_POWER_TARGETS')}"
 SYSTEMD_SERVICE_${PN} += "${@compose_list(d, 'HOST_SYNCH_FMT', 'HOST_SYNCH_TARGETS')}"
 SYSTEMD_SERVICE_${PN} += "${@compose_list(d, 'HOST_ACTION_FMT', 'HOST_ACTION_TARGETS')}"
 
 SYSTEMD_LINK_${PN} += "${@compose_list(d, 'CHASSIS_LINK_FMT', 'CHASSIS_TARGETS', 'OBMC_CHASSIS_INSTANCES')}"
-SYSTEMD_LINK_${PN} += "${@compose_list(d, 'POWER_LINK_FMT', 'POWER_TARGETS', 'OBMC_POWER_INSTANCES')}"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'SYNCH_POWER_LINK_FMT', 'SYNCH_POWER_TARGETS', 'OBMC_POWER_INSTANCES')}"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'CHASSIS_POWER_LINK_FMT', 'CHASSIS_POWER_TARGETS', 'OBMC_CHASSIS_INSTANCES')}"
 SYSTEMD_LINK_${PN} += "${@compose_list(d, 'HOST_LINK_SYNCH_FMT', 'HOST_SYNCH_TARGETS', 'OBMC_HOST_INSTANCES')}"
 SYSTEMD_LINK_${PN} += "${@compose_list(d, 'HOST_LINK_ACTION_FMT', 'HOST_ACTION_TARGETS', 'OBMC_HOST_INSTANCES')}"
diff --git a/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power.bb b/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power.bb
index c5965ac..d4a594e 100644
--- a/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power.bb
+++ b/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power.bb
@@ -22,12 +22,12 @@
 SYSTEMD_ENVIRONMENT_FILE_${PN} += "obmc/power_control"
 
 START_TMPL = "op-power-start@.service"
-START_TGTFMT = "obmc-chassis-start@{1}.target"
+START_TGTFMT = "obmc-power-chassis-on@{1}.target"
 START_INSTFMT = "op-power-start@{0}.service"
 START_FMT = "../${START_TMPL}:${START_TGTFMT}.wants/${START_INSTFMT}"
 
 STOP_TMPL = "op-power-stop@.service"
-STOP_TGTFMT = "obmc-chassis-stop@{1}.target"
+STOP_TGTFMT = "obmc-power-chassis-off@{1}.target"
 STOP_INSTFMT = "op-power-stop@{0}.service"
 STOP_FMT = "../${STOP_TMPL}:${STOP_TGTFMT}.wants/${STOP_INSTFMT}"
 
@@ -43,3 +43,17 @@
 SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'STOP_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
 SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'ON_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
 SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'OFF_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
+
+# TODO - Will delete this next block of code in later commit once everything
+#        moved over to new targets
+START_TGTFMT_TBDEL = "obmc-chassis-start@{1}.target"
+STOP_TGTFMT_TBDEL = "obmc-chassis-stop@{1}.target"
+START_FMT_TBDEL = "../${START_TMPL}:${START_TGTFMT_TBDEL}.wants/${START_INSTFMT}"
+STOP_FMT_TBDEL = "../${STOP_TMPL}:${STOP_TGTFMT_TBDEL}.wants/${STOP_INSTFMT}"
+ON_FMT_TBDEL = "../${ON_TMPL}:${START_TGTFMT_TBDEL}.wants/${ON_INSTFMT}"
+OFF_FMT_TBDEL = "../${OFF_TMPL}:${STOP_TGTFMT_TBDEL}.wants/${OFF_INSTFMT}"
+
+SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'START_FMT_TBDEL', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
+SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'STOP_FMT_TBDEL', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
+SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'ON_FMT_TBDEL', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
+SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'OFF_FMT_TBDEL', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
\ No newline at end of file