blob: ab2a18e60d40145c84f1f5a2126385eed343137c [file] [log] [blame]
Gunnar Millse5b38602018-08-31 12:39:15 -05001SUMMARY = "org.openbmc.control.Power implementation for OpenPOWER"
Brad Bishop5f9be072016-06-27 14:53:52 -04002DESCRIPTION = "A power control implementation suitable for OpenPOWER systems."
3PR = "r1"
Patrick Venture6eff7c02018-10-09 20:13:01 -07004PV = "1.0+git${SRCPV}"
Brad Bishop5f9be072016-06-27 14:53:52 -04005
6inherit skeleton-gdbus
Brad Bishop1d525fa2016-08-17 20:27:37 -04007inherit obmc-phosphor-dbus-service
Saqib Khan02917df2017-11-13 10:47:54 -06008inherit pkgconfig
Brad Bishop1d525fa2016-08-17 20:27:37 -04009
Brad Bishop12e3d602016-10-05 20:10:23 -040010DEPENDS += "phosphor-mapper systemd"
Brad Bishop860fcde2016-08-31 23:43:19 -040011
Brad Bishop5f9be072016-06-27 14:53:52 -040012SKELETON_DIR = "op-pwrctl"
Brad Bishop1d525fa2016-08-17 20:27:37 -040013
14FMT = "org.openbmc.control.Power@{0}.service"
15DBUS_SERVICE_${PN} += "${@compose_list(d, 'FMT', 'OBMC_POWER_INSTANCES')}"
16
17SYSTEMD_SERVICE_${PN} += " \
18 op-power-start@.service \
19 op-wait-power-on@.service \
20 op-power-stop@.service \
21 op-wait-power-off@.service \
Josh D. Kingf7de6312017-05-18 09:33:36 -050022 op-reset-chassis-running@.service \
Andrew Geissler579c8e02017-03-07 13:47:23 -060023 op-reset-chassis-on@.service \
Matthew Barth253a5aa2018-01-10 09:16:28 -060024 op-powered-off@.service \
Brad Bishop1d525fa2016-08-17 20:27:37 -040025 "
26
27SYSTEMD_ENVIRONMENT_FILE_${PN} += "obmc/power_control"
28
29START_TMPL = "op-power-start@.service"
Josh D. Kingb9ee5362017-04-06 14:43:46 -050030START_TGTFMT = "obmc-chassis-poweron@{1}.target"
Brad Bishop1d525fa2016-08-17 20:27:37 -040031START_INSTFMT = "op-power-start@{0}.service"
Andrew Geissler3c35a8c2017-02-08 15:54:25 -060032START_FMT = "../${START_TMPL}:${START_TGTFMT}.requires/${START_INSTFMT}"
Brad Bishop1d525fa2016-08-17 20:27:37 -040033
34STOP_TMPL = "op-power-stop@.service"
Josh D. Kingb9ee5362017-04-06 14:43:46 -050035STOP_TGTFMT = "obmc-chassis-poweroff@{1}.target"
Brad Bishop1d525fa2016-08-17 20:27:37 -040036STOP_INSTFMT = "op-power-stop@{0}.service"
Andrew Geissler3c35a8c2017-02-08 15:54:25 -060037STOP_FMT = "../${STOP_TMPL}:${STOP_TGTFMT}.requires/${STOP_INSTFMT}"
Brad Bishop1d525fa2016-08-17 20:27:37 -040038
Matthew Barth253a5aa2018-01-10 09:16:28 -060039POWERED_OFF_TMPL = "op-powered-off@.service"
40POWERED_OFF_INSTFMT = "op-powered-off@{0}.service"
41POWERED_OFF_FMT = "../${POWERED_OFF_TMPL}:${STOP_TGTFMT}.requires/${POWERED_OFF_INSTFMT}"
42
Brad Bishop1d525fa2016-08-17 20:27:37 -040043ON_TMPL = "op-wait-power-on@.service"
44ON_INSTFMT = "op-wait-power-on@{0}.service"
Andrew Geissler3c35a8c2017-02-08 15:54:25 -060045ON_FMT = "../${ON_TMPL}:${START_TGTFMT}.requires/${ON_INSTFMT}"
Brad Bishop1d525fa2016-08-17 20:27:37 -040046
Andrew Geissler93490722016-12-19 09:05:39 -060047OFF_TMPL = "op-wait-power-off@.service"
Brad Bishop1d525fa2016-08-17 20:27:37 -040048OFF_INSTFMT = "op-wait-power-off@{0}.service"
Andrew Geissler3c35a8c2017-02-08 15:54:25 -060049OFF_FMT = "../${OFF_TMPL}:${STOP_TGTFMT}.requires/${OFF_INSTFMT}"
Brad Bishop1d525fa2016-08-17 20:27:37 -040050
Andrew Geisslerdd08ef02017-05-09 15:24:41 -050051RESET_TGTFMT = "obmc-chassis-powerreset@{1}.target"
Andrew Geisslere4577f62017-03-05 20:36:50 -060052
Josh D. Kingf7de6312017-05-18 09:33:36 -050053RESET_ON_TMPL = "op-reset-chassis-running@.service"
54RESET_ON_INSTFMT = "op-reset-chassis-running@{0}.service"
Andrew Geisslere4577f62017-03-05 20:36:50 -060055RESET_ON_FMT = "../${RESET_ON_TMPL}:${RESET_TGTFMT}.requires/${RESET_ON_INSTFMT}"
56
Andrew Geissler579c8e02017-03-07 13:47:23 -060057RESET_ON_CHASSIS_TMPL = "op-reset-chassis-on@.service"
58RESET_ON_CHASSIS_INSTFMT = "op-reset-chassis-on@{0}.service"
59RESET_ON_CHASSIS_FMT = "../${RESET_ON_CHASSIS_TMPL}:${RESET_TGTFMT}.requires/${RESET_ON_CHASSIS_INSTFMT}"
60
Andrew Geissler3c35a8c2017-02-08 15:54:25 -060061# Build up requires relationship for START_TGTFMT and STOP_TGTFMT
Brad Bishop1d525fa2016-08-17 20:27:37 -040062SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'START_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
63SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'STOP_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
Matthew Barth253a5aa2018-01-10 09:16:28 -060064SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'POWERED_OFF_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
Brad Bishop1d525fa2016-08-17 20:27:37 -040065SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'ON_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
66SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'OFF_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
Andrew Geisslere4577f62017-03-05 20:36:50 -060067SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_ON_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
Andrew Geissler579c8e02017-03-07 13:47:23 -060068SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_ON_CHASSIS_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
Andrew Geisslerd8819ed2017-01-23 14:40:26 -060069
Andrew Geissler3c35a8c2017-02-08 15:54:25 -060070# Now show that the main control target requires these power targets
Josh D. Kingb9ee5362017-04-06 14:43:46 -050071START_TMPL_CTRL = "obmc-chassis-poweron@.target"
Andrew Geissler5c76e0c2018-03-27 13:56:26 -070072START_TGTFMT_CTRL = "obmc-host-startmin@{1}.target"
Josh D. Kingb9ee5362017-04-06 14:43:46 -050073START_INSTFMT_CTRL = "obmc-chassis-poweron@{0}.target"
Andrew Geissler3c35a8c2017-02-08 15:54:25 -060074START_FMT_CTRL = "../${START_TMPL_CTRL}:${START_TGTFMT_CTRL}.requires/${START_INSTFMT_CTRL}"
Andrew Geissler2478d372017-01-26 08:07:15 -060075SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'START_FMT_CTRL', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
Andrew Geisslerd8819ed2017-01-23 14:40:26 -060076
Andrew Geissler191e1ff2017-07-20 10:28:34 -050077# Chassis off requires host off
78STOP_TMPL_CTRL = "obmc-host-stop@.target"
79STOP_TGTFMT_CTRL = "obmc-chassis-poweroff@{0}.target"
80STOP_INSTFMT_CTRL = "obmc-host-stop@{1}.target"
Andrew Geissler3c35a8c2017-02-08 15:54:25 -060081STOP_FMT_CTRL = "../${STOP_TMPL_CTRL}:${STOP_TGTFMT_CTRL}.requires/${STOP_INSTFMT_CTRL}"
Andrew Geissler191e1ff2017-07-20 10:28:34 -050082SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'STOP_FMT_CTRL', 'OBMC_CHASSIS_INSTANCES', 'OBMC_HOST_INSTANCES')}"
83
84# Hard power off requires chassis off
85HARD_OFF_TMPL_CTRL = "obmc-chassis-poweroff@.target"
86HARD_OFF_TGTFMT_CTRL = "obmc-chassis-hard-poweroff@{0}.target"
87HARD_OFF_INSTFMT_CTRL = "obmc-chassis-poweroff@{0}.target"
88HARD_OFF_FMT_CTRL = "../${HARD_OFF_TMPL_CTRL}:${HARD_OFF_TGTFMT_CTRL}.requires/${HARD_OFF_INSTFMT_CTRL}"
89SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HARD_OFF_FMT_CTRL', 'OBMC_CHASSIS_INSTANCES')}"
Andrew Geissler579c8e02017-03-07 13:47:23 -060090
91# Force the standby target to run the chassis reset check target
Andrew Geisslerdd08ef02017-05-09 15:24:41 -050092RESET_TMPL_CTRL = "obmc-chassis-powerreset@.target"
Andrew Geissler579c8e02017-03-07 13:47:23 -060093SYSD_TGT = "${SYSTEMD_DEFAULT_TARGET}"
Andrew Geisslerdd08ef02017-05-09 15:24:41 -050094RESET_INSTFMT_CTRL = "obmc-chassis-powerreset@{0}.target"
Andrew Geissler579c8e02017-03-07 13:47:23 -060095RESET_FMT_CTRL = "../${RESET_TMPL_CTRL}:${SYSD_TGT}.wants/${RESET_INSTFMT_CTRL}"
96SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_FMT_CTRL', 'OBMC_CHASSIS_INSTANCES')}"