Support chassis power cycle
A new system is being designed which will utilize phosphor-state-manager
and it requires the chassis system power cycle feature.
Test plan:
Change property "RequestedPowerTransition" to trigger
chassis power cycle target.
Change-Id: I30b0efd7c0fc72a9fb378f48e47c4c1af2b22ad6
Signed-off-by: Bonnie Lo <Bonnie_Lo@wiwynn.com>
diff --git a/chassis_state_manager.cpp b/chassis_state_manager.cpp
index ba30c73..db5ae96 100644
--- a/chassis_state_manager.cpp
+++ b/chassis_state_manager.cpp
@@ -45,6 +45,8 @@
"obmc-chassis-hard-poweroff@{}.target";
constexpr auto CHASSIS_STATE_POWERON_TGT_FMT = "obmc-chassis-poweron@{}.target";
constexpr auto CHASSIS_BLACKOUT_TGT_FMT = "obmc-chassis-blackout@{}.target";
+constexpr auto CHASSIS_STATE_POWERCYCLE_TGT_FMT =
+ "obmc-chassis-powercycle@{}.target";
constexpr auto AUTO_POWER_RESTORE_SVC_FMT =
"phosphor-discover-system-state@{}.service";
constexpr auto ACTIVE_STATE = "active";
@@ -92,7 +94,9 @@
systemdTargetTable = {
// Use the hard off target to ensure we shutdown immediately
{Transition::Off, fmt::format(CHASSIS_STATE_HARD_POWEROFF_TGT_FMT, id)},
- {Transition::On, fmt::format(CHASSIS_STATE_POWERON_TGT_FMT, id)}};
+ {Transition::On, fmt::format(CHASSIS_STATE_POWERON_TGT_FMT, id)},
+ {Transition::PowerCycle,
+ fmt::format(CHASSIS_STATE_POWERCYCLE_TGT_FMT, id)}};
}
// TODO - Will be rewritten once sdbusplus client bindings are in place
diff --git a/data/phosphor-target-monitor-default.json b/data/phosphor-target-monitor-default.json
index 22fe2c9..494e462 100644
--- a/data/phosphor-target-monitor-default.json
+++ b/data/phosphor-target-monitor-default.json
@@ -9,6 +9,9 @@
"obmc-chassis-poweroff@0.target" : {
"errorsToMonitor": ["default"],
"errorToLog": "xyz.openbmc_project.State.Chassis.Error.PowerOffFailure"},
+ "obmc-chassis-powercycle@0.target" : {
+ "errorsToMonitor": ["default"],
+ "errorToLog": "xyz.openbmc_project.State.Chassis.Error.PowerCycleFailure"},
"obmc-host-start@0.target" : {
"errorsToMonitor": ["default"],
"errorToLog": "xyz.openbmc_project.State.Host.Error.HostStartFailure"},
diff --git a/target_files/meson.build b/target_files/meson.build
index 057da1b..aad5d15 100644
--- a/target_files/meson.build
+++ b/target_files/meson.build
@@ -6,6 +6,7 @@
'obmc-chassis-poweroff@.target',
'obmc-chassis-poweron@.target',
'obmc-chassis-powerreset@.target',
+ 'obmc-chassis-powercycle@.target',
'obmc-fan-control-ready@.target',
'obmc-fan-control.target',
'obmc-fan-watchdog-takeover.target',
diff --git a/target_files/obmc-chassis-powercycle@.target b/target_files/obmc-chassis-powercycle@.target
new file mode 100644
index 0000000..01060fa
--- /dev/null
+++ b/target_files/obmc-chassis-powercycle@.target
@@ -0,0 +1,4 @@
+[Unit]
+Description=Chassis%i Cycle
+After=multi-user.target
+