blob: 5dd6d12cf8802c48329a9c49ff013d22d64ae2c5 [file] [log] [blame]
Brad Bishop86ee1cf2016-06-27 14:53:52 -04001SUMMARY = "org.openbmc.control.Power implemention for OpenPOWER"
2DESCRIPTION = "A power control implementation suitable for OpenPOWER systems."
3PR = "r1"
4
5inherit skeleton-gdbus
Brad Bishop0fe80462016-08-17 20:27:37 -04006inherit obmc-phosphor-dbus-service
Saqib Khanc896e752017-11-13 10:47:54 -06007inherit pkgconfig
Brad Bishop0fe80462016-08-17 20:27:37 -04008
Brad Bishop1122eb02016-10-05 20:10:23 -04009DEPENDS += "phosphor-mapper systemd"
Brad Bishopecd773d2016-08-31 23:43:19 -040010
Brad Bishop86ee1cf2016-06-27 14:53:52 -040011SKELETON_DIR = "op-pwrctl"
Brad Bishop0fe80462016-08-17 20:27:37 -040012
13FMT = "org.openbmc.control.Power@{0}.service"
14DBUS_SERVICE_${PN} += "${@compose_list(d, 'FMT', 'OBMC_POWER_INSTANCES')}"
15
16SYSTEMD_SERVICE_${PN} += " \
17 op-power-start@.service \
18 op-wait-power-on@.service \
19 op-power-stop@.service \
20 op-wait-power-off@.service \
Josh D. Kingc41163a2017-05-18 09:33:36 -050021 op-reset-chassis-running@.service \
Andrew Geissler7dc14332017-03-07 13:47:23 -060022 op-reset-chassis-on@.service \
Brad Bishop0fe80462016-08-17 20:27:37 -040023 "
24
25SYSTEMD_ENVIRONMENT_FILE_${PN} += "obmc/power_control"
26
27START_TMPL = "op-power-start@.service"
Josh D. Kingb57615e2017-04-06 14:43:46 -050028START_TGTFMT = "obmc-chassis-poweron@{1}.target"
Brad Bishop0fe80462016-08-17 20:27:37 -040029START_INSTFMT = "op-power-start@{0}.service"
Andrew Geisslera31fba52017-02-08 15:54:25 -060030START_FMT = "../${START_TMPL}:${START_TGTFMT}.requires/${START_INSTFMT}"
Brad Bishop0fe80462016-08-17 20:27:37 -040031
32STOP_TMPL = "op-power-stop@.service"
Josh D. Kingb57615e2017-04-06 14:43:46 -050033STOP_TGTFMT = "obmc-chassis-poweroff@{1}.target"
Brad Bishop0fe80462016-08-17 20:27:37 -040034STOP_INSTFMT = "op-power-stop@{0}.service"
Andrew Geisslera31fba52017-02-08 15:54:25 -060035STOP_FMT = "../${STOP_TMPL}:${STOP_TGTFMT}.requires/${STOP_INSTFMT}"
Brad Bishop0fe80462016-08-17 20:27:37 -040036
37ON_TMPL = "op-wait-power-on@.service"
38ON_INSTFMT = "op-wait-power-on@{0}.service"
Andrew Geisslera31fba52017-02-08 15:54:25 -060039ON_FMT = "../${ON_TMPL}:${START_TGTFMT}.requires/${ON_INSTFMT}"
Brad Bishop0fe80462016-08-17 20:27:37 -040040
Andrew Geisslere2be4bb2016-12-19 09:05:39 -060041OFF_TMPL = "op-wait-power-off@.service"
Brad Bishop0fe80462016-08-17 20:27:37 -040042OFF_INSTFMT = "op-wait-power-off@{0}.service"
Andrew Geisslera31fba52017-02-08 15:54:25 -060043OFF_FMT = "../${OFF_TMPL}:${STOP_TGTFMT}.requires/${OFF_INSTFMT}"
Brad Bishop0fe80462016-08-17 20:27:37 -040044
Andrew Geisslerbc253aa2017-05-09 15:24:41 -050045RESET_TGTFMT = "obmc-chassis-powerreset@{1}.target"
Andrew Geissler997ed662017-03-05 20:36:50 -060046
Josh D. Kingc41163a2017-05-18 09:33:36 -050047RESET_ON_TMPL = "op-reset-chassis-running@.service"
48RESET_ON_INSTFMT = "op-reset-chassis-running@{0}.service"
Andrew Geissler997ed662017-03-05 20:36:50 -060049RESET_ON_FMT = "../${RESET_ON_TMPL}:${RESET_TGTFMT}.requires/${RESET_ON_INSTFMT}"
50
Andrew Geissler7dc14332017-03-07 13:47:23 -060051RESET_ON_CHASSIS_TMPL = "op-reset-chassis-on@.service"
52RESET_ON_CHASSIS_INSTFMT = "op-reset-chassis-on@{0}.service"
53RESET_ON_CHASSIS_FMT = "../${RESET_ON_CHASSIS_TMPL}:${RESET_TGTFMT}.requires/${RESET_ON_CHASSIS_INSTFMT}"
54
Andrew Geisslera31fba52017-02-08 15:54:25 -060055# Build up requires relationship for START_TGTFMT and STOP_TGTFMT
Brad Bishop0fe80462016-08-17 20:27:37 -040056SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'START_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
57SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'STOP_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
58SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'ON_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
59SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'OFF_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
Andrew Geissler997ed662017-03-05 20:36:50 -060060SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_ON_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
Andrew Geissler7dc14332017-03-07 13:47:23 -060061SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_ON_CHASSIS_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
Andrew Geissler44761d22017-01-23 14:40:26 -060062
Andrew Geisslera31fba52017-02-08 15:54:25 -060063# Now show that the main control target requires these power targets
Josh D. Kingb57615e2017-04-06 14:43:46 -050064START_TMPL_CTRL = "obmc-chassis-poweron@.target"
Josh D. Kinga283e072017-04-06 15:56:37 -050065START_TGTFMT_CTRL = "obmc-host-start@{1}.target"
Josh D. Kingb57615e2017-04-06 14:43:46 -050066START_INSTFMT_CTRL = "obmc-chassis-poweron@{0}.target"
Andrew Geisslera31fba52017-02-08 15:54:25 -060067START_FMT_CTRL = "../${START_TMPL_CTRL}:${START_TGTFMT_CTRL}.requires/${START_INSTFMT_CTRL}"
Andrew Geisslerfb7fa822017-01-26 08:07:15 -060068SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'START_FMT_CTRL', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
Andrew Geissler44761d22017-01-23 14:40:26 -060069
Andrew Geissler4a0f3322017-07-20 10:28:34 -050070# Chassis off requires host off
71STOP_TMPL_CTRL = "obmc-host-stop@.target"
72STOP_TGTFMT_CTRL = "obmc-chassis-poweroff@{0}.target"
73STOP_INSTFMT_CTRL = "obmc-host-stop@{1}.target"
Andrew Geisslera31fba52017-02-08 15:54:25 -060074STOP_FMT_CTRL = "../${STOP_TMPL_CTRL}:${STOP_TGTFMT_CTRL}.requires/${STOP_INSTFMT_CTRL}"
Andrew Geissler4a0f3322017-07-20 10:28:34 -050075SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'STOP_FMT_CTRL', 'OBMC_CHASSIS_INSTANCES', 'OBMC_HOST_INSTANCES')}"
76
77# Hard power off requires chassis off
78HARD_OFF_TMPL_CTRL = "obmc-chassis-poweroff@.target"
79HARD_OFF_TGTFMT_CTRL = "obmc-chassis-hard-poweroff@{0}.target"
80HARD_OFF_INSTFMT_CTRL = "obmc-chassis-poweroff@{0}.target"
81HARD_OFF_FMT_CTRL = "../${HARD_OFF_TMPL_CTRL}:${HARD_OFF_TGTFMT_CTRL}.requires/${HARD_OFF_INSTFMT_CTRL}"
82SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HARD_OFF_FMT_CTRL', 'OBMC_CHASSIS_INSTANCES')}"
Andrew Geissler7dc14332017-03-07 13:47:23 -060083
84# Force the standby target to run the chassis reset check target
Andrew Geisslerbc253aa2017-05-09 15:24:41 -050085RESET_TMPL_CTRL = "obmc-chassis-powerreset@.target"
Andrew Geissler7dc14332017-03-07 13:47:23 -060086SYSD_TGT = "${SYSTEMD_DEFAULT_TARGET}"
Andrew Geisslerbc253aa2017-05-09 15:24:41 -050087RESET_INSTFMT_CTRL = "obmc-chassis-powerreset@{0}.target"
Andrew Geissler7dc14332017-03-07 13:47:23 -060088RESET_FMT_CTRL = "../${RESET_TMPL_CTRL}:${SYSD_TGT}.wants/${RESET_INSTFMT_CTRL}"
89SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_FMT_CTRL', 'OBMC_CHASSIS_INSTANCES')}"