xref: /openbmc/phosphor-power/phosphor-power-sequencer/docs/internal_design.md (revision 27ae70b8219cd292f3d8d9b3d5ff2a9ee18b1f37)
1*27ae70b8SShawn McCarney# Internal Design
2*27ae70b8SShawn McCarney
3*27ae70b8SShawn McCarney## Key classes
4*27ae70b8SShawn McCarney
5*27ae70b8SShawn McCarney- PowerInterface
6*27ae70b8SShawn McCarney  - Defines the `org.openbmc.control.Power` D-Bus interface.
7*27ae70b8SShawn McCarney  - The `state` property is set to power the chassis on or off. This contains
8*27ae70b8SShawn McCarney    the desired power state.
9*27ae70b8SShawn McCarney  - The `pgood` property contains the actual power state of the chassis.
10*27ae70b8SShawn McCarney- PowerControl
11*27ae70b8SShawn McCarney  - Created in `main()`. Handles the event loop.
12*27ae70b8SShawn McCarney  - Sub-class of PowerInterface that provides a concrete implementation of the
13*27ae70b8SShawn McCarney    `org.openbmc.control.Power` D-Bus interface.
14*27ae70b8SShawn McCarney  - Finds and loads the JSON configuration file.
15*27ae70b8SShawn McCarney  - Finds power sequencer device information.
16*27ae70b8SShawn McCarney  - Creates a sub-class of PowerSequencerDevice that matches power sequencer
17*27ae70b8SShawn McCarney    device information.
18*27ae70b8SShawn McCarney  - Powers the chassis on and off using the `power-chassis-control` named GPIO.
19*27ae70b8SShawn McCarney  - Monitors the chassis pgood status every 3 seconds using the
20*27ae70b8SShawn McCarney    `power-chassis-good` named GPIO.
21*27ae70b8SShawn McCarney  - Enforces a minimum power off time of 15 seconds from cold start and 25
22*27ae70b8SShawn McCarney    seconds from power off.
23*27ae70b8SShawn McCarney- DeviceFinder
24*27ae70b8SShawn McCarney  - Finds power sequencer device information on D-Bus published by
25*27ae70b8SShawn McCarney    EntityManager.
26*27ae70b8SShawn McCarney- Rail
27*27ae70b8SShawn McCarney  - A voltage rail that is enabled or monitored by the power sequencer device.
28*27ae70b8SShawn McCarney- PowerSequencerDevice
29*27ae70b8SShawn McCarney  - Abstract base class for a power sequencer device.
30*27ae70b8SShawn McCarney  - Defines virtual methods that must be implemented by all child classes.
31*27ae70b8SShawn McCarney- StandardDevice
32*27ae70b8SShawn McCarney  - Sub-class of PowerSequencerDevice that implements the standard pgood fault
33*27ae70b8SShawn McCarney    detection algorithm.
34*27ae70b8SShawn McCarney- PMBusDriverDevice
35*27ae70b8SShawn McCarney  - Sub-class of StandardDevice for power sequencer devices that are bound to a
36*27ae70b8SShawn McCarney    PMBus device driver.
37*27ae70b8SShawn McCarney- UCD90xDevice
38*27ae70b8SShawn McCarney  - Sub-class of PMBusDriverDevice for the UCD90X family of power sequencer
39*27ae70b8SShawn McCarney    devices.
40*27ae70b8SShawn McCarney- UCD90160Device
41*27ae70b8SShawn McCarney  - Sub-class of UCD90xDevice representing a UCD90160 power sequencer device.
42*27ae70b8SShawn McCarney- UCD90320Device
43*27ae70b8SShawn McCarney  - Sub-class of UCD90xDevice representing a UCD90320 power sequencer device.
44*27ae70b8SShawn McCarney- Services
45*27ae70b8SShawn McCarney  - Abstract base class that provides an interface to system services like error
46*27ae70b8SShawn McCarney    logging and the journal.
47*27ae70b8SShawn McCarney- BMCServices
48*27ae70b8SShawn McCarney  - Sub-class of Services with real implementation of methods.
49*27ae70b8SShawn McCarney- MockServices
50*27ae70b8SShawn McCarney  - Sub-class of Services with mock implementation of methods for automated
51*27ae70b8SShawn McCarney    testing.
52