diff options
author | Andrew Geissler <andrewg@us.ibm.com> | 2017-03-07 22:47:23 +0300 |
---|---|---|
committer | Andrew Geissler <geissonator@yahoo.com> | 2017-03-15 22:55:23 +0300 |
commit | 579c8e04245bf2022f7c653f991077072b4c9e9c (patch) | |
tree | 832bfb2b733862a0bace62750da096ee106dbb2c /meta-phosphor/common/recipes-phosphor/chassis | |
parent | e4577f6245a58771807b75652ab20a3b279a04b9 (diff) | |
download | openbmc-579c8e04245bf2022f7c653f991077072b4c9e9c.tar.xz |
Automatically check for chassis power on BMC reboot
Run the obmc-chassis-reset@.target:
- Check if pgood is on
- If it is, create the file in /run/openbmc/chassis@%i-on and
- Run the systemctl command to start the chassis power on target
Resolves openbmc/openbmc#1094
Change-Id: I93f94fc1b75e35fd353387d0bed5569e07615171
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
Diffstat (limited to 'meta-phosphor/common/recipes-phosphor/chassis')
3 files changed, 29 insertions, 1 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power.bb b/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power.bb index 7c4fb2b238..6217e141bf 100644 --- a/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power.bb +++ b/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power.bb @@ -19,6 +19,7 @@ SYSTEMD_SERVICE_${PN} += " \ op-wait-power-off@.service \ op-reset-pgood-check@.service \ op-reset-set-power-on@.service \ + op-reset-chassis-on@.service \ " SYSTEMD_ENVIRONMENT_FILE_${PN} += "obmc/power_control" @@ -50,6 +51,10 @@ RESET_ON_TMPL = "op-reset-set-power-on@.service" RESET_ON_INSTFMT = "op-reset-set-power-on@{0}.service" RESET_ON_FMT = "../${RESET_ON_TMPL}:${RESET_TGTFMT}.requires/${RESET_ON_INSTFMT}" +RESET_ON_CHASSIS_TMPL = "op-reset-chassis-on@.service" +RESET_ON_CHASSIS_INSTFMT = "op-reset-chassis-on@{0}.service" +RESET_ON_CHASSIS_FMT = "../${RESET_ON_CHASSIS_TMPL}:${RESET_TGTFMT}.requires/${RESET_ON_CHASSIS_INSTFMT}" + # Build up requires relationship for START_TGTFMT and STOP_TGTFMT SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'START_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'STOP_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" @@ -57,6 +62,7 @@ SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'ON_FMT', 'OBMC_POWER_INSTANCES', SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'OFF_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_ON_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" +SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_ON_CHASSIS_FMT', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" # Now show that the main control target requires these power targets START_TMPL_CTRL = "obmc-power-chassis-on@.target" @@ -69,4 +75,11 @@ STOP_TMPL_CTRL = "obmc-power-chassis-off@.target" STOP_TGTFMT_CTRL = "obmc-chassis-stop@{1}.target" STOP_INSTFMT_CTRL = "obmc-power-chassis-off@{0}.target" STOP_FMT_CTRL = "../${STOP_TMPL_CTRL}:${STOP_TGTFMT_CTRL}.requires/${STOP_INSTFMT_CTRL}" -SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'STOP_FMT_CTRL', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
\ No newline at end of file +SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'STOP_FMT_CTRL', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}" + +# Force the standby target to run the chassis reset check target +RESET_TMPL_CTRL = "obmc-chassis-reset@.target" +SYSD_TGT = "${SYSTEMD_DEFAULT_TARGET}" +RESET_INSTFMT_CTRL = "obmc-chassis-reset@{0}.target" +RESET_FMT_CTRL = "../${RESET_TMPL_CTRL}:${SYSD_TGT}.wants/${RESET_INSTFMT_CTRL}" +SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'RESET_FMT_CTRL', 'OBMC_CHASSIS_INSTANCES')}" diff --git a/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power/op-reset-chassis-on@.service b/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power/op-reset-chassis-on@.service new file mode 100644 index 0000000000..e41950d291 --- /dev/null +++ b/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power/op-reset-chassis-on@.service @@ -0,0 +1,14 @@ +[Unit] +Description=Start chassis%i on after BMC reset +Requires=op-reset-set-power-on@%i.service +After=op-reset-set-power-on@%i.service +After=obmc-power-reset-on@%i.target +Requires=obmc-power-reset-on@%i.target + +[Service] +RemainAfterExit=no +ExecStart=/bin/systemctl start obmc-power-chassis-on@%i.target + + +[Install] +WantedBy=obmc-chassis-reset@%i.target diff --git a/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power/op-wait-power-off@.service b/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power/op-wait-power-off@.service index 8c4d3d3b5b..46e413eef6 100644 --- a/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power/op-wait-power-off@.service +++ b/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power/op-wait-power-off@.service @@ -11,6 +11,7 @@ Conflicts=obmc-power-chassis-on@%i.target Type=oneshot RemainAfterExit=yes ExecStart={sbindir}/pgood_wait /org/openbmc/control/power%i off +ExecStart=/bin/rm -f /run/openbmc/chassis@%i-on [Install] WantedBy=obmc-chassis-stop@%i.target |