1SUMMARY = "Phosphor State Management" 2DESCRIPTION = "Phosphor State Manager provides a set of system state \ 3management daemons. It is suitable for use on a wide variety of OpenBMC \ 4platforms." 5HOMEPAGE = "https://github.com/openbmc/phosphor-state-manager" 6PR = "r1" 7PV = "1.0+git${SRCPV}" 8LICENSE = "Apache-2.0" 9LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" 10 11include phosphor-state-manager-systemd-links.inc 12 13STATE_MGR_PACKAGES = " \ 14 ${PN}-host \ 15 ${PN}-chassis \ 16 ${PN}-bmc \ 17 ${PN}-hypervisor \ 18 ${PN}-discover \ 19 ${PN}-host-check \ 20 ${PN}-reset-sensor-states \ 21 ${PN}-systemd-target-monitor \ 22 ${PN}-obmc-targets \ 23 ${PN}-scheduled-host-transition \ 24 ${PN}-chassis-check-power-status \ 25 ${PN}-secure-check \ 26 ${PN}-chassis-poweron-log \ 27" 28PACKAGE_BEFORE_PN += "${STATE_MGR_PACKAGES}" 29ALLOW_EMPTY:${PN} = "1" 30 31DBUS_PACKAGES = "${STATE_MGR_PACKAGES}" 32 33SYSTEMD_PACKAGES = "${PN}-discover \ 34 ${PN}-reset-sensor-states \ 35 ${PN}-systemd-target-monitor \ 36" 37 38# The host-check function will check if the host is running 39# after a BMC reset. 40# The reset-sensor-states function will reset the host 41# sensors on a BMC reset or system power loss. 42# Neither is required for host state function but are 43# recommended to deal properly with these reset scenarios. 44RRECOMMENDS:${PN}-host = "${PN}-host-check ${PN}-reset-sensor-states" 45 46# The obmc-targets are the base targets required to boot a computer system 47RRECOMMENDS:${PN}-host += "${PN}-obmc-targets" 48 49# Make it the default to create an info log when the chassis transitions 50# from off to on 51RRECOMMENDS:${PN}-chassis:append = " ${PN}-chassis-poweron-log" 52 53inherit meson pkgconfig 54inherit obmc-phosphor-dbus-service 55inherit obmc-phosphor-systemd 56 57DEPENDS += "sdbusplus" 58DEPENDS += "sdeventplus" 59DEPENDS += "phosphor-logging" 60DEPENDS += "phosphor-dbus-interfaces" 61DEPENDS += "libcereal" 62DEPENDS += "nlohmann-json" 63DEPENDS += "cli11" 64DEPENDS += "libgpiod" 65 66RDEPENDS:${PN}-chassis += "bash" 67RDEPENDS:${PN}-host += "bash" 68 69EXTRA_OEMESON:append = " -Dtests=disabled" 70 71FILES:${PN}-host = "${bindir}/phosphor-host-state-manager" 72FILES:${PN}-host += "${libexecdir}/host-reboot" 73DBUS_SERVICE:${PN}-host += "xyz.openbmc_project.State.Host@.service" 74DBUS_SERVICE:${PN}-host += "phosphor-reboot-host@.service" 75SYSTEMD_SERVICE:${PN}-host += "phosphor-reset-host-reboot-attempts@.service" 76SYSTEMD_SERVICE:${PN}-host += "phosphor-clear-one-time@.service" 77SYSTEMD_SERVICE:${PN}-host += "phosphor-set-host-transition-to-running@.service" 78SYSTEMD_SERVICE:${PN}-host += "phosphor-set-host-transition-to-off@.service" 79 80FILES:${PN}-chassis = "${bindir}/phosphor-chassis-state-manager" 81DBUS_SERVICE:${PN}-chassis += "xyz.openbmc_project.State.Chassis@.service" 82SYSTEMD_SERVICE:${PN}-chassis += "obmc-power-start@.service" 83SYSTEMD_SERVICE:${PN}-chassis += "obmc-power-stop@.service" 84SYSTEMD_SERVICE:${PN}-chassis += "obmc-powered-off@.service" 85SYSTEMD_SERVICE:${PN}-chassis += "phosphor-reset-chassis-on@.service" 86SYSTEMD_SERVICE:${PN}-chassis += "phosphor-reset-chassis-running@.service" 87 88SYSTEMD_SERVICE:${PN}-chassis-poweron-log += "phosphor-create-chassis-poweron-log@.service" 89 90FILES:${PN}-chassis += "${bindir}/obmcutil" 91 92FILES:${PN}-bmc = "${bindir}/phosphor-bmc-state-manager" 93FILES:${PN}-bmc += "${sysconfdir}/phosphor-systemd-target-monitor/phosphor-service-monitor-default.json" 94DBUS_SERVICE:${PN}-bmc += "xyz.openbmc_project.State.BMC.service" 95DBUS_SERVICE:${PN}-bmc += "obmc-bmc-service-quiesce@.target" 96 97FILES:${PN}-secure-check = "${bindir}/phosphor-secure-boot-check" 98SYSTEMD_SERVICE:${PN}-secure-check += "phosphor-bmc-security-check.service" 99 100FILES:${PN}-hypervisor = "${bindir}/phosphor-hypervisor-state-manager" 101DBUS_SERVICE:${PN}-hypervisor += "xyz.openbmc_project.State.Hypervisor.service" 102 103FILES:${PN}-discover = "${bindir}/phosphor-discover-system-state" 104SYSTEMD_SERVICE:${PN}-discover += "phosphor-discover-system-state@.service" 105 106FILES:${PN}-host-check = "${bindir}/phosphor-host-check" 107SYSTEMD_SERVICE:${PN}-host-check += "phosphor-reset-host-running@.service" 108FILES:${PN}-host-check = "${bindir}/phosphor-host-reset-recovery" 109SYSTEMD_SERVICE:${PN}-host-check += "phosphor-reset-host-recovery@.service" 110 111 112SYSTEMD_SERVICE:${PN}-reset-sensor-states += "phosphor-reset-sensor-states@.service" 113 114FILES:${PN}-systemd-target-monitor = " \ 115 ${bindir}/phosphor-systemd-target-monitor \ 116 ${sysconfdir}/phosphor-systemd-target-monitor/phosphor-target-monitor-default.json \ 117 " 118SYSTEMD_SERVICE:${PN}-systemd-target-monitor += "phosphor-systemd-target-monitor.service" 119 120FILES:${PN}-scheduled-host-transition = "${bindir}/phosphor-scheduled-host-transition" 121DBUS_SERVICE:${PN}-scheduled-host-transition += "xyz.openbmc_project.State.ScheduledHostTransition@.service" 122 123FILES:${PN}-chassis-check-power-status = "${bindir}/phosphor-chassis-check-power-status" 124SYSTEMD_SERVICE:${PN}-chassis-check-power-status += "phosphor-chassis-check-power-status@.service" 125 126# Chassis power synchronization targets 127# - start-pre: Services to run before we start power on process 128# - start: Services to run to do the chassis power on 129# - on: Services to run once power is on 130# - stop-pre,stop,off: Same as above but applied to powering off 131# - reset-on: Services to check if chassis power is on after bmc reset 132CHASSIS_SYNCH_TARGETS = "start-pre start on stop-pre stop off reset-on" 133 134# Chassis action power targets 135# - on: Services to run to power on the chassis 136# - off: Services to run to power off the chassis 137# - cycle: Services to run to cycle power to the chassis 138# - powered-off: Services to run once chassis power is off 139# - reset: Services to check chassis power state and update chassis "on" target 140# - hard-off: Services to force an immediate power off of the chassis 141# - blackout: Target to enter when chassis experiences blackout 142CHASSIS_ACTION_TARGETS = "poweron poweroff powercycle powered-off powerreset hard-poweroff blackout" 143 144# Track all host synchronization point targets 145# - start-pre: Services to run before we start host boot 146# - starting: Services to run to do the host boot 147# - started: Services to run once the host is booted 148# - stop-pre,stopping,stopped: Same as above but applied to shutting down the host 149# - reset-running: Services to check if host is running after bmc reset 150HOST_SYNCH_TARGETS = "start-pre starting started stop-pre stopping stopped reset-running" 151 152# Track all host action targets 153# - start: Will run startmin target, this target used for any additional 154# services that user needs for an initial power on of host. 155# For example, resetting the host reboot count could be put in 156# this target so on any fresh power on, this count is reset. 157# - startmin: Minimum services required to start the host. This target will 158# be called by reboot and start target. 159# - stop: Services to run to shutdown the host 160# - quiesce: Target to enter on host boot failure 161# - graceful-quiesce: Target to enter on host boot failure (allow host graceful shutdown) 162# - shutdown: Tell host to shutdown, then stop system 163# - reset: Services to check if host is running and update host "start" target 164# - crash: Target to run when host crashes. it is very much similar to 165# quiesce target but the only delta is that this target contains 166# multiple services and one of them is the quiesce target. 167# - timeout: Target to run when host watchdog times out 168# - reboot: Reboot the host with a chassis power cycle included 169# - warm-reboot: Reboot the host without a chassis power cycle. 170# - force-warm-reboot: Reboot the host without a chassis power cycle and without 171# notifying the host. 172# - diagnostic-mode: This will be entered when the host is collecting diagnostic 173# data for itself. 174HOST_ACTION_TARGETS = "start startmin stop quiesce graceful-quiesce reset shutdown crash timeout " 175HOST_ACTION_TARGETS += "reboot warm-reboot force-warm-reboot diagnostic-mode" 176 177CHASSIS_SYNCH_FMT = "obmc-power-{0}@.target" 178CHASSIS_ACTION_FMT = "obmc-chassis-{0}@.target" 179HOST_SYNCH_FMT = "obmc-host-{0}@.target" 180HOST_ACTION_FMT = "obmc-host-{0}@.target" 181 182CHASSIS_LINK_SYNCH_FMT = "${CHASSIS_SYNCH_FMT}:obmc-power-{0}@{1}.target" 183CHASSIS_LINK_ACTION_FMT = "${CHASSIS_ACTION_FMT}:obmc-chassis-{0}@{1}.target" 184HOST_LINK_SYNCH_FMT = "${HOST_SYNCH_FMT}:obmc-host-{0}@{1}.target" 185HOST_LINK_ACTION_FMT = "${HOST_ACTION_FMT}:obmc-host-{0}@{1}.target" 186FAN_LINK_FMT = "obmc-fan-control-ready@.target:obmc-fan-control-ready@{0}.target" 187 188# Targets to be executed on checkstop and watchdog timeout 189HOST_ERROR_TARGETS = "timeout" 190 191QUIESCE_TMPL = "obmc-host-quiesce@.target" 192CRASH_TIMEOUT_TGTFMT = "obmc-host-{0}@{1}.target" 193QUIESCE_INSTFMT = "obmc-host-quiesce@{1}.target" 194QUIESCE_FMT = "../${QUIESCE_TMPL}:${CRASH_TIMEOUT_TGTFMT}.wants/${QUIESCE_INSTFMT}" 195 196SYSTEMD_SERVICE:${PN}-obmc-targets += " \ 197 obmc-fans-ready.target \ 198 obmc-fan-control.target \ 199 obmc-fan-control-ready@.target \ 200 obmc-fan-watchdog-takeover.target \ 201 " 202 203SYSTEMD_SERVICE:${PN}-obmc-targets += "${@compose_list(d, 'CHASSIS_SYNCH_FMT', 'CHASSIS_SYNCH_TARGETS')}" 204SYSTEMD_SERVICE:${PN}-obmc-targets += "${@compose_list(d, 'CHASSIS_ACTION_FMT', 'CHASSIS_ACTION_TARGETS')}" 205SYSTEMD_SERVICE:${PN}-obmc-targets += "${@compose_list(d, 'HOST_SYNCH_FMT', 'HOST_SYNCH_TARGETS')}" 206SYSTEMD_SERVICE:${PN}-obmc-targets += "${@compose_list(d, 'HOST_ACTION_FMT', 'HOST_ACTION_TARGETS')}" 207 208SYSTEMD_LINK:${PN}-obmc-targets += "${@compose_list(d, 'CHASSIS_LINK_SYNCH_FMT', 'CHASSIS_SYNCH_TARGETS', 'OBMC_CHASSIS_INSTANCES')}" 209SYSTEMD_LINK:${PN}-obmc-targets += "${@compose_list(d, 'CHASSIS_LINK_ACTION_FMT', 'CHASSIS_ACTION_TARGETS', 'OBMC_CHASSIS_INSTANCES')}" 210SYSTEMD_LINK:${PN}-obmc-targets += "${@compose_list(d, 'HOST_LINK_SYNCH_FMT', 'HOST_SYNCH_TARGETS', 'OBMC_HOST_INSTANCES')}" 211SYSTEMD_LINK:${PN}-obmc-targets += "${@compose_list(d, 'HOST_LINK_ACTION_FMT', 'HOST_ACTION_TARGETS', 'OBMC_HOST_INSTANCES')}" 212SYSTEMD_LINK:${PN}-obmc-targets += "${@compose_list(d, 'FAN_LINK_FMT', 'OBMC_CHASSIS_INSTANCES')}" 213SYSTEMD_LINK:${PN}-obmc-targets += "${@compose_list(d, 'QUIESCE_FMT', 'HOST_ERROR_TARGETS', 'OBMC_HOST_INSTANCES')}" 214 215# Create target relationships 216 217# Starting the host requires chassis power on 218START_TMPL_CTRL = "obmc-chassis-poweron@.target" 219START_TGTFMT_CTRL = "obmc-host-startmin@{1}.target" 220START_INSTFMT_CTRL = "obmc-chassis-poweron@{0}.target" 221START_FMT_CTRL = "../${START_TMPL_CTRL}:${START_TGTFMT_CTRL}.requires/${START_INSTFMT_CTRL}" 222SYSTEMD_LINK:${PN}-obmc-targets += "${@compose_list_zip(d, 'START_FMT_CTRL', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" 223 224# Chassis off requires host off 225STOP_TMPL_CTRL = "obmc-host-stop@.target" 226STOP_TGTFMT_CTRL = "obmc-chassis-poweroff@{0}.target" 227STOP_INSTFMT_CTRL = "obmc-host-stop@{1}.target" 228STOP_FMT_CTRL = "../${STOP_TMPL_CTRL}:${STOP_TGTFMT_CTRL}.requires/${STOP_INSTFMT_CTRL}" 229SYSTEMD_LINK:${PN}-obmc-targets += "${@compose_list_zip(d, 'STOP_FMT_CTRL', 'OBMC_CHASSIS_INSTANCES', 'OBMC_HOST_INSTANCES')}" 230 231# Hard power off requires chassis off 232HARD_OFF_TMPL_CTRL = "obmc-chassis-poweroff@.target" 233HARD_OFF_TGTFMT_CTRL = "obmc-chassis-hard-poweroff@{0}.target" 234HARD_OFF_INSTFMT_CTRL = "obmc-chassis-poweroff@{0}.target" 235HARD_OFF_FMT_CTRL = "../${HARD_OFF_TMPL_CTRL}:${HARD_OFF_TGTFMT_CTRL}.requires/${HARD_OFF_INSTFMT_CTRL}" 236SYSTEMD_LINK:${PN}-obmc-targets += "${@compose_list_zip(d, 'HARD_OFF_FMT_CTRL', 'OBMC_CHASSIS_INSTANCES')}" 237 238# Force the standby target to run the chassis reset check target 239RESET_TMPL_CTRL = "obmc-chassis-powerreset@.target" 240SYSD_TGT = "multi-user.target" 241RESET_INSTFMT_CTRL = "obmc-chassis-powerreset@{0}.target" 242RESET_FMT_CTRL = "../${RESET_TMPL_CTRL}:${SYSD_TGT}.wants/${RESET_INSTFMT_CTRL}" 243SYSTEMD_LINK:${PN}-obmc-targets += "${@compose_list_zip(d, 'RESET_FMT_CTRL', 'OBMC_CHASSIS_INSTANCES')}" 244 245SRC_URI = "git://github.com/openbmc/phosphor-state-manager;branch=master;protocol=https" 246SRCREV = "57c0a893cd5cb987633d278e09f941f7899a81b0" 247 248S = "${WORKDIR}/git" 249