blob: e7c3cc160e354907d52c892b729b413551b74926 [file] [log] [blame]
Tung Nguyen8f221bf2020-12-16 05:52:18 +00001SUMMARY = "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
10# For now, monitoring shutdown_ack and reboot_ack are the only usecases
11OBMC_HOST_MONITOR_INSTANCES = "shutdown_ack reboot_ack"
12SYSTEMD_ENVIRONMENT_FILE_${PN} +="obmc/gpio/shutdown_ack obmc/gpio/reboot_ack"
13
14S = "${WORKDIR}"
15
16SRC_URI = "file://ampere-host-shutdown.service \
17 file://ampere-host-reset.service \
18 file://ampere_power_util.sh \
19 file://ampere-chassis-poweroff.service \
20 file://ampere-chassis-poweron.service \
21 file://ampere-host-reset-ack.service \
22 file://ampere-host-force-reset.service \
23 file://ampere-host-power-cycle.service \
24 "
25
26DEPENDS = "systemd virtual/obmc-gpio-monitor"
27RDEPENDS_${PN} = "bash virtual/obmc-gpio-monitor"
28
29SYSTEMD_PACKAGES = "${PN}"
30SYSTEMD_SERVICE_${PN} = " \
31 ampere-host-shutdown.service \
32 ampere-host-reset.service \
33 ampere-chassis-poweroff.service \
34 ampere-chassis-poweron.service \
35 ampere-host-reset-ack.service \
36 ampere-host-force-reset.service \
37 ampere-host-power-cycle.service \
38 "
39# host power control
40# overwrite the host shutdown to graceful shutdown
41HOST_SHUTDOWN_TMPL = "ampere-host-shutdown.service"
42HOST_SHUTDOWN_TGTFMT = "obmc-host-shutdown@{0}.target"
43HOST_SHUTDOWN_FMT = "../${HOST_SHUTDOWN_TMPL}:${HOST_SHUTDOWN_TGTFMT}.requires/${HOST_SHUTDOWN_TMPL}"
44SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_SHUTDOWN_FMT', 'OBMC_HOST_INSTANCES')}"
45
46# Force the power cycle target to run the ampere power cycle
47HOST_REBOOT_SVC = "ampere-host-power-cycle.service"
48HOST_REBOOT_SVC_TGTFMT = "obmc-host-reboot@{0}.target"
49HOST_REBOOT_SVC_FMT = "../${HOST_REBOOT_SVC}:${HOST_REBOOT_SVC_TGTFMT}.requires/${HOST_REBOOT_SVC}"
50SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_REBOOT_SVC_FMT', 'OBMC_HOST_INSTANCES')}"
51
52# overwrite the host reset to graceful reset
53HOST_WARM_REBOOT_SOFT_SVC = "ampere-host-reset.service"
54HOST_WARM_REBOOT_TGTFMT = "obmc-host-warm-reboot@{0}.target"
55HOST_WARM_REBOOT_SOFT_SVC_FMT = "../${HOST_WARM_REBOOT_SOFT_SVC}:${HOST_WARM_REBOOT_TGTFMT}.requires/${HOST_WARM_REBOOT_SOFT_SVC}"
56SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_SOFT_SVC_FMT', 'OBMC_HOST_INSTANCES')}"
57
58# overwrite force reboot
59HOST_WARM_REBOOT_FORCE_TGT = "ampere-host-force-reset.service"
60HOST_WARM_REBOOT_FORCE_TGTFMT = "obmc-host-force-warm-reboot@{0}.target"
61HOST_WARM_REBOOT_FORCE_TARGET_FMT = "../${HOST_WARM_REBOOT_FORCE_TGT}:${HOST_WARM_REBOOT_FORCE_TGTFMT}.requires/${HOST_WARM_REBOOT_FORCE_TGT}"
62SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_FORCE_TARGET_FMT', 'OBMC_HOST_INSTANCES')}"
63
64# chassis power control
65CHASSIS_POWERON_SVC = "ampere-chassis-poweron.service"
66CHASSIS_POWERON_TGTFMT = "obmc-chassis-poweron@{0}.target"
67CHASSIS_POWERON_FMT = "../${CHASSIS_POWERON_SVC}:${CHASSIS_POWERON_TGTFMT}.requires/${CHASSIS_POWERON_SVC}"
68SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'CHASSIS_POWERON_FMT', 'OBMC_CHASSIS_INSTANCES')}"
69
70CHASSIS_POWEROFF_SVC = "ampere-chassis-poweroff.service"
71CHASSIS_POWEROFF_TGTFMT = "obmc-chassis-poweroff@{0}.target"
72CHASSIS_POWEROFF_FMT = "../${CHASSIS_POWEROFF_SVC}:${CHASSIS_POWEROFF_TGTFMT}.requires/${CHASSIS_POWEROFF_SVC}"
73SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'CHASSIS_POWEROFF_FMT', 'OBMC_CHASSIS_INSTANCES')}"
74
75TMPL = "phosphor-gpio-monitor@.service"
76INSTFMT = "phosphor-gpio-monitor@{0}.service"
77TGT = "multi-user.target"
78FMT = "../${TMPL}:${TGT}.requires/${INSTFMT}"
79SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT', 'OBMC_HOST_MONITOR_INSTANCES')}"
80
81do_install() {
82 install -d ${D}/usr/sbin
83 install -m 0755 ${WORKDIR}/ampere_power_util.sh ${D}/${sbindir}/ampere_power_util.sh
84}
85