Add service to trigger OpenFSI driver to do a scan

After PGOOD comes up, the FSI driver needs to do a
scan to find the FSI devices.

Change-Id: I1b4eeec191408a36b37d9044279bdf067deb2b15
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/common/recipes-phosphor/chassis/obmc-fsi-scan.bb b/common/recipes-phosphor/chassis/obmc-fsi-scan.bb
new file mode 100644
index 0000000..4a4fdd7
--- /dev/null
+++ b/common/recipes-phosphor/chassis/obmc-fsi-scan.bb
@@ -0,0 +1,15 @@
+SUMMARY = "Scan for FSI devices"
+DESCRIPTION = "Tells the OpenFSI device driver to scan for FSI devices"
+PR = "r1"
+
+inherit obmc-phosphor-dbus-service
+inherit obmc-phosphor-license
+
+TMPL = "fsi-scan@.service"
+INSTFMT = "fsi-scan@{0}.service"
+TGTFMT = "obmc-power-chassis-on@{0}.target"
+FMT = "../${TMPL}:${TGTFMT}.requires/${INSTFMT}"
+
+SYSTEMD_SERVICE_${PN} += "${TMPL}"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT', 'OBMC_CHASSIS_INSTANCES')}"
+SYSTEMD_SUBSTITUTIONS += "MACHINE:${MACHINE}:${TMPL}"
diff --git a/common/recipes-phosphor/chassis/obmc-fsi-scan/fsi-scan@.service b/common/recipes-phosphor/chassis/obmc-fsi-scan/fsi-scan@.service
new file mode 100644
index 0000000..ac37004
--- /dev/null
+++ b/common/recipes-phosphor/chassis/obmc-fsi-scan/fsi-scan@.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Scan FSI devices
+Wants=obmc-power-on@%i.target
+After=obmc-power-on@%i.target
+Conflicts=obmc-power-chassis-off@%i.target
+
+[Service]
+ExecStart=/bin/sh -c "echo 1 > /sys/bus/platform/devices/fsi-master/scan"
+Type=oneshot
+RemainAfterExit=yes
+
+[Install]
+RequiredBy=obmc-power-chassis-on@%i.target