commit | 162c7bfb0cbedcc5ccaf74c773da5a7c81fef8b1 | [log] [tgz] |
---|---|---|
author | Andrew Geissler <geissonator@yahoo.com> | Thu Sep 17 12:49:49 2020 -0500 |
committer | Andrew Geissler <geissonator@yahoo.com> | Thu Sep 17 15:20:44 2020 -0500 |
tree | 7537cd91cf65e0467b732896a76e515f44222005 | |
parent | 44c223ce1a31bceaf1f9f71f5026d683451bd430 [diff] |
bootblock: ensure no power operation on block Systemd does not treat targets the same way it treats services. If you start a target which has Wants/Requires, it will execute the services associated with that target before the Wants/Requires for the target have been fulfilled. The target will not set itself as complete until the Wants/Requires is fulfilled but this causes a weird behavior currently. For example, if ErrorBlocksTransition interface is present on D-Bus and the obmc-chassis-poweron@.target is started, the system will fully power on, but the chassis power state will continue to report as off. This is because all services were launched under the target to power on the system but because the target does not complete, the BMC still reports the chassis power as not being on. The solution is to move the bootblock dependencies from target responsible for starting all of the services to the synchronization target that services utilize to order their execution. Putting the bootblock dependencies in the obmc-power-start-pre@.target ensure no power on services will be run. Tested: - Ensured a bootblock now stops the system from powering on Signed-off-by: Andrew Geissler <geissonator@yahoo.com> Change-Id: I78b6bff86a1e28bbedb6919724eeb5ee0b2a9a25
This repository contains the software responsible for tracking and controlling the state of different objects within OpenBMC. This currently includes the BMC, Chassis, and Host. The most critical feature of phosphor-state-manager software is its support for requests to power on and off the system by the user.
This software also enforces any restore policy (i.e. auto power on system after a system power event or bmc reset) and ensures its states are updated correctly in situations where the BMC is rebooted and the chassis or host are in on/running states.
This repository also provides a command line tool, obmcutil, which provides basic command line support to query and control phosphor-state-manager applications running within an OpenBMC system. This tool itself runs within an OpenBMC system and utilizes D-Bus APIs. These D-Bus APIs are used for development and debug and are not intended for end users.
As with all OpenBMC applications, interfaces and properties within phosphor-state-manager are D-Bus interfaces. These interfaces are then used by external interface protocols, such as Redfish and IPMI, to report and control state to/by the end user.
phosphor-state-manager makes extensive use of systemd. There is a writeup here with an overview of systemd and its use by OpenBMC.
phosphor-state-manager follows some basics design guidelines in its implementation and use of systemd:
phosphor-state-manager implements states and state requests as defined in phosphor-dbus-interfaces for each object it supports.
Ready
once all services within the default.target have executed. The only state change request you can make of the BMC is for it to reboot itself.On
or Off
.Off
, Running
, Quiesced
(error condition), or in DiagnosticMode
(collecting diagnostic data for a failure)As noted above, phosphor-state-manager provides a command line tool, obmcutil, which takes a state
parameter. This will use D-Bus commands to retrieve the above states and present them to the user. It also provides other commands which will send the appropriate D-Bus commands to the above properties to power on/off the chassis and host (see obmcutil --help
within an OpenBMC system).
The above objects also implement other D-Bus objects like power on hours, boot progress, reboot attempts, and operating system status. These D-Bus objects are also defined out in the phosphor-dbus-interfaces repository.
The RestorePolicy defines the behavior the user wants when the BMC is reset. If the chassis or host is on/running then this service will not run. If they are off then the RestorePolicy
will be read and executed by phosphor-state-manager code.
In situations where the BMC is reset and the chassis and host are on and running, its critical that the BMC software do two things:
Note that some of this logic is provided via service files in system-specific meta layers. That is because the logic to determine if the chassis is on or if the host is running can vary from system to system. The requirement to create the files defined below and ensure the common targets go active is a must for anyone wishing to enable this feature.
phosphor-state-manager discovers state vs. trying to cache and save states. This ensure it's always getting the most accurate state information. It discovers the chassis state by checking the pgood
value from the power application. If it determines that power is on then it will do the following:
On
The chassis@0-on file is removed when power is removed from the chassis.
The logic to check if the host is on sends a command to the host, and if a response is received then similar logic to chassis is done:
The host@0-on file is removed when the host is stopped.
To build this package, do the following steps: 1. meson build 2. ninja -C build To clean the repository again run `rm -rf build`.