Name Date Size #Lines LOC

..--

fanctl/H--138104

README.mdH A D12-Jun-20256.7 KiB274202

debug.mdH A D05-Aug-20242.2 KiB10166

events.mdH A D12-Dec-202423.7 KiB825652

fans.mdH A D05-Aug-2024882 4329

groups.mdH A D05-Aug-2024976 3625

zones.mdH A D05-Aug-20242 KiB6744

README.md

1# Fan Control Configuration File
2
3## Table of Contents
4
5- [Overview](#overview)
6- [Data Format](#data-format)
7- [System Config Location](#system-config-location)
8- [Contents](#contents)
9- [Validation](#validation)
10- [Firmware Updates](#firmware-updates)
11- [Loading and Reloading](#loading-and-reloading)
12- [Debug](#debug)
13
14## Overview
15
16The `phosphor-fan-control` application is comprised of as set of configuration
17files (config files) that constructs the algorithm in which fans are controlled
18within a machine.
19
20## Data Format
21
22The config file is written using the
23[JSON (JavaScript Object Notation)](https://www.json.org/) data format and can
24be created using a text editor.
25
26## System Config Location
27
28The config file names are:
29
30- `manager.json`
31- `profiles.json`
32- `fans.json`
33- `zones.json`
34- `groups.json`
35- `events.json`
36
37### Supported Directory
38
39`/usr/share/phosphor-fan-presence/control/`
40
41The supported version of the config files are installed under this read-only
42directory location as part of the firmware image install. This is where the
43config files will be loaded from when no corresponding override config file
44exists.
45
46#### Default Location
47
48Where a single set of config files for 1-or-more system types can be used, the
49config files can be located at the base of the supported directory.
50
51i.e.) `/usr/share/phosphor-fan-presence/control/manager.json`
52`/usr/share/phosphor-fan-presence/control/profiles.json`
53`/usr/share/phosphor-fan-presence/control/fans.json`
54`/usr/share/phosphor-fan-presence/control/zones.json`
55`/usr/share/phosphor-fan-presence/control/groups.json`
56`/usr/share/phosphor-fan-presence/control/events.json`
57
58#### Compatible System Type Location
59
60The config files location can also be based on a system type. This is necessary
61where more than one type of machine is supported in a single BMC firmware image
62and those system types can not share any one common config file.
63
64A system type sub-directory can be obtained from the
65`Inventory.Decorator.Compatible` D-Bus interface's `Names` property. The
66property holds a list of one or more compatible system types.
67
68Example:
69
70- `com.ampere.Hardware.Chassis.Model.MtJade`
71- `com.ampere.Hardware.Chassis.Model.MtMitchell`
72
73The `phosphor-fan-control` application then traverses the supported directory,
74appending each compatible system type entry as a sub-directory on each config
75file until it is found.
76
77Example:
78
791. `/usr/share/phosphor-fan-presence/control/com.ampere.Hardware.Chassis.Model.MtJade/`
80   - (directory/config file does not exist)
812. `/usr/share/phosphor-fan-presence/control/com.ampere.Hardware.Chassis.Model.MtMitchell/events.json`
82   - (config file found)
83
84If any required config file is not found and the machine is powered on, an error
85is logged and `phosphor-fan-control` application terminates preventing the
86machine from successfully powering on.
87
88### Override Directory
89
90`/etc/phosphor-fan-presence/control/`
91
92A different version of each of the config files can be loaded by placing it into
93this writable directory location. This avoids the need to build and install a
94new firmware image on the BMC when changing any part of the configuration, such
95as for testing purposes.
96
97The override directory may not exist on the BMC, therefore to be able to use any
98number of overriding config files it must be created using the following
99command:
100
101`mkdir -p /etc/phosphor-fan-presence/control`
102
103### Search Order
104
105The `phosphor-fan-control` application will search for each config file at the
106directory locations in the following order:
107
1081. Override directory
1092. Supported directory
110   - Default location
111   - Compatible System Type location
112
113## Contents
114
115### Structure
116
117#### fans.json
118
119This file consists of an array of fan objects representing the fan FRUs in the
120system.
121
122```json
123[
124    {
125        "name": "fan0",
126        "zone": "0",
127        "sensors": ["fan0_0"],
128        "target_interface": "xyz.openbmc_project.Control.FanSpeed"
129    }
130    ...
131]
132```
133
134[Syntax](fans.md)
135
136#### zones.json
137
138This file contains parameters specific to the zone.
139
140```json
141[
142    {
143        "name": "0",
144        "poweron_target": 18000,
145        "default_floor": 18000,
146        "increase_delay": 5,
147        "decrease_interval": 30
148    },
149    ...
150]
151```
152
153[Syntax](zones.md)
154
155#### groups.json
156
157This file defines the groups that events.json will use in its actions. Groups
158consist of one or more D-Bus object paths and a name.
159
160```json
161[
162   {
163     "name": "fan inventory",
164     "members": [
165       "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan0",
166       "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan1",
167       "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan2",
168       "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan3",
169       "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan4",
170       "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan5"
171     ]
172   }
173 ...
174]
175```
176
177[Syntax](groups.md)
178
179#### events.json
180
181This file contains the fan control events, where each event can contain groups,
182trigger, and actions.
183
184```json
185{
186  [
187    {
188      "name": ...
189      "groups": [
190        {
191           ...
192        },
193        ...
194      ],
195
196      "triggers": [
197        {
198            ...
199        },
200        ...
201      ],
202
203      "actions": [
204        {
205          ...
206        },
207        ...
208      ],
209      ...
210    },
211    ...
212  ]
213}
214```
215
216[Syntax](events.md)
217
218### Comments
219
220The JSON data format does not support comments. However, the library used by
221code to parse the JSON does support '//' as a comment:
222
223```json
224// This is a comment.
225{
226   ...
227}
228```
229
230Alternatively, a comment attribute can be used:
231
232```json
233{
234  "comment": "This is a comment."
235  ...
236}
237```
238
239Fans can be queried and controlled manually using the fanctl utility. Full
240documentation can be found at
241<https://github.com/openbmc/phosphor-fan-presence/blob/master/docs/control/fanctl/README.md>
242
243## Validation
244
245TBD
246
247## Firmware Updates
248
249When a new firmware image is installed on the BMC, it will update the config
250file in the standard directory.
251
252The override directory will **not** be modified by a firmware update. If a
253config file exists in the override directory, it will continue to be used as the
254fan presence configuration instead of the config file located under the
255appropriate location within the supported directory.
256
257## Loading and Reloading
258
259The config files are loaded when the `phosphor-fan-control` application starts.
260
261To force the application to reload the config files, use the following command
262on the BMC:
263
264`systemctl kill -s HUP phosphor-fan-control@0.service`
265
266To confirm which config files were loaded, use the following command on the BMC:
267
268`journalctl -u phosphor-fan-control@0.service | grep Loading`
269
270## Debug
271
272Fan control maintains internal data structures that can be be dumped at runtime.
273[Details](debug.md).
274