Brad Bishop | 5f9be07 | 2016-06-27 14:53:52 -0400 | [diff] [blame] | 1 | SUMMARY = "org.openbmc.control.Power implemention for OpenPOWER" |
| 2 | DESCRIPTION = "A power control implementation suitable for OpenPOWER systems." |
| 3 | PR = "r1" |
| 4 | |
| 5 | inherit skeleton-gdbus |
Brad Bishop | 1d525fa | 2016-08-17 20:27:37 -0400 | [diff] [blame] | 6 | inherit obmc-phosphor-dbus-service |
Saqib Khan | 02917df | 2017-11-13 10:47:54 -0600 | [diff] [blame] | 7 | inherit pkgconfig |
Brad Bishop | 1d525fa | 2016-08-17 20:27:37 -0400 | [diff] [blame] | 8 | |
Brad Bishop | 12e3d60 | 2016-10-05 20:10:23 -0400 | [diff] [blame] | 9 | DEPENDS += "phosphor-mapper systemd" |
Brad Bishop | 860fcde | 2016-08-31 23:43:19 -0400 | [diff] [blame] | 10 | |
Brad Bishop | 5f9be07 | 2016-06-27 14:53:52 -0400 | [diff] [blame] | 11 | SKELETON_DIR = "op-pwrctl" |
Brad Bishop | 1d525fa | 2016-08-17 20:27:37 -0400 | [diff] [blame] | 12 | |
| 13 | FMT = "org.openbmc.control.Power@{0}.service" |
| 14 | DBUS_SERVICE_${PN} += "${@compose_list(d, 'FMT', 'OBMC_POWER_INSTANCES')}" |
| 15 | |
| 16 | SYSTEMD_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. King | f7de631 | 2017-05-18 09:33:36 -0500 | [diff] [blame] | 21 | op-reset-chassis-running@.service \ |
Andrew Geissler | 579c8e0 | 2017-03-07 13:47:23 -0600 | [diff] [blame] | 22 | op-reset-chassis-on@.service \ |
Matthew Barth | 253a5aa | 2018-01-10 09:16:28 -0600 | [diff] [blame^] | 23 | op-powered-off@.service \ |
Brad Bishop | 1d525fa | 2016-08-17 20:27:37 -0400 | [diff] [blame] | 24 | " |
| 25 | |
| 26 | SYSTEMD_ENVIRONMENT_FILE_${PN} += "obmc/power_control" |
| 27 | |
| 28 | START_TMPL = "op-power-start@.service" |
Josh D. King | b9ee536 | 2017-04-06 14:43:46 -0500 | [diff] [blame] | 29 | START_TGTFMT = "obmc-chassis-poweron@{1}.target" |
Brad Bishop | 1d525fa | 2016-08-17 20:27:37 -0400 | [diff] [blame] | 30 | START_INSTFMT = "op-power-start@{0}.service" |
Andrew Geissler | 3c35a8c | 2017-02-08 15:54:25 -0600 | [diff] [blame] | 31 | START_FMT = "../${START_TMPL}:${START_TGTFMT}.requires/${START_INSTFMT}" |
Brad Bishop | 1d525fa | 2016-08-17 20:27:37 -0400 | [diff] [blame] | 32 | |
| 33 | STOP_TMPL = "op-power-stop@.service" |
Josh D. King | b9ee536 | 2017-04-06 14:43:46 -0500 | [diff] [blame] | 34 | STOP_TGTFMT = "obmc-chassis-poweroff@{1}.target" |
Brad Bishop | 1d525fa | 2016-08-17 20:27:37 -0400 | [diff] [blame] | 35 | STOP_INSTFMT = "op-power-stop@{0}.service" |
Andrew Geissler | 3c35a8c | 2017-02-08 15:54:25 -0600 | [diff] [blame] | 36 | STOP_FMT = "../${STOP_TMPL}:${STOP_TGTFMT}.requires/${STOP_INSTFMT}" |
Brad Bishop | 1d525fa | 2016-08-17 20:27:37 -0400 | [diff] [blame] | 37 | |
Matthew Barth | 253a5aa | 2018-01-10 09:16:28 -0600 | [diff] [blame^] | 38 | POWERED_OFF_TMPL = "op-powered-off@.service" |
| 39 | POWERED_OFF_INSTFMT = "op-powered-off@{0}.service" |
| 40 | POWERED_OFF_FMT = "../${POWERED_OFF_TMPL}:${STOP_TGTFMT}.requires/${POWERED_OFF_INSTFMT}" |
| 41 | |
Brad Bishop | 1d525fa | 2016-08-17 20:27:37 -0400 | [diff] [blame] | 42 | ON_TMPL = "op-wait-power-on@.service" |
| 43 | ON_INSTFMT = "op-wait-power-on@{0}.service" |
Andrew Geissler | 3c35a8c | 2017-02-08 15:54:25 -0600 | [diff] [blame] | 44 | ON_FMT = "../${ON_TMPL}:${START_TGTFMT}.requires/${ON_INSTFMT}" |
Brad Bishop | 1d525fa | 2016-08-17 20:27:37 -0400 | [diff] [blame] | 45 | |
Andrew Geissler | 9349072 | 2016-12-19 09:05:39 -0600 | [diff] [blame] | 46 | OFF_TMPL = "op-wait-power-off@.service" |
Brad Bishop | 1d525fa | 2016-08-17 20:27:37 -0400 | [diff] [blame] | 47 | OFF_INSTFMT = "op-wait-power-off@{0}.service" |
Andrew Geissler | 3c35a8c | 2017-02-08 15:54:25 -0600 | [diff] [blame] | 48 | OFF_FMT = "../${OFF_TMPL}:${STOP_TGTFMT}.requires/${OFF_INSTFMT}" |
Brad Bishop | 1d525fa | 2016-08-17 20:27:37 -0400 | [diff] [blame] | 49 | |
Andrew Geissler | dd08ef0 | 2017-05-09 15:24:41 -0500 | [diff] [blame] | 50 | RESET_TGTFMT = "obmc-chassis-powerreset@{1}.target" |
Andrew Geissler | e4577f6 | 2017-03-05 20:36:50 -0600 | [diff] [blame] | 51 | |
Josh D. King | f7de631 | 2017-05-18 09:33:36 -0500 | [diff] [blame] | 52 | RESET_ON_TMPL = "op-reset-chassis-running@.service" |
| 53 | RESET_ON_INSTFMT = "op-reset-chassis-running@{0}.service" |
Andrew Geissler | e4577f6 | 2017-03-05 20:36:50 -0600 | [diff] [blame] | 54 | RESET_ON_FMT = "../${RESET_ON_TMPL}:${RESET_TGTFMT}.requires/${RESET_ON_INSTFMT}" |
| 55 | |
Andrew Geissler | 579c8e0 | 2017-03-07 13:47:23 -0600 | [diff] [blame] | 56 | RESET_ON_CHASSIS_TMPL = "op-reset-chassis-on@.service" |
| 57 | RESET_ON_CHASSIS_INSTFMT = "op-reset-chassis-on@{0}.service" |
| 58 | RESET_ON_CHASSIS_FMT = "../${RESET_ON_CHASSIS_TMPL}:${RESET_TGTFMT}.requires/${RESET_ON_CHASSIS_INSTFMT}" |
| 59 | |
Andrew Geissler | 3c35a8c | 2017-02-08 15:54:25 -0600 | [diff] [blame] | 60 | # Build up requires relationship for START_TGTFMT and STOP_TGTFMT |
Brad Bishop | 1d525fa | 2016-08-17 20:27:37 -0400 | [diff] [blame] | 61 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'START_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" |
| 62 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'STOP_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" |
Matthew Barth | 253a5aa | 2018-01-10 09:16:28 -0600 | [diff] [blame^] | 63 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'POWERED_OFF_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" |
Brad Bishop | 1d525fa | 2016-08-17 20:27:37 -0400 | [diff] [blame] | 64 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'ON_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" |
| 65 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'OFF_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" |
Andrew Geissler | e4577f6 | 2017-03-05 20:36:50 -0600 | [diff] [blame] | 66 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_ON_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" |
Andrew Geissler | 579c8e0 | 2017-03-07 13:47:23 -0600 | [diff] [blame] | 67 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_ON_CHASSIS_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" |
Andrew Geissler | d8819ed | 2017-01-23 14:40:26 -0600 | [diff] [blame] | 68 | |
Andrew Geissler | 3c35a8c | 2017-02-08 15:54:25 -0600 | [diff] [blame] | 69 | # Now show that the main control target requires these power targets |
Josh D. King | b9ee536 | 2017-04-06 14:43:46 -0500 | [diff] [blame] | 70 | START_TMPL_CTRL = "obmc-chassis-poweron@.target" |
Josh D. King | efb04a1 | 2017-04-06 15:56:37 -0500 | [diff] [blame] | 71 | START_TGTFMT_CTRL = "obmc-host-start@{1}.target" |
Josh D. King | b9ee536 | 2017-04-06 14:43:46 -0500 | [diff] [blame] | 72 | START_INSTFMT_CTRL = "obmc-chassis-poweron@{0}.target" |
Andrew Geissler | 3c35a8c | 2017-02-08 15:54:25 -0600 | [diff] [blame] | 73 | START_FMT_CTRL = "../${START_TMPL_CTRL}:${START_TGTFMT_CTRL}.requires/${START_INSTFMT_CTRL}" |
Andrew Geissler | 2478d37 | 2017-01-26 08:07:15 -0600 | [diff] [blame] | 74 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'START_FMT_CTRL', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" |
Andrew Geissler | d8819ed | 2017-01-23 14:40:26 -0600 | [diff] [blame] | 75 | |
Andrew Geissler | 191e1ff | 2017-07-20 10:28:34 -0500 | [diff] [blame] | 76 | # Chassis off requires host off |
| 77 | STOP_TMPL_CTRL = "obmc-host-stop@.target" |
| 78 | STOP_TGTFMT_CTRL = "obmc-chassis-poweroff@{0}.target" |
| 79 | STOP_INSTFMT_CTRL = "obmc-host-stop@{1}.target" |
Andrew Geissler | 3c35a8c | 2017-02-08 15:54:25 -0600 | [diff] [blame] | 80 | STOP_FMT_CTRL = "../${STOP_TMPL_CTRL}:${STOP_TGTFMT_CTRL}.requires/${STOP_INSTFMT_CTRL}" |
Andrew Geissler | 191e1ff | 2017-07-20 10:28:34 -0500 | [diff] [blame] | 81 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'STOP_FMT_CTRL', 'OBMC_CHASSIS_INSTANCES', 'OBMC_HOST_INSTANCES')}" |
| 82 | |
| 83 | # Hard power off requires chassis off |
| 84 | HARD_OFF_TMPL_CTRL = "obmc-chassis-poweroff@.target" |
| 85 | HARD_OFF_TGTFMT_CTRL = "obmc-chassis-hard-poweroff@{0}.target" |
| 86 | HARD_OFF_INSTFMT_CTRL = "obmc-chassis-poweroff@{0}.target" |
| 87 | HARD_OFF_FMT_CTRL = "../${HARD_OFF_TMPL_CTRL}:${HARD_OFF_TGTFMT_CTRL}.requires/${HARD_OFF_INSTFMT_CTRL}" |
| 88 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HARD_OFF_FMT_CTRL', 'OBMC_CHASSIS_INSTANCES')}" |
Andrew Geissler | 579c8e0 | 2017-03-07 13:47:23 -0600 | [diff] [blame] | 89 | |
| 90 | # Force the standby target to run the chassis reset check target |
Andrew Geissler | dd08ef0 | 2017-05-09 15:24:41 -0500 | [diff] [blame] | 91 | RESET_TMPL_CTRL = "obmc-chassis-powerreset@.target" |
Andrew Geissler | 579c8e0 | 2017-03-07 13:47:23 -0600 | [diff] [blame] | 92 | SYSD_TGT = "${SYSTEMD_DEFAULT_TARGET}" |
Andrew Geissler | dd08ef0 | 2017-05-09 15:24:41 -0500 | [diff] [blame] | 93 | RESET_INSTFMT_CTRL = "obmc-chassis-powerreset@{0}.target" |
Andrew Geissler | 579c8e0 | 2017-03-07 13:47:23 -0600 | [diff] [blame] | 94 | RESET_FMT_CTRL = "../${RESET_TMPL_CTRL}:${SYSD_TGT}.wants/${RESET_INSTFMT_CTRL}" |
| 95 | SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_FMT_CTRL', 'OBMC_CHASSIS_INSTANCES')}" |