# openbmc/x86-power-control architecture

> Architecture diagram of the GitHub repository openbmc/x86-power-control, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openbmc/x86-power-control
- Repository: https://github.com/openbmc/x86-power-control

## Overview

x86-power-control is an OpenBMC daemon that accepts host and chassis power requests, drives configured power signals through a state machine, and exposes resulting state over D-Bus. Its capabilities include hard and graceful power transitions, reset and warm-reset handling, power-restore policy, GPIO or D-Bus event inputs, and optional slot and chassis-system reset control. The excerpts show the parser and daemon’s service, state, and event-handling responsibilities; some runtime connections are implied by documented behavior but not visible in the sampled code.

Main entry points: [`src/power_control.cpp`](https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp) (Power daemon), [`src/config_parser.cpp`](https://github.com/openbmc/x86-power-control/blob/master/src/config_parser.cpp) (Config parser), [`config/power-config-host0.json`](https://github.com/openbmc/x86-power-control/blob/master/config/power-config-host0.json) (Platform config), [`config/intel`](https://github.com/openbmc/x86-power-control/tree/master/config/intel) (Platform variants)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Power control"]
  node_daemon["Power daemon<br/>[power_control.cpp]"]
  node_state_machine["Power state machine<br/>[power_control.cpp]"]
  node_signal_inputs["Signal monitoring<br/>[power_control.cpp]"]
  node_slot_power["Slot power control<br/>[power_control.cpp]"]
end

subgraph group_config["Configuration"]
  node_config_parser["Config parser<br/>[config_parser.cpp]"]
  node_platform_config["Platform config"]
  node_platform_variants["Platform variants"]
end

subgraph group_state["State and restore"]
  node_persistent_state[("Persistent state<br/>[power_control.cpp]")]
  node_power_restore["Power restore<br/>[power_control.cpp]"]
end

subgraph group_interfaces["D-Bus interfaces"]
  node_host_chassis_api["Host and chassis API<br/>[power_control.cpp]"]
  node_button_api["Button API<br/>[power_control.cpp]"]
  node_chassis_reset_api["Chassis reset API<br/>[power_control.cpp]"]
end

node_requesters(("IPMI / Redfish"))

node_requesters -->|"request transitions"| node_host_chassis_api
node_host_chassis_api -.->|"dispatches requests"| node_state_machine
node_platform_config -->|"provides settings"| node_config_parser
node_config_parser -.->|"supplies parsed settings"| node_daemon
node_platform_variants -.->|"provides settings"| node_config_parser
node_signal_inputs -.->|"dispatches events"| node_state_machine
node_button_api -.->|"dispatches button events"| node_state_machine
node_state_machine -->|"saves power state"| node_persistent_state
node_power_restore -->|"reads saved state"| node_persistent_state
node_power_restore -.->|"requests restoration"| node_state_machine
node_daemon -->|"registers interfaces"| node_host_chassis_api
node_daemon -->|"registers interfaces"| node_button_api
node_daemon -->|"registers optional interface"| node_chassis_reset_api
node_daemon -->|"initializes control"| node_slot_power

click node_daemon "https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp"
click node_state_machine "https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp"
click node_signal_inputs "https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp"
click node_slot_power "https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp"
click node_config_parser "https://github.com/openbmc/x86-power-control/blob/master/src/config_parser.cpp"
click node_platform_config "https://github.com/openbmc/x86-power-control/blob/master/config/power-config-host0.json"
click node_platform_variants "https://github.com/openbmc/x86-power-control/tree/master/config/intel"
click node_persistent_state "https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp"
click node_power_restore "https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp"
click node_host_chassis_api "https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp"
click node_button_api "https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp"
click node_chassis_reset_api "https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_daemon,node_state_machine,node_signal_inputs,node_slot_power toneBlue
class node_config_parser,node_platform_config,node_platform_variants toneAmber
class node_persistent_state,node_power_restore toneMint
class node_host_chassis_api,node_button_api,node_chassis_reset_api toneRose
class node_requesters toneIndigo
```

## Components

### Power control

- [Power daemon](https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp): `src/power_control.cpp`
- [Power state machine](https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp): `src/power_control.cpp`
- [Signal monitoring](https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp): `src/power_control.cpp`
- [Slot power control](https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp): `src/power_control.cpp`

### Configuration

- [Config parser](https://github.com/openbmc/x86-power-control/blob/master/src/config_parser.cpp): `src/config_parser.cpp`
- [Platform config](https://github.com/openbmc/x86-power-control/blob/master/config/power-config-host0.json): `config/power-config-host0.json`
- [Platform variants](https://github.com/openbmc/x86-power-control/tree/master/config/intel): `config/intel`

### State and restore

- [Persistent state](https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp): `src/power_control.cpp`
- [Power restore](https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp): `src/power_control.cpp`

### D-Bus interfaces

- [Host and chassis API](https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp): `src/power_control.cpp`
- [Button API](https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp): `src/power_control.cpp`
- [Chassis reset API](https://github.com/openbmc/x86-power-control/blob/master/src/power_control.cpp): `src/power_control.cpp`

### Other components

- **IPMI / Redfish**

## Connections

- IPMI / Redfish → Host and chassis API: request transitions (evidence: `src/power_control.cpp`)
- Host and chassis API → Power state machine: dispatches requests (evidence: `src/power_control.cpp`)
- Platform config → Config parser: provides settings (evidence: `README.md`)
- Config parser → Power daemon: supplies parsed settings
- Platform variants → Config parser: provides settings
- Signal monitoring → Power state machine: dispatches events (evidence: `src/power_control.cpp`)
- Button API → Power state machine: dispatches button events (evidence: `src/power_control.cpp`)
- Power state machine → Persistent state: saves power state (evidence: `src/power_control.cpp`)
- Power restore → Persistent state: reads saved state (evidence: `src/power_control.cpp`)
- Power restore → Power state machine: requests restoration (evidence: `src/power_control.cpp`)
- Power daemon → Host and chassis API: registers interfaces (evidence: `src/power_control.cpp`)
- Power daemon → Button API: registers interfaces (evidence: `src/power_control.cpp`)
- Power daemon → Chassis reset API: registers optional interface (evidence: `src/power_control.cpp`)
- Power daemon → Slot power control: initializes control (evidence: `src/power_control.cpp`)
