1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
SUMMARY = "Phosphor State Management"
DESCRIPTION = "Phosphor State Manager provides a set of system state \
management daemons. It is suitable for use on a wide variety of OpenBMC \
platforms."
HOMEPAGE = "https://github.com/openbmc/phosphor-state-manager"
PR = "r1"
PV = "1.0+git${SRCPV}"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
STATE_MGR_PACKAGES = " \
${PN}-host \
${PN}-chassis \
${PN}-bmc \
${PN}-discover \
${PN}-host-check \
${PN}-reset-sensor-states \
${PN}-systemd-target-monitor \
${PN}-obmc-targets \
"
PACKAGE_BEFORE_PN += "${STATE_MGR_PACKAGES}"
ALLOW_EMPTY_${PN} = "1"
DBUS_PACKAGES = "${STATE_MGR_PACKAGES}"
SYSTEMD_PACKAGES = "${PN}-discover \
${PN}-reset-sensor-states \
${PN}-systemd-target-monitor \
"
# The host-check function will check if the host is running
# after a BMC reset.
# The reset-sensor-states function will reset the host
# sensors on a BMC reset or system power loss.
# Neither is required for host state function but are
# recommended to deal properly with these reset scenarios.
RRECOMMENDS_${PN}-host = "${PN}-host-check ${PN}-reset-sensor-states"
# The obmc-targets are the base targets required to boot a computer system
RRECOMMENDS_${PN}-host += "${PN}-obmc-targets"
inherit meson pkgconfig
inherit obmc-phosphor-dbus-service
DEPENDS += "sdbusplus"
DEPENDS += "sdeventplus"
DEPENDS += "phosphor-logging"
DEPENDS += "phosphor-dbus-interfaces"
DEPENDS += "libcereal"
DEPENDS += "nlohmann-json"
DEPENDS += "cli11"
FILES_${PN}-host = "${bindir}/phosphor-host-state-manager"
DBUS_SERVICE_${PN}-host += "xyz.openbmc_project.State.Host.service"
DBUS_SERVICE_${PN}-host += "phosphor-reboot-host@.service"
SYSTEMD_SERVICE_${PN}-host += "phosphor-reset-host-reboot-attempts@.service"
FILES_${PN}-chassis = "${bindir}/phosphor-chassis-state-manager"
DBUS_SERVICE_${PN}-chassis += "xyz.openbmc_project.State.Chassis.service"
FILES_${PN}-chassis += "${bindir}/obmcutil"
FILES_${PN}-bmc = "${bindir}/phosphor-bmc-state-manager"
DBUS_SERVICE_${PN}-bmc += "xyz.openbmc_project.State.BMC.service"
FILES_${PN}-discover = "${bindir}/phosphor-discover-system-state"
SYSTEMD_SERVICE_${PN}-discover += "phosphor-discover-system-state@.service"
FILES_${PN}-host-check = "${bindir}/phosphor-host-check"
SYSTEMD_SERVICE_${PN}-host-check += "phosphor-reset-host-check@.service"
SYSTEMD_SERVICE_${PN}-host-check += "phosphor-reset-host-running@.service"
SYSTEMD_SERVICE_${PN}-reset-sensor-states += "phosphor-reset-sensor-states@.service"
FILES_${PN}-systemd-target-monitor = " \
${bindir}/phosphor-systemd-target-monitor \
${sysconfdir}/phosphor-systemd-target-monitor/phosphor-target-monitor-default.json \
"
SYSTEMD_SERVICE_${PN}-systemd-target-monitor += "phosphor-systemd-target-monitor.service"
RESET_CHECK_TMPL = "phosphor-reset-host-check@.service"
RESET_CHECK_TGTFMT = "obmc-host-reset@{1}.target"
RESET_CHECK_INSTFMT = "phosphor-reset-host-check@{0}.service"
RESET_CHECK_FMT = "../${RESET_CHECK_TMPL}:${RESET_CHECK_TGTFMT}.requires/${RESET_CHECK_INSTFMT}"
SENSOR_RESET_TMPL = "phosphor-reset-sensor-states@.service"
SENSOR_RESET_TGTFMT = "obmc-host-reset@{1}.target"
SENSOR_RESET_INSTFMT = "phosphor-reset-sensor-states@{0}.service"
SENSOR_RESET_FMT = "../${SENSOR_RESET_TMPL}:${SENSOR_RESET_TGTFMT}.requires/${SENSOR_RESET_INSTFMT}"
RESET_RUNNING_TMPL = "phosphor-reset-host-running@.service"
RESET_RUNNING_TGTFMT = "obmc-host-reset@{1}.target"
RESET_RUNNING_INSTFMT = "phosphor-reset-host-running@{0}.service"
RESET_RUNNING_FMT = "../${RESET_RUNNING_TMPL}:${RESET_RUNNING_TGTFMT}.requires/${RESET_RUNNING_INSTFMT}"
SYSTEMD_LINK_${PN}-host-check += "${@compose_list_zip(d, 'RESET_CHECK_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
SYSTEMD_LINK_${PN}-host-check += "${@compose_list_zip(d, 'RESET_RUNNING_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
SYSTEMD_LINK_${PN}-reset-sensor-states += "${@compose_list_zip(d, 'SENSOR_RESET_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
# Force the standby target to run the host reset check target
RESET_TMPL_CTRL = "obmc-host-reset@.target"
SYSD_TGT = "multi-user.target"
RESET_INSTFMT_CTRL = "obmc-host-reset@{0}.target"
RESET_FMT_CTRL = "../${RESET_TMPL_CTRL}:${SYSD_TGT}.wants/${RESET_INSTFMT_CTRL}"
SYSTEMD_LINK_${PN}-host-check += "${@compose_list_zip(d, 'RESET_FMT_CTRL', 'OBMC_HOST_INSTANCES')}"
TMPL = "phosphor-discover-system-state@.service"
INSTFMT = "phosphor-discover-system-state@{0}.service"
FMT = "../${TMPL}:multi-user.target.wants/${INSTFMT}"
SYSTEMD_LINK_${PN}-discover += "${@compose_list(d, 'FMT', 'OBMC_HOST_INSTANCES')}"
# Force the shutdown target to run the chassis-poweroff target
CHASSIS_STOP_TMPL = "obmc-chassis-poweroff@.target"
HOST_STOP_TGTFMT = "obmc-host-shutdown@{1}.target"
CHASSIS_STOP_INSTFMT = "obmc-chassis-poweroff@{0}.target"
HOST_STOP_FMT = "../${CHASSIS_STOP_TMPL}:${HOST_STOP_TGTFMT}.requires/${CHASSIS_STOP_INSTFMT}"
SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_STOP_FMT', 'OBMC_CHASSIS_INSTANCES', 'OBMC_HOST_INSTANCES')}"
# Force the host reboot target to run the shutdown target
HOST_SHUTDOWN_TMPL = "obmc-host-shutdown@.target"
HOST_REBOOT_TGTFMT = "obmc-host-reboot@{0}.target"
HOST_SHUTDOWN_INSTFMT = "obmc-host-shutdown@{0}.target"
HOST_REBOOT_FMT = "../${HOST_SHUTDOWN_TMPL}:${HOST_REBOOT_TGTFMT}.requires/${HOST_SHUTDOWN_INSTFMT}"
SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_REBOOT_FMT', 'OBMC_HOST_INSTANCES')}"
# And also force the reboot target to call the host startmin service
HOST_REBOOT_SVC = "phosphor-reboot-host@.service"
HOST_REBOOT_SVC_INST = "phosphor-reboot-host@{0}.service"
HOST_REBOOT_SVC_FMT = "../${HOST_REBOOT_SVC}:${HOST_REBOOT_TGTFMT}.requires/${HOST_REBOOT_SVC_INST}"
SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_REBOOT_SVC_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
# Force the host-start target to call the host-startmin target
HOST_STARTMIN_TMPL = "obmc-host-startmin@.target"
HOST_START_TGTFMT = "obmc-host-start@{0}.target"
HOST_STARTMIN_INSTFMT = "obmc-host-startmin@{0}.target"
HOST_START_FMT = "../${HOST_STARTMIN_TMPL}:${HOST_START_TGTFMT}.requires/${HOST_STARTMIN_INSTFMT}"
SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_START_FMT', 'OBMC_HOST_INSTANCES')}"
# Force the host-start target to call the reboot count reset service
HOST_RST_RBT_ATTEMPTS_SVC = "phosphor-reset-host-reboot-attempts@.service"
HOST_RST_RBT_ATTEMPTS_SVC_INST = "phosphor-reset-host-reboot-attempts@{0}.service"
HOST_RST_RBT_ATTEMPTS_SVC_FMT = "../${HOST_RST_RBT_ATTEMPTS_SVC}:${HOST_START_TGTFMT}.requires/${HOST_RST_RBT_ATTEMPTS_SVC_INST}"
SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_RST_RBT_ATTEMPTS_SVC_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
# Force warm reboot target to call soft power off
HOST_WARM_REBOOT_TGTFMT = "obmc-host-warm-reboot@{0}.target"
HOST_WARM_REBOOT_SOFT_SVC = "xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
HOST_WARM_REBOOT_SOFT_SVC_FMT = "../${HOST_WARM_REBOOT_SOFT_SVC}:${HOST_WARM_REBOOT_TGTFMT}.requires/${HOST_WARM_REBOOT_SOFT_SVC}"
SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_SOFT_SVC_FMT', 'OBMC_HOST_INSTANCES')}"
# Force warm reboot target to call host stop
HOST_WARM_REBOOT_STOP_TMPL="obmc-host-stop@.target"
HOST_WARM_REBOOT_STOP_REQUIRES="obmc-host-force-warm-reboot@{0}.target"
HOST_WARM_REBOOT_STOP_TMPL_INST="obmc-host-stop@{0}.target"
HOST_WARM_REBOOT_STOP_TARGET_FMT = "../${HOST_WARM_REBOOT_STOP_TMPL}:${HOST_WARM_REBOOT_STOP_REQUIRES}.requires/${HOST_WARM_REBOOT_STOP_TMPL_INST}"
SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_STOP_TARGET_FMT', 'OBMC_HOST_INSTANCES')}"
# Force warm reboot target to call reboot host
HOST_WARM_REBOOT_FORCE_TGTFMT = "obmc-host-force-warm-reboot@{0}.target"
HOST_WARM_REBOOT_SVC = "phosphor-reboot-host@.service"
HOST_WARM_REBOOT_SVC_INST = "phosphor-reboot-host@{0}.service"
HOST_WARM_REBOOT_SVC_FMT = "../${HOST_WARM_REBOOT_SVC}:${HOST_WARM_REBOOT_FORCE_TGTFMT}.requires/${HOST_WARM_REBOOT_SVC_INST}"
SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_SVC_FMT', 'OBMC_HOST_INSTANCES')}"
# Warm reboot to call force warm reboot
# Warm reboot will be graceful due to to it also containing soft power off
HOST_WARM_REBOOT_FORCE_TGT = "obmc-host-force-warm-reboot@.target"
HOST_WARM_REBOOT_FORCE_TARGET_FMT = "../${HOST_WARM_REBOOT_FORCE_TGT}:${HOST_WARM_REBOOT_TGTFMT}.requires/${HOST_WARM_REBOOT_FORCE_TGTFMT}"
SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_FORCE_TARGET_FMT', 'OBMC_HOST_INSTANCES')}"
# Diagnostic target to call force warm reboot target
HOST_DIAG_TGTFMT = "obmc-host-diagnostic-mode@0.target"
HOST_DIAG_TARGET_FMT = "../${HOST_WARM_REBOOT_FORCE_TGT}:${HOST_DIAG_TGTFMT}.requires/${HOST_WARM_REBOOT_FORCE_TGTFMT}"
SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_DIAG_TARGET_FMT', 'OBMC_HOST_INSTANCES')}"
# Chassis power synchronization targets
# - start-pre: Services to run before we start power on process
# - start: Services to run to do the chassis power on
# - on: Services to run once power is on
# - stop-pre,stop,off: Same as above but applied to powering off
# - reset-on: Services to check if chassis power is on after bmc reset
CHASSIS_SYNCH_TARGETS = "start-pre start on stop-pre stop off reset-on"
# Chassis action power targets
# - on: Services to run to power on the chassis
# - off: Services to run to power off the chassis
# - powered-off: Services to run once chassis power is off
# - reset: Services to check chassis power state and update chassis "on" target
# - hard-off: Services to force an immediate power off of the chassis
CHASSIS_ACTION_TARGETS = "poweron poweroff powered-off powerreset hard-poweroff"
# Track all host synchronization point targets
# - start-pre: Services to run before we start host boot
# - starting: Services to run to do the host boot
# - started: Services to run once the host is booted
# - stop-pre,stopping,stopped: Same as above but applied to shutting down the host
# - reset-running: Services to check if host is running after bmc reset
HOST_SYNCH_TARGETS = "start-pre starting started stop-pre stopping stopped reset-running"
# Track all host action targets
# - start: Will run startmin target, this target used for any additional
# services that user needs for an initial power on of host.
# For example, resetting the host reboot count could be put in
# this target so on any fresh power on, this count is reset.
# - startmin: Minimum services required to start the host. This target will
# be called by reboot and start target.
# - stop: Services to run to shutdown the host
# - quiesce: Target to enter on host boot failure
# - shutdown: Tell host to shutdown, then stop system
# - reset: Services to check if host is running and update host "start" target
# - crash: Target to run when host crashes. it is very much similar to
# quiesce target but the only delta is that this target contains
# multiple services and one of them is the quiesce target.
# - timeout: Target to run when host watchdog times out
# - reboot: Reboot the host with a chassis power cycle included
# - warm-reboot: Reboot the host without a chassis power cycle.
# - force-warm-reboot: Reboot the host without a chassis power cycle and without
# notifying the host.
# - diagnostic-mode: This will be entered when the host is collecting diagnostic
# data for itself.
HOST_ACTION_TARGETS = "start startmin stop quiesce reset shutdown crash timeout "
HOST_ACTION_TARGETS += "reboot warm-reboot force-warm-reboot diagnostic-mode"
CHASSIS_SYNCH_FMT = "obmc-power-{0}@.target"
CHASSIS_ACTION_FMT = "obmc-chassis-{0}@.target"
HOST_SYNCH_FMT = "obmc-host-{0}@.target"
HOST_ACTION_FMT = "obmc-host-{0}@.target"
CHASSIS_LINK_SYNCH_FMT = "${CHASSIS_SYNCH_FMT}:obmc-power-{0}@{1}.target"
CHASSIS_LINK_ACTION_FMT = "${CHASSIS_ACTION_FMT}:obmc-chassis-{0}@{1}.target"
HOST_LINK_SYNCH_FMT = "${HOST_SYNCH_FMT}:obmc-host-{0}@{1}.target"
HOST_LINK_ACTION_FMT = "${HOST_ACTION_FMT}:obmc-host-{0}@{1}.target"
FAN_LINK_FMT = "obmc-fan-control-ready@.target:obmc-fan-control-ready@{0}.target"
# Targets to be executed on checkstop and watchdog timeout
HOST_ERROR_TARGETS = "crash timeout"
QUIESCE_TMPL = "obmc-host-quiesce@.target"
CRASH_TIMEOUT_TGTFMT = "obmc-host-{0}@{1}.target"
QUIESCE_INSTFMT = "obmc-host-quiesce@{1}.target"
QUIESCE_FMT = "../${QUIESCE_TMPL}:${CRASH_TIMEOUT_TGTFMT}.wants/${QUIESCE_INSTFMT}"
SYSTEMD_SERVICE_${PN}-obmc-targets += " \
obmc-mapper.target \
obmc-fans-ready.target \
obmc-fan-control.target \
obmc-fan-control-ready@.target \
obmc-fan-watchdog-takeover.target \
"
SYSTEMD_SERVICE_${PN}-obmc-targets += "${@compose_list(d, 'CHASSIS_SYNCH_FMT', 'CHASSIS_SYNCH_TARGETS')}"
SYSTEMD_SERVICE_${PN}-obmc-targets += "${@compose_list(d, 'CHASSIS_ACTION_FMT', 'CHASSIS_ACTION_TARGETS')}"
SYSTEMD_SERVICE_${PN}-obmc-targets += "${@compose_list(d, 'HOST_SYNCH_FMT', 'HOST_SYNCH_TARGETS')}"
SYSTEMD_SERVICE_${PN}-obmc-targets += "${@compose_list(d, 'HOST_ACTION_FMT', 'HOST_ACTION_TARGETS')}"
SYSTEMD_LINK_${PN}-obmc-targets += "${@compose_list(d, 'CHASSIS_LINK_SYNCH_FMT', 'CHASSIS_SYNCH_TARGETS', 'OBMC_CHASSIS_INSTANCES')}"
SYSTEMD_LINK_${PN}-obmc-targets += "${@compose_list(d, 'CHASSIS_LINK_ACTION_FMT', 'CHASSIS_ACTION_TARGETS', 'OBMC_CHASSIS_INSTANCES')}"
SYSTEMD_LINK_${PN}-obmc-targets += "${@compose_list(d, 'HOST_LINK_SYNCH_FMT', 'HOST_SYNCH_TARGETS', 'OBMC_HOST_INSTANCES')}"
SYSTEMD_LINK_${PN}-obmc-targets += "${@compose_list(d, 'HOST_LINK_ACTION_FMT', 'HOST_ACTION_TARGETS', 'OBMC_HOST_INSTANCES')}"
SYSTEMD_LINK_${PN}-obmc-targets += "${@compose_list(d, 'FAN_LINK_FMT', 'OBMC_CHASSIS_INSTANCES')}"
SYSTEMD_LINK_${PN}-obmc-targets += "${@compose_list(d, 'QUIESCE_FMT', 'HOST_ERROR_TARGETS', 'OBMC_HOST_INSTANCES')}"
SRC_URI += "git://github.com/openbmc/phosphor-state-manager"
SRCREV = "47b96128da8da00c2238f1314a3be6b0a9c9fce5"
S = "${WORKDIR}/git"
|