1SUMMARY = "Ampere Computing LLC Host Control Implementation"
2DESCRIPTION = "A host control implementation suitable for Ampere Computing LLC's systems"
3PR = "r1"
4LICENSE = "Apache-2.0"
5LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
6
7inherit systemd
8inherit obmc-phosphor-systemd
9
10S = "${WORKDIR}"
11
12SRC_URI = "file://ampere-host-shutdown.service \
13          file://ampere_power_util.sh \
14          file://ampere-chassis-poweroff.service \
15          file://ampere-chassis-poweron.service \
16          file://ampere-chassis-powercycle.service \
17          file://ampere-host-shutdown-ack.service \
18          file://ampere-host-power-cycle.service \
19          file://ampere-host-reset.service \
20          "
21
22DEPENDS = "systemd"
23RDEPENDS:${PN} = "bash"
24
25SYSTEMD_PACKAGES = "${PN}"
26SYSTEMD_SERVICE:${PN} = " \
27        ampere-host-shutdown.service \
28        ampere-chassis-poweroff.service \
29        ampere-chassis-poweron.service \
30        ampere-chassis-powercycle.service \
31        ampere-host-shutdown-ack.service \
32        ampere-host-power-cycle.service \
33        ampere-host-reset.service \
34        "
35# host power control
36# overwrite the host shutdown to graceful shutdown
37HOST_SHUTDOWN_TMPL = "ampere-host-shutdown.service"
38HOST_SHUTDOWN_TGTFMT = "obmc-host-shutdown@{0}.target"
39HOST_SHUTDOWN_FMT = "../${HOST_SHUTDOWN_TMPL}:${HOST_SHUTDOWN_TGTFMT}.requires/${HOST_SHUTDOWN_TMPL}"
40SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_SHUTDOWN_FMT', 'OBMC_HOST_INSTANCES')}"
41
42# Force the power cycle target to run the ampere power cycle
43HOST_REBOOT_SVC = "ampere-host-power-cycle.service"
44HOST_REBOOT_SVC_TGTFMT = "obmc-host-reboot@{0}.target"
45HOST_REBOOT_SVC_FMT = "../${HOST_REBOOT_SVC}:${HOST_REBOOT_SVC_TGTFMT}.requires/${HOST_REBOOT_SVC}"
46SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_REBOOT_SVC_FMT', 'OBMC_HOST_INSTANCES')}"
47
48# chassis power control
49CHASSIS_POWERON_SVC = "ampere-chassis-poweron.service"
50CHASSIS_POWERON_TGTFMT = "obmc-chassis-poweron@{0}.target"
51CHASSIS_POWERON_FMT = "../${CHASSIS_POWERON_SVC}:${CHASSIS_POWERON_TGTFMT}.requires/${CHASSIS_POWERON_SVC}"
52SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'CHASSIS_POWERON_FMT', 'OBMC_CHASSIS_INSTANCES')}"
53
54CHASSIS_POWEROFF_SVC = "ampere-chassis-poweroff.service"
55CHASSIS_POWEROFF_TGTFMT = "obmc-chassis-poweroff@{0}.target"
56CHASSIS_POWEROFF_FMT = "../${CHASSIS_POWEROFF_SVC}:${CHASSIS_POWEROFF_TGTFMT}.requires/${CHASSIS_POWEROFF_SVC}"
57SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'CHASSIS_POWEROFF_FMT', 'OBMC_CHASSIS_INSTANCES')}"
58
59CHASSIS_POWERCYCLE_SVC = "ampere-chassis-powercycle.service"
60CHASSIS_POWERCYCLE_TGTFMT = "obmc-chassis-powercycle@{0}.target"
61CHASSIS_POWERCYCLE_FMT = "../${CHASSIS_POWERCYCLE_SVC}:${CHASSIS_POWERCYCLE_TGTFMT}.requires/${CHASSIS_POWERCYCLE_SVC}"
62SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'CHASSIS_POWERCYCLE_FMT', 'OBMC_CHASSIS_INSTANCES')}"
63
64TMPL = "phosphor-gpio-monitor@.service"
65INSTFMT = "phosphor-gpio-monitor@{0}.service"
66TGT = "multi-user.target"
67FMT = "../${TMPL}:${TGT}.requires/${INSTFMT}"
68SYSTEMD_LINK:${PN} += "${@compose_list(d, 'FMT', 'OBMC_HOST_MONITOR_INSTANCES')}"
69
70do_install() {
71    install -d ${D}${libexecdir}/${PN}
72    install -m 0755 ${WORKDIR}/ampere_power_util.sh ${D}${libexecdir}/${PN}/ampere_power_util.sh
73}
74