move openbmc targets into this repo

OpenBMC is moving towards individual repos hosting and maintaining their
own systemd files. This allows the corresponding maintainer more control
over their systemd files and removes the meta-* layer maintainer from
needing to be involved.

The systemd targets defined and used by OpenBMC are implemented by
phosphor-state-manager code and services so move them into this
repository.

Once this is merged, its bump will need to be combined with a change in
the meta-phosphor layer that removes the target files.

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I248bf79c95f66afefffcc152de79cd2791945819
diff --git a/target_files/meson.build b/target_files/meson.build
new file mode 100644
index 0000000..ad2b328
--- /dev/null
+++ b/target_files/meson.build
@@ -0,0 +1,45 @@
+unit_files = [
+    'obmc-chassis-hard-poweroff@.target',
+    'obmc-chassis-powered-off@.target',
+    'obmc-chassis-poweroff@.target',
+    'obmc-chassis-poweron@.target',
+    'obmc-chassis-powerreset@.target',
+    'obmc-fan-control-ready@.target',
+    'obmc-fan-control.target',
+    'obmc-fan-watchdog-takeover.target',
+    'obmc-fans-ready.target',
+    'obmc-host-crash@.target',
+    'obmc-host-quiesce@.target',
+    'obmc-host-reboot@.target',
+    'obmc-host-reset-running@.target',
+    'obmc-host-reset@.target',
+    'obmc-host-shutdown@.target',
+    'obmc-host-start-pre@.target',
+    'obmc-host-start@.target',
+    'obmc-host-started@.target',
+    'obmc-host-starting@.target',
+    'obmc-host-startmin@.target',
+    'obmc-host-stop-pre@.target',
+    'obmc-host-stop@.target',
+    'obmc-host-stopped@.target',
+    'obmc-host-stopping@.target',
+    'obmc-host-timeout@.target',
+    'obmc-mapper.target',
+    'obmc-power-off@.target',
+    'obmc-power-on@.target',
+    'obmc-power-reset-on@.target',
+    'obmc-power-start-pre@.target',
+    'obmc-power-start@.target',
+    'obmc-power-stop-pre@.target',
+    'obmc-power-stop@.target',
+]
+
+foreach u : unit_files
+    configure_file(
+        copy: true,
+        input: u,
+        install: true,
+        install_dir: systemd_system_unit_dir,
+        output: u,
+        )
+endforeach
diff --git a/target_files/obmc-chassis-hard-poweroff@.target b/target_files/obmc-chassis-hard-poweroff@.target
new file mode 100644
index 0000000..a033f60
--- /dev/null
+++ b/target_files/obmc-chassis-hard-poweroff@.target
@@ -0,0 +1,11 @@
+[Unit]
+Description=Chassis%i (Hard Power Off)
+Wants=multi-user.target
+After=multi-user.target
+Wants=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
+After=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
+Conflicts=obmc-chassis-poweron@%i.target
+Conflicts=obmc-chassis-powerreset@%i.target
+Conflicts=obmc-host-shutdown@%i.target
+Conflicts=xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service
+RefuseManualStop=yes
diff --git a/target_files/obmc-chassis-powered-off@.target b/target_files/obmc-chassis-powered-off@.target
new file mode 100644
index 0000000..c043f37
--- /dev/null
+++ b/target_files/obmc-chassis-powered-off@.target
@@ -0,0 +1,9 @@
+[Unit]
+Description=Chassis%i (Powered Off)
+Wants=multi-user.target
+After=multi-user.target
+Wants=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
+After=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
+Conflicts=obmc-chassis-poweron@%i.target
+Conflicts=obmc-chassis-powerreset@%i.target
+RefuseManualStop=yes
diff --git a/target_files/obmc-chassis-poweroff@.target b/target_files/obmc-chassis-poweroff@.target
new file mode 100644
index 0000000..69209e6
--- /dev/null
+++ b/target_files/obmc-chassis-poweroff@.target
@@ -0,0 +1,9 @@
+[Unit]
+Description=Chassis%i (Power Off)
+Wants=multi-user.target
+After=multi-user.target
+Wants=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
+After=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
+Conflicts=obmc-chassis-poweron@%i.target
+Conflicts=obmc-chassis-powerreset@%i.target
+RefuseManualStop=yes
diff --git a/target_files/obmc-chassis-poweron@.target b/target_files/obmc-chassis-poweron@.target
new file mode 100644
index 0000000..cd7c2fc
--- /dev/null
+++ b/target_files/obmc-chassis-poweron@.target
@@ -0,0 +1,12 @@
+[Unit]
+Description=Chassis%i (Power On)
+Wants=multi-user.target
+After=multi-user.target
+Wants=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
+After=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
+Wants=mapper-subtree-remove@-xyz-openbmc\x5fproject-software\x3Axyz.openbmc_project.Software.ActivationBlocksTransition.service
+After=mapper-subtree-remove@-xyz-openbmc\x5fproject-software\x3Axyz.openbmc_project.Software.ActivationBlocksTransition.service
+Conflicts=obmc-chassis-poweroff@%i.target
+RefuseManualStop=yes
+OnFailure=obmc-chassis-poweroff@%i.target
+OnFailureJobMode=flush
diff --git a/target_files/obmc-chassis-powerreset@.target b/target_files/obmc-chassis-powerreset@.target
new file mode 100644
index 0000000..03036f3
--- /dev/null
+++ b/target_files/obmc-chassis-powerreset@.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=Chassis%i (Reset Check)
+Conflicts=obmc-chassis-poweroff@%i.target
+RefuseManualStop=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/target_files/obmc-fan-control-ready@.target b/target_files/obmc-fan-control-ready@.target
new file mode 100644
index 0000000..e041a55
--- /dev/null
+++ b/target_files/obmc-fan-control-ready@.target
@@ -0,0 +1,4 @@
+[Unit]
+Description=Fan Control Ready
+RefuseManualStop=yes
+Conflicts=obmc-chassis-powered-off@%i.target
diff --git a/target_files/obmc-fan-control.target b/target_files/obmc-fan-control.target
new file mode 100644
index 0000000..50665db
--- /dev/null
+++ b/target_files/obmc-fan-control.target
@@ -0,0 +1,4 @@
+[Unit]
+Description=Fan Control
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-fan-watchdog-takeover.target b/target_files/obmc-fan-watchdog-takeover.target
new file mode 100644
index 0000000..8034083
--- /dev/null
+++ b/target_files/obmc-fan-watchdog-takeover.target
@@ -0,0 +1,6 @@
+#The system implementation should start this target when dynamic fan control
+#is no longer desired or possible.  It should also add units to this target
+#that enabled continued operation after dynamic fan control is no longer
+#desired or possible.
+[Unit]
+Description=Fan watchdog takeover target
diff --git a/target_files/obmc-fans-ready.target b/target_files/obmc-fans-ready.target
new file mode 100644
index 0000000..59e61c6
--- /dev/null
+++ b/target_files/obmc-fans-ready.target
@@ -0,0 +1,4 @@
+[Unit]
+Description=Fans Ready
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-host-crash@.target b/target_files/obmc-host-crash@.target
new file mode 100644
index 0000000..ea3798b
--- /dev/null
+++ b/target_files/obmc-host-crash@.target
@@ -0,0 +1,4 @@
+[Unit]
+Description=Host instance %i crashed
+Conflicts=obmc-chassis-poweroff@%i.target
+RefuseManualStop=yes
diff --git a/target_files/obmc-host-quiesce@.target b/target_files/obmc-host-quiesce@.target
new file mode 100644
index 0000000..900995b
--- /dev/null
+++ b/target_files/obmc-host-quiesce@.target
@@ -0,0 +1,6 @@
+[Unit]
+Description=Quiesce Target
+Wants=multi-user.target
+After=multi-user.target
+RefuseManualStop=yes
+Conflicts=obmc-chassis-poweroff@%i.target
diff --git a/target_files/obmc-host-reboot@.target b/target_files/obmc-host-reboot@.target
new file mode 100644
index 0000000..8e749e6
--- /dev/null
+++ b/target_files/obmc-host-reboot@.target
@@ -0,0 +1,8 @@
+[Unit]
+Description=Reboot Host%i
+Wants=multi-user.target
+After=multi-user.target
+Conflicts=obmc-host-startmin@%i.target
+RefuseManualStop=yes
+OnFailure=obmc-chassis-poweroff@%i.target
+OnFailureJobMode=flush
diff --git a/target_files/obmc-host-reset-running@.target b/target_files/obmc-host-reset-running@.target
new file mode 100644
index 0000000..94bb2b1
--- /dev/null
+++ b/target_files/obmc-host-reset-running@.target
@@ -0,0 +1,5 @@
+[Unit]
+Description=Host%i running after reset
+Conflicts=obmc-host-stop@%i.target
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-host-reset@.target b/target_files/obmc-host-reset@.target
new file mode 100644
index 0000000..84d8701
--- /dev/null
+++ b/target_files/obmc-host-reset@.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=Host%i (Reset Check)
+Conflicts=obmc-host-stop@%i.target
+RefuseManualStop=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/target_files/obmc-host-shutdown@.target b/target_files/obmc-host-shutdown@.target
new file mode 100644
index 0000000..012d364
--- /dev/null
+++ b/target_files/obmc-host-shutdown@.target
@@ -0,0 +1,6 @@
+[Unit]
+Description=Power%i Host Off
+Wants=multi-user.target
+RefuseManualStop=yes
+OnFailure=obmc-chassis-poweroff@%i.target
+OnFailureJobMode=flush
diff --git a/target_files/obmc-host-start-pre@.target b/target_files/obmc-host-start-pre@.target
new file mode 100644
index 0000000..fe55146
--- /dev/null
+++ b/target_files/obmc-host-start-pre@.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=Start Host%i (Pre)
+Wants=multi-user.target
+After=multi-user.target
+Conflicts=obmc-host-stop@%i.target
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-host-start@.target b/target_files/obmc-host-start@.target
new file mode 100644
index 0000000..ff1486b
--- /dev/null
+++ b/target_files/obmc-host-start@.target
@@ -0,0 +1,8 @@
+[Unit]
+Description=Start Host%i
+Wants=multi-user.target
+After=multi-user.target
+Conflicts=obmc-host-stop@%i.target
+RefuseManualStop=yes
+OnFailure=obmc-host-quiesce@%i.target
+OnFailureJobMode=flush
diff --git a/target_files/obmc-host-started@.target b/target_files/obmc-host-started@.target
new file mode 100644
index 0000000..fcd51be
--- /dev/null
+++ b/target_files/obmc-host-started@.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=Host%i (Started)
+Wants=multi-user.target
+After=obmc-host-starting@%i.target
+Conflicts=obmc-host-stop@%i.target
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-host-starting@.target b/target_files/obmc-host-starting@.target
new file mode 100644
index 0000000..52e7bea
--- /dev/null
+++ b/target_files/obmc-host-starting@.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=Host%i (Starting)
+Wants=multi-user.target
+After=obmc-host-start-pre@%i.target
+Conflicts=obmc-host-stop@%i.target
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-host-startmin@.target b/target_files/obmc-host-startmin@.target
new file mode 100644
index 0000000..88ccb25
--- /dev/null
+++ b/target_files/obmc-host-startmin@.target
@@ -0,0 +1,8 @@
+[Unit]
+Description=Start Host%i Minimum
+Wants=multi-user.target
+After=multi-user.target
+Conflicts=obmc-host-stop@%i.target
+RefuseManualStop=yes
+OnFailure=obmc-host-quiesce@%i.target
+OnFailureJobMode=flush
diff --git a/target_files/obmc-host-stop-pre@.target b/target_files/obmc-host-stop-pre@.target
new file mode 100644
index 0000000..9fc3296
--- /dev/null
+++ b/target_files/obmc-host-stop-pre@.target
@@ -0,0 +1,8 @@
+[Unit]
+Description=Stop Host%i (Pre)
+Wants=multi-user.target
+After=multi-user.target
+Before=obmc-host-stopping@%i.target
+Conflicts=obmc-host-startmin@%i.target
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-host-stop@.target b/target_files/obmc-host-stop@.target
new file mode 100644
index 0000000..496fd5b
--- /dev/null
+++ b/target_files/obmc-host-stop@.target
@@ -0,0 +1,9 @@
+[Unit]
+Description=Stop Host%i
+Wants=multi-user.target
+After=multi-user.target
+After=obmc-chassis-poweroff@%i.target
+Conflicts=obmc-host-startmin@%i.target
+RefuseManualStop=yes
+OnFailure=obmc-chassis-poweroff@%i.target
+OnFailureJobMode=flush
diff --git a/target_files/obmc-host-stopped@.target b/target_files/obmc-host-stopped@.target
new file mode 100644
index 0000000..c968979
--- /dev/null
+++ b/target_files/obmc-host-stopped@.target
@@ -0,0 +1,9 @@
+[Unit]
+Description=Host%i (Stopped)
+Wants=multi-user.target
+Wants=obmc-host-stopping@%i.target
+After=obmc-host-stopping@%i.target
+Before=obmc-power-stop-pre@%i.target
+Conflicts=obmc-host-startmin@%i.target
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-host-stopping@.target b/target_files/obmc-host-stopping@.target
new file mode 100644
index 0000000..41c4b7f
--- /dev/null
+++ b/target_files/obmc-host-stopping@.target
@@ -0,0 +1,10 @@
+[Unit]
+Description=Host%i (Stopping)
+Wants=multi-user.target
+Wants=obmc-host-stop-pre@%i.target
+After=obmc-host-stop-pre@%i.target
+Before=obmc-host-stopped@%i.target
+Conflicts=obmc-host-startmin@%i.target
+Conflicts=obmc-host-starting@%i.target
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-host-timeout@.target b/target_files/obmc-host-timeout@.target
new file mode 100644
index 0000000..b87507b
--- /dev/null
+++ b/target_files/obmc-host-timeout@.target
@@ -0,0 +1,4 @@
+[Unit]
+Description=Host instance %i timed out refreshing Watchdog
+Conflicts=obmc-chassis-poweroff@%i.target
+RefuseManualStop=yes
diff --git a/target_files/obmc-mapper.target b/target_files/obmc-mapper.target
new file mode 100644
index 0000000..5e52f4c
--- /dev/null
+++ b/target_files/obmc-mapper.target
@@ -0,0 +1,4 @@
+[Unit]
+Description=Phosphor Object Mapper
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-power-off@.target b/target_files/obmc-power-off@.target
new file mode 100644
index 0000000..7fda29b
--- /dev/null
+++ b/target_files/obmc-power-off@.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=Power%i (Off)
+Wants=multi-user.target
+After=obmc-power-stop@%i.target
+Conflicts=obmc-chassis-poweron@%i.target
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-power-on@.target b/target_files/obmc-power-on@.target
new file mode 100644
index 0000000..b55d909
--- /dev/null
+++ b/target_files/obmc-power-on@.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=Power%i (On)
+Wants=multi-user.target
+After=obmc-power-start@%i.target
+Conflicts=obmc-chassis-poweroff@%i.target
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-power-reset-on@.target b/target_files/obmc-power-reset-on@.target
new file mode 100644
index 0000000..d24d401
--- /dev/null
+++ b/target_files/obmc-power-reset-on@.target
@@ -0,0 +1,5 @@
+[Unit]
+Description=Chassis%i power on after reset
+Conflicts=obmc-chassis-poweroff@%i.target
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-power-start-pre@.target b/target_files/obmc-power-start-pre@.target
new file mode 100644
index 0000000..2b5fdbb
--- /dev/null
+++ b/target_files/obmc-power-start-pre@.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=Power%i On (Pre)
+Wants=multi-user.target
+After=multi-user.target
+Conflicts=obmc-chassis-poweroff@%i.target
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-power-start@.target b/target_files/obmc-power-start@.target
new file mode 100644
index 0000000..720548e
--- /dev/null
+++ b/target_files/obmc-power-start@.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=Power%i On
+After=obmc-power-start-pre@%i.target
+Wants=multi-user.target
+Conflicts=obmc-chassis-poweroff@%i.target
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-power-stop-pre@.target b/target_files/obmc-power-stop-pre@.target
new file mode 100644
index 0000000..5460914
--- /dev/null
+++ b/target_files/obmc-power-stop-pre@.target
@@ -0,0 +1,9 @@
+[Unit]
+Description=Power%i Off (Pre)
+Wants=multi-user.target
+After=multi-user.target
+Wants=obmc-host-stopped@%i.target
+After=obmc-host-stopped@%i.target
+Conflicts=obmc-chassis-poweron@%i.target
+RefuseManualStart=yes
+RefuseManualStop=yes
diff --git a/target_files/obmc-power-stop@.target b/target_files/obmc-power-stop@.target
new file mode 100644
index 0000000..fc22eb1
--- /dev/null
+++ b/target_files/obmc-power-stop@.target
@@ -0,0 +1,9 @@
+[Unit]
+Description=Power%i Off
+Wants=obmc-power-stop-pre@%i.target
+After=obmc-power-stop-pre@%i.target
+Wants=multi-user.target
+Conflicts=obmc-chassis-poweron@%i.target
+Conflicts=fsi-disable.service
+RefuseManualStart=yes
+RefuseManualStop=yes