summaryrefslogtreecommitdiff
path: root/meta-ampere/meta-common
diff options
context:
space:
mode:
authorThu Nguyen <thu@os.amperecomputing.com>2022-09-07 01:41:06 +0300
committerThuBaNguyen <thu@os.amperecomputing.com>2022-10-06 11:16:38 +0300
commitb3c8264887cc37cc8fc7cafd1c66ba76da23fc39 (patch)
tree563af3f3f9401e08ec19b9f912073495f4ca8b5a /meta-ampere/meta-common
parent45a89b65e97053842bcb6a468ec1b3e454edb8c9 (diff)
downloadopenbmc-b3c8264887cc37cc8fc7cafd1c66ba76da23fc39.tar.xz
meta-ampere: refactor drivers binder services
Use obmc-power-already-on target to trigger ampere-power-on-driver-binder scripts instead of intergrating code to ampere-host-check service. Use obmc-host-already-running target to trigger ampere-host-on-driver-binder scripts. Add ampere-power-on-driver-binder service. Tested: 1. ampere-power-on-driver-binder scripst should be called when the chassis-power-control pin is triggered and only when the drivers are not bound. 2. ampere-host-on-driver-binder scripts will be called when the host is already on, right after host0-ready. Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com> Change-Id: I02f83d60a603dbc8d214534a13162f504c8c7deb
Diffstat (limited to 'meta-ampere/meta-common')
-rw-r--r--meta-ampere/meta-common/recipes-ampere/platform/ampere-driver-binder.bb35
-rw-r--r--meta-ampere/meta-common/recipes-ampere/platform/ampere-driver-binder/ampere-host-on-driver-binder@.service13
-rw-r--r--meta-ampere/meta-common/recipes-ampere/platform/ampere-driver-binder/ampere-power-on-driver-binder@.service10
3 files changed, 58 insertions, 0 deletions
diff --git a/meta-ampere/meta-common/recipes-ampere/platform/ampere-driver-binder.bb b/meta-ampere/meta-common/recipes-ampere/platform/ampere-driver-binder.bb
new file mode 100644
index 0000000000..498ed50ba6
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-ampere/platform/ampere-driver-binder.bb
@@ -0,0 +1,35 @@
+SUMMARY = "Ampere Driver Binder Implementation"
+DESCRIPTION = "The driver binder for Ampere Computing LLC's systems"
+PR = "r1"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+inherit systemd
+inherit obmc-phosphor-systemd
+
+RDEPENDS:${PN} = "bash"
+S = "${WORKDIR}"
+
+SRC_URI = " \
+ file://ampere-power-on-driver-binder@.service \
+ file://ampere-host-on-driver-binder@.service \
+ "
+
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE:${PN} = " \
+ ampere-power-on-driver-binder@.service \
+ ampere-host-on-driver-binder@.service \
+ "
+# bind driver after the power is on
+POWER_ON_DRIVER_BINDER_TGT = "ampere-power-on-driver-binder@.service"
+POWER_ON_DRIVER_BINDER_INSTMPL = "ampere-power-on-driver-binder@{0}.service"
+AMPER_POWER_ON = "obmc-power-already-on@{0}.target"
+POWER_ON_DRIVER_BINDER_TARGET_FMT = "../${POWER_ON_DRIVER_BINDER_TGT}:${AMPER_POWER_ON}.wants/${POWER_ON_DRIVER_BINDER_INSTMPL}"
+SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'POWER_ON_DRIVER_BINDER_TARGET_FMT', 'OBMC_HOST_INSTANCES')}"
+
+# bind driver after the host is on
+HOST_ON_DRIVER_BINDER_TGT = "ampere-host-on-driver-binder@.service"
+HOST_ON_DRIVER_BINDER_INSTMPL = "ampere-host-on-driver-binder@{0}.service"
+AMPER_HOST_RUNNING = "obmc-host-already-on@{0}.target"
+HOST_ON_DRIVER_BINDER_TARGET_FMT = "../${HOST_ON_DRIVER_BINDER_TGT}:${AMPER_HOST_RUNNING}.wants/${HOST_ON_DRIVER_BINDER_INSTMPL}"
+SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_ON_DRIVER_BINDER_TARGET_FMT', 'OBMC_HOST_INSTANCES')}"
diff --git a/meta-ampere/meta-common/recipes-ampere/platform/ampere-driver-binder/ampere-host-on-driver-binder@.service b/meta-ampere/meta-common/recipes-ampere/platform/ampere-driver-binder/ampere-host-on-driver-binder@.service
new file mode 100644
index 0000000000..f2a83d4f6b
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-ampere/platform/ampere-driver-binder/ampere-host-on-driver-binder@.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Ampere host on driver binder %i
+After=obmc-host-already-on@%i.target
+BindTo=obmc-host-already-on@%i.target
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh -c "if command -v ampere_host_on_driver_binder.sh; then echo 'Try to bind driver after host on if does not' && ampere_host_on_driver_binder.sh; fi && exit 0;"
+SyslogIdentifier=host_on_binder
+RemainAfterExit=no
+
+[Install]
+WantedBy=obmc-host-already-on@%i.target
diff --git a/meta-ampere/meta-common/recipes-ampere/platform/ampere-driver-binder/ampere-power-on-driver-binder@.service b/meta-ampere/meta-common/recipes-ampere/platform/ampere-driver-binder/ampere-power-on-driver-binder@.service
new file mode 100644
index 0000000000..01a380bd7b
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-ampere/platform/ampere-driver-binder/ampere-power-on-driver-binder@.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Ampere power on driver binder %i
+After=obmc-power-already-on@%i.target
+BindTo=obmc-power-already-on@%i.target
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh -c "if command -v ampere_power_on_driver_binder.sh; then echo 'Try to bind driver after power on if does not' && ampere_power_on_driver_binder.sh; fi && exit 0;"
+SyslogIdentifier=power_on_binder
+RemainAfterExit=no \ No newline at end of file