Mohaimen Alsamarai | 82a11d8 | 2021-06-24 16:59:29 -0500 | [diff] [blame] | 1 | SUMMARY = "Ampere Computing LLC Host Control Implementation" |
| 2 | DESCRIPTION = "A host control implementation suitable for Ampere Computing LLC's systems" |
| 3 | PR = "r1" |
| 4 | LICENSE = "Apache-2.0" |
| 5 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" |
| 6 | |
| 7 | inherit systemd |
| 8 | inherit obmc-phosphor-systemd |
| 9 | |
| 10 | S = "${WORKDIR}" |
| 11 | |
| 12 | SRC_URI = "file://ampere-host-shutdown.service \ |
| 13 | file://ampere-host-reset.service \ |
| 14 | file://ampere_power_util.sh \ |
| 15 | file://ampere-chassis-poweroff.service \ |
| 16 | file://ampere-chassis-poweron.service \ |
| 17 | file://ampere-host-reset-ack.service \ |
| 18 | file://ampere-host-force-reset.service \ |
| 19 | file://ampere-host-power-cycle.service \ |
| 20 | " |
| 21 | |
| 22 | DEPENDS = "systemd" |
| 23 | RDEPENDS_${PN} = "bash" |
| 24 | |
| 25 | SYSTEMD_PACKAGES = "${PN}" |
| 26 | SYSTEMD_SERVICE_${PN} = " \ |
| 27 | ampere-host-shutdown.service \ |
| 28 | ampere-host-reset.service \ |
| 29 | ampere-chassis-poweroff.service \ |
| 30 | ampere-chassis-poweron.service \ |
| 31 | ampere-host-reset-ack.service \ |
| 32 | ampere-host-force-reset.service \ |
| 33 | ampere-host-power-cycle.service \ |
| 34 | " |
| 35 | # host power control |
| 36 | # overwrite the host shutdown to graceful shutdown |
| 37 | HOST_SHUTDOWN_TMPL = "ampere-host-shutdown.service" |
| 38 | HOST_SHUTDOWN_TGTFMT = "obmc-host-shutdown@{0}.target" |
| 39 | HOST_SHUTDOWN_FMT = "../${HOST_SHUTDOWN_TMPL}:${HOST_SHUTDOWN_TGTFMT}.requires/${HOST_SHUTDOWN_TMPL}" |
| 40 | SYSTEMD_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 |
| 43 | HOST_REBOOT_SVC = "ampere-host-power-cycle.service" |
| 44 | HOST_REBOOT_SVC_TGTFMT = "obmc-host-reboot@{0}.target" |
| 45 | HOST_REBOOT_SVC_FMT = "../${HOST_REBOOT_SVC}:${HOST_REBOOT_SVC_TGTFMT}.requires/${HOST_REBOOT_SVC}" |
| 46 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_REBOOT_SVC_FMT', 'OBMC_HOST_INSTANCES')}" |
| 47 | |
| 48 | # overwrite the host reset to graceful reset |
| 49 | HOST_WARM_REBOOT_SOFT_SVC = "ampere-host-reset.service" |
| 50 | HOST_WARM_REBOOT_TGTFMT = "obmc-host-warm-reboot@{0}.target" |
| 51 | HOST_WARM_REBOOT_SOFT_SVC_FMT = "../${HOST_WARM_REBOOT_SOFT_SVC}:${HOST_WARM_REBOOT_TGTFMT}.requires/${HOST_WARM_REBOOT_SOFT_SVC}" |
| 52 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_SOFT_SVC_FMT', 'OBMC_HOST_INSTANCES')}" |
| 53 | |
| 54 | # overwrite force reboot |
| 55 | HOST_WARM_REBOOT_FORCE_TGT = "ampere-host-force-reset.service" |
| 56 | HOST_WARM_REBOOT_FORCE_TGTFMT = "obmc-host-force-warm-reboot@{0}.target" |
| 57 | HOST_WARM_REBOOT_FORCE_TARGET_FMT = "../${HOST_WARM_REBOOT_FORCE_TGT}:${HOST_WARM_REBOOT_FORCE_TGTFMT}.requires/${HOST_WARM_REBOOT_FORCE_TGT}" |
| 58 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_FORCE_TARGET_FMT', 'OBMC_HOST_INSTANCES')}" |
| 59 | |
| 60 | # chassis power control |
| 61 | CHASSIS_POWERON_SVC = "ampere-chassis-poweron.service" |
| 62 | CHASSIS_POWERON_TGTFMT = "obmc-chassis-poweron@{0}.target" |
| 63 | CHASSIS_POWERON_FMT = "../${CHASSIS_POWERON_SVC}:${CHASSIS_POWERON_TGTFMT}.requires/${CHASSIS_POWERON_SVC}" |
| 64 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'CHASSIS_POWERON_FMT', 'OBMC_CHASSIS_INSTANCES')}" |
| 65 | |
| 66 | CHASSIS_POWEROFF_SVC = "ampere-chassis-poweroff.service" |
| 67 | CHASSIS_POWEROFF_TGTFMT = "obmc-chassis-poweroff@{0}.target" |
| 68 | CHASSIS_POWEROFF_FMT = "../${CHASSIS_POWEROFF_SVC}:${CHASSIS_POWEROFF_TGTFMT}.requires/${CHASSIS_POWEROFF_SVC}" |
| 69 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'CHASSIS_POWEROFF_FMT', 'OBMC_CHASSIS_INSTANCES')}" |
| 70 | |
| 71 | TMPL = "phosphor-gpio-monitor@.service" |
| 72 | INSTFMT = "phosphor-gpio-monitor@{0}.service" |
| 73 | TGT = "multi-user.target" |
| 74 | FMT = "../${TMPL}:${TGT}.requires/${INSTFMT}" |
| 75 | SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT', 'OBMC_HOST_MONITOR_INSTANCES')}" |
| 76 | |
| 77 | do_install() { |
| 78 | install -d ${D}/usr/sbin |
| 79 | install -m 0755 ${WORKDIR}/ampere_power_util.sh ${D}/${sbindir}/ampere_power_util.sh |
| 80 | } |
| 81 | |