Tung Nguyen | 8f221bf | 2020-12-16 05:52:18 +0000 | [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 | # For now, monitoring shutdown_ack and reboot_ack are the only usecases |
| 11 | OBMC_HOST_MONITOR_INSTANCES = "shutdown_ack reboot_ack" |
| 12 | SYSTEMD_ENVIRONMENT_FILE_${PN} +="obmc/gpio/shutdown_ack obmc/gpio/reboot_ack" |
| 13 | |
| 14 | S = "${WORKDIR}" |
| 15 | |
| 16 | SRC_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 | |
| 26 | DEPENDS = "systemd virtual/obmc-gpio-monitor" |
| 27 | RDEPENDS_${PN} = "bash virtual/obmc-gpio-monitor" |
| 28 | |
| 29 | SYSTEMD_PACKAGES = "${PN}" |
| 30 | SYSTEMD_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 |
| 41 | HOST_SHUTDOWN_TMPL = "ampere-host-shutdown.service" |
| 42 | HOST_SHUTDOWN_TGTFMT = "obmc-host-shutdown@{0}.target" |
| 43 | HOST_SHUTDOWN_FMT = "../${HOST_SHUTDOWN_TMPL}:${HOST_SHUTDOWN_TGTFMT}.requires/${HOST_SHUTDOWN_TMPL}" |
| 44 | SYSTEMD_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 |
| 47 | HOST_REBOOT_SVC = "ampere-host-power-cycle.service" |
| 48 | HOST_REBOOT_SVC_TGTFMT = "obmc-host-reboot@{0}.target" |
| 49 | HOST_REBOOT_SVC_FMT = "../${HOST_REBOOT_SVC}:${HOST_REBOOT_SVC_TGTFMT}.requires/${HOST_REBOOT_SVC}" |
| 50 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_REBOOT_SVC_FMT', 'OBMC_HOST_INSTANCES')}" |
| 51 | |
| 52 | # overwrite the host reset to graceful reset |
| 53 | HOST_WARM_REBOOT_SOFT_SVC = "ampere-host-reset.service" |
| 54 | HOST_WARM_REBOOT_TGTFMT = "obmc-host-warm-reboot@{0}.target" |
| 55 | HOST_WARM_REBOOT_SOFT_SVC_FMT = "../${HOST_WARM_REBOOT_SOFT_SVC}:${HOST_WARM_REBOOT_TGTFMT}.requires/${HOST_WARM_REBOOT_SOFT_SVC}" |
| 56 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_SOFT_SVC_FMT', 'OBMC_HOST_INSTANCES')}" |
| 57 | |
| 58 | # overwrite force reboot |
| 59 | HOST_WARM_REBOOT_FORCE_TGT = "ampere-host-force-reset.service" |
| 60 | HOST_WARM_REBOOT_FORCE_TGTFMT = "obmc-host-force-warm-reboot@{0}.target" |
| 61 | HOST_WARM_REBOOT_FORCE_TARGET_FMT = "../${HOST_WARM_REBOOT_FORCE_TGT}:${HOST_WARM_REBOOT_FORCE_TGTFMT}.requires/${HOST_WARM_REBOOT_FORCE_TGT}" |
| 62 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_FORCE_TARGET_FMT', 'OBMC_HOST_INSTANCES')}" |
| 63 | |
| 64 | # chassis power control |
| 65 | CHASSIS_POWERON_SVC = "ampere-chassis-poweron.service" |
| 66 | CHASSIS_POWERON_TGTFMT = "obmc-chassis-poweron@{0}.target" |
| 67 | CHASSIS_POWERON_FMT = "../${CHASSIS_POWERON_SVC}:${CHASSIS_POWERON_TGTFMT}.requires/${CHASSIS_POWERON_SVC}" |
| 68 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'CHASSIS_POWERON_FMT', 'OBMC_CHASSIS_INSTANCES')}" |
| 69 | |
| 70 | CHASSIS_POWEROFF_SVC = "ampere-chassis-poweroff.service" |
| 71 | CHASSIS_POWEROFF_TGTFMT = "obmc-chassis-poweroff@{0}.target" |
| 72 | CHASSIS_POWEROFF_FMT = "../${CHASSIS_POWEROFF_SVC}:${CHASSIS_POWEROFF_TGTFMT}.requires/${CHASSIS_POWEROFF_SVC}" |
| 73 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'CHASSIS_POWEROFF_FMT', 'OBMC_CHASSIS_INSTANCES')}" |
| 74 | |
| 75 | TMPL = "phosphor-gpio-monitor@.service" |
| 76 | INSTFMT = "phosphor-gpio-monitor@{0}.service" |
| 77 | TGT = "multi-user.target" |
| 78 | FMT = "../${TMPL}:${TGT}.requires/${INSTFMT}" |
| 79 | SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT', 'OBMC_HOST_MONITOR_INSTANCES')}" |
| 80 | |
| 81 | do_install() { |
| 82 | install -d ${D}/usr/sbin |
| 83 | install -m 0755 ${WORKDIR}/ampere_power_util.sh ${D}/${sbindir}/ampere_power_util.sh |
| 84 | } |
| 85 | |