meta-zaius: Add AVSBus workaround script, services

Add AVSBus control script.
Add systemd services to enable AVSBus after power on and disable AVSBus
at power off.
Add BitBake recipe to install script and services.

Signed-off-by: Xo Wang <xow@google.com>
Change-Id: I3f7a36a6c16d32bb7b648b0f84c9ab3abb922399
diff --git a/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control.bb b/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control.bb
new file mode 100644
index 0000000..0162ede
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control.bb
@@ -0,0 +1,28 @@
+SUMMARY = "Zaius AVSBus control"
+DESCRIPTION = "Voltage regulator module (VRM) AVSBus control for Zaius"
+PR = "r0"
+
+inherit obmc-phosphor-systemd
+inherit obmc-phosphor-license
+
+TMPL_OFF = "avsbus-disable@.service"
+TMPL_ON = "avsbus-enable@.service"
+INSTFMT_OFF = "avsbus-disable@{0}.service"
+INSTFMT_ON = "avsbus-enable@{0}.service"
+TGTFMT_OFF = "obmc-chassis-stop@{0}.target"
+TGTFMT_ON = "obmc-chassis-start@{0}.target"
+FMT_OFF = "../${TMPL_OFF}:${TGTFMT_OFF}.wants/${INSTFMT_OFF}"
+FMT_ON = "../${TMPL_ON}:${TGTFMT_ON}.wants/${INSTFMT_ON}"
+
+SYSTEMD_SERVICE_${PN} += "${TMPL_OFF}"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_OFF', 'OBMC_CHASSIS_INSTANCES')}"
+SYSTEMD_SERVICE_${PN} += "${TMPL_ON}"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_ON', 'OBMC_CHASSIS_INSTANCES')}"
+
+SRC_URI += "file://zaius_avsbus.sh"
+RDEPENDS_${PN} += "i2c-tools"
+
+do_install() {
+        install -d ${D}${bindir}
+        install -m 0755 ${WORKDIR}/zaius_avsbus.sh ${D}${bindir}/zaius_avsbus.sh
+}