blob: 2e0a8b757cddae1e49d9427d3081f5f764a884aa [file] [log] [blame]
Bob Kingdcb4b3b2019-12-17 18:07:06 +08001{
2 "$schema": "http://json-schema.org/schema#",
3 "title": "JSON schema for the phosphor-regulators config file",
4 "$id": "https://github.com/openbmc/phosphor-power/tree/master/phosphor-regulators/schema/config_schema.json",
5 "description": "This schema describes the JSON format for the phosphor-regulators configuration file.",
6 "type": "object",
Bob Kingdcb4b3b2019-12-17 18:07:06 +08007 "properties":
8 {
Shawn McCarney4dc9a302021-08-14 10:52:47 -05009 "comments": {"$ref": "#/definitions/comments" },
10 "rules": {"$ref": "#/definitions/rules" },
11 "chassis": {"$ref": "#/definitions/chassis" }
Bob Kingdcb4b3b2019-12-17 18:07:06 +080012 },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080013 "required": ["chassis"],
14 "additionalProperties": false,
Bob Kingdcb4b3b2019-12-17 18:07:06 +080015 "definitions":
16 {
Shawn McCarney4dc9a302021-08-14 10:52:47 -050017 "rule":
18 {
19 "type": "object",
20 "properties":
21 {
22 "comments": {"$ref": "#/definitions/comments" },
23 "id": {"$ref": "#/definitions/id" },
24 "actions": {"$ref": "#/definitions/actions" }
25 },
26 "required": ["id", "actions"],
27 "additionalProperties": false
28 },
29
Bob Kingdcb4b3b2019-12-17 18:07:06 +080030 "rules":
31 {
32 "type": "array",
Shawn McCarney4dc9a302021-08-14 10:52:47 -050033 "items": {"$ref": "#/definitions/rule" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080034 "minItems": 1
35 },
36
37 "comments":
38 {
39 "type": "array",
Shawn McCarney4dc9a302021-08-14 10:52:47 -050040 "items": {"type": "string" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080041 "minItems": 1
42 },
43
44 "id":
45 {
46 "type": "string",
47 "pattern": "^[A-Za-z0-9_]+$"
48 },
49
50 "action":
51 {
52 "type": "object",
53 "properties":
54 {
55 "comments": {"$ref": "#/definitions/comments" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080056 "and": {"$ref": "#/definitions/actions" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080057 "compare_presence": {"$ref": "#/definitions/compare_presence" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080058 "compare_vpd": {"$ref": "#/definitions/compare_vpd" },
Shawn McCarney846dde52021-08-14 12:47:44 -050059 "i2c_capture_bytes": {"$ref": "#/definitions/i2c_capture_bytes" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080060 "i2c_compare_bit": {"$ref": "#/definitions/i2c_bit" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080061 "i2c_compare_byte": {"$ref": "#/definitions/i2c_byte" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080062 "i2c_compare_bytes": {"$ref": "#/definitions/i2c_bytes" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080063 "i2c_write_bit": {"$ref": "#/definitions/i2c_bit" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080064 "i2c_write_byte": {"$ref": "#/definitions/i2c_byte" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080065 "i2c_write_bytes": {"$ref": "#/definitions/i2c_bytes" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080066 "if": {"$ref": "#/definitions/if" },
Shawn McCarney846dde52021-08-14 12:47:44 -050067 "log_phase_fault": {"$ref": "#/definitions/log_phase_fault" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080068 "not": {"$ref": "#/definitions/action" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080069 "or": {"$ref": "#/definitions/actions" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080070 "pmbus_read_sensor": {"$ref": "#/definitions/pmbus_read_sensor" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080071 "pmbus_write_vout_command": {"$ref": "#/definitions/pmbus_write_vout_command" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080072 "run_rule": {"$ref": "#/definitions/id" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +080073 "set_device": {"$ref": "#/definitions/id" }
74 },
75 "additionalProperties": false,
76 "oneOf": [
77 {"required": ["and"]},
78 {"required": ["compare_presence"]},
79 {"required": ["compare_vpd"]},
Shawn McCarney846dde52021-08-14 12:47:44 -050080 {"required": ["i2c_capture_bytes"]},
Bob Kingdcb4b3b2019-12-17 18:07:06 +080081 {"required": ["i2c_compare_bit"]},
82 {"required": ["i2c_compare_byte"]},
83 {"required": ["i2c_compare_bytes"]},
84 {"required": ["i2c_write_bit"]},
85 {"required": ["i2c_write_byte"]},
86 {"required": ["i2c_write_bytes"]},
87 {"required": ["if"]},
Shawn McCarney846dde52021-08-14 12:47:44 -050088 {"required": ["log_phase_fault"]},
Bob Kingdcb4b3b2019-12-17 18:07:06 +080089 {"required": ["not"]},
90 {"required": ["or"]},
91 {"required": ["pmbus_write_vout_command"]},
92 {"required": ["pmbus_read_sensor"]},
93 {"required": ["run_rule"]},
94 {"required": ["set_device"]}
95 ]
96 },
97
98 "actions":
99 {
100 "type": "array",
101 "items": {"$ref": "#/definitions/action" },
102 "minItems": 1
103 },
104
105 "compare_presence":
106 {
107 "type": "object",
108 "properties":
109 {
Shawn McCarneyecbeeea2021-04-29 21:08:18 -0500110 "fru": {"$ref": "#/definitions/inventory_path" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800111 "value": {"$ref": "#/definitions/boolean_value" }
112 },
113 "required": ["fru", "value"],
114 "additionalProperties": false
115 },
116
Shawn McCarneyecbeeea2021-04-29 21:08:18 -0500117 "inventory_path":
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800118 {
119 "type": "string",
120 "minLength": 1
121 },
122
123 "boolean_value":
124 {
125 "type": "boolean"
126 },
127
128 "compare_vpd":
129 {
130 "type": "object",
131 "properties":
132 {
Shawn McCarneyecbeeea2021-04-29 21:08:18 -0500133 "fru": {"$ref": "#/definitions/inventory_path" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800134 "keyword": {"$ref": "#/definitions/keyword" },
Matt Spinleraacc2aa2021-05-25 09:31:35 -0600135 "value": {"$ref": "#/definitions/string_value" },
Matt Spinleraacc2aa2021-05-25 09:31:35 -0600136 "byte_values": {"$ref": "#/definitions/bytes_values" }
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800137 },
Matt Spinleraacc2aa2021-05-25 09:31:35 -0600138 "required": ["fru", "keyword"],
139 "oneOf": [
140 {"required": ["value"]},
141 {"required": ["byte_values"]}
142 ],
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800143 "additionalProperties": false
144 },
145
146 "keyword":
147 {
148 "type": "string",
Matt Spinleraacc2aa2021-05-25 09:31:35 -0600149 "enum": ["CCIN", "Manufacturer", "Model", "PartNumber", "HW"]
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800150 },
151
152 "string_value":
153 {
154 "type": "string"
155 },
156
Shawn McCarney846dde52021-08-14 12:47:44 -0500157 "i2c_capture_bytes":
158 {
159 "type": "object",
160 "properties":
161 {
162 "register": {"$ref": "#/definitions/register" },
163 "count": {"$ref": "#/definitions/byte_count" }
164 },
165 "required": ["register", "count"],
166 "additionalProperties": false
167 },
168
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800169 "i2c_bit":
170 {
171 "type": "object",
172 "properties":
173 {
174 "register": {"$ref": "#/definitions/register" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800175 "position": {"$ref": "#/definitions/position" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800176 "value": {"$ref": "#/definitions/bit_value" }
177 },
178 "required": ["register", "position","value"],
179 "additionalProperties": false
180 },
181
182 "register":
183 {
184 "type": "string",
185 "pattern": "^0x[0-9A-Fa-f]{2}$"
186 },
187
188 "position":
189 {
190 "type": "integer",
191 "minimum": 0,
192 "maximum": 7
193 },
194
195 "bit_value":
196 {
197 "type": "integer",
198 "minimum": 0,
199 "maximum": 1
200 },
201
202 "i2c_byte":
203 {
204 "type": "object",
205 "properties":
206 {
207 "register": {"$ref": "#/definitions/register" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800208 "value": {"$ref": "#/definitions/byte_value" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800209 "mask": {"$ref": "#/definitions/byte_mask" }
210 },
211 "required": ["register", "value"],
212 "additionalProperties": false
213 },
214
215 "byte_value":
216 {
217 "type": "string",
218 "pattern": "^0x[0-9A-Fa-f]{2}$"
219 },
220
221 "byte_mask":
222 {
223 "type": "string",
224 "pattern": "^0x[0-9A-Fa-f]{2}$"
225 },
226
Shawn McCarney846dde52021-08-14 12:47:44 -0500227 "byte_count":
228 {
229 "type": "integer",
230 "minimum": 1
231 },
232
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800233 "i2c_bytes":
234 {
235 "type": "object",
236 "properties":
237 {
238 "register": {"$ref": "#/definitions/register" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800239 "values": {"$ref": "#/definitions/bytes_values" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800240 "masks": {"$ref": "#/definitions/bytes_masks" }
241 },
242 "required": ["register", "values"],
243 "additionalProperties": false
244 },
245
246 "bytes_values":
247 {
248 "type": "array",
249 "items": {"$ref": "#/definitions/byte_value" },
250 "minItems": 1
251 },
252
253 "bytes_masks":
254 {
255 "type": "array",
256 "items": {"$ref": "#/definitions/byte_mask" },
257 "minItems": 1
258 },
259
260 "if":
261 {
262 "type": "object",
263 "properties":
264 {
265 "condition": {"$ref": "#/definitions/action" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800266 "then": {"$ref": "#/definitions/actions" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800267 "else": {"$ref": "#/definitions/actions" }
268 },
269 "required": ["condition", "then"],
270 "additionalProperties": false
271 },
272
Shawn McCarney846dde52021-08-14 12:47:44 -0500273 "log_phase_fault":
274 {
275 "type": "object",
276 "properties":
277 {
278 "type": {"$ref": "#/definitions/phase_fault_type" }
279 },
280 "required": ["type"],
281 "additionalProperties": false
282 },
283
284 "phase_fault_type":
285 {
286 "type": "string",
287 "enum": ["n+1", "n"]
288 },
289
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800290 "pmbus_write_vout_command":
291 {
292 "type": "object",
293 "properties":
294 {
295 "volts": {"$ref": "#/definitions/volts" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800296 "format": {"$ref": "#/definitions/write_vout_format" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800297 "exponent": {"$ref": "#/definitions/exponent" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800298 "is_verified": {"$ref": "#/definitions/is_verified" }
299 },
300 "required": ["format"],
301 "additionalProperties": false
302 },
303
304 "volts":
305 {
306 "type": "number"
307 },
308
309 "write_vout_format":
310 {
311 "type": "string",
312 "enum": ["linear"]
313 },
314
315 "exponent":
316 {
317 "type": "integer"
318 },
319
320 "is_verified":
321 {
322 "type": "boolean"
323 },
324
325 "pmbus_read_sensor":
326 {
327 "type": "object",
328 "properties":
329 {
330 "type": {"$ref": "#/definitions/pmbus_read_sensor_type" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800331 "command": {"$ref": "#/definitions/pmbus_read_sensor_command" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800332 "format": {"$ref": "#/definitions/read_sensor_format" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800333 "exponent": {"$ref": "#/definitions/exponent" }
334 },
335 "required": ["type", "command", "format"],
336 "additionalProperties": false
337 },
338
339 "pmbus_read_sensor_type":
340 {
341 "type": "string",
342 "enum": ["iout", "iout_peak", "iout_valley", "pout", "temperature", "temperature_peak", "vout", "vout_peak", "vout_valley"]
343 },
344
345 "pmbus_read_sensor_command":
346 {
347 "type": "string",
348 "pattern": "^0x[0-9a-fA-F]{2}$"
349 },
350
351 "read_sensor_format":
352 {
353 "type": "string",
354 "enum": ["linear_11", "linear_16"]
355 },
356
Shawn McCarney4dc9a302021-08-14 10:52:47 -0500357 "chassis_object":
358 {
359 "type": "object",
360 "properties":
361 {
362 "comments": {"$ref": "#/definitions/comments" },
363 "number": {"$ref": "#/definitions/number" },
364 "inventory_path": {"$ref": "#/definitions/inventory_path" },
365 "devices": {"$ref": "#/definitions/devices" }
366 },
Shawn McCarney4c88a4c2021-09-21 15:29:24 -0500367 "required": ["number", "inventory_path"],
Shawn McCarney4dc9a302021-08-14 10:52:47 -0500368 "additionalProperties": false
369 },
370
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800371 "chassis":
372 {
373 "type": "array",
Shawn McCarney4dc9a302021-08-14 10:52:47 -0500374 "items": {"$ref": "#/definitions/chassis_object" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800375 "minItems": 1
376 },
377
378 "number":
379 {
380 "type": "integer",
381 "minimum": 1
382 },
383
Shawn McCarney4dc9a302021-08-14 10:52:47 -0500384 "device":
385 {
386 "type": "object",
387 "properties":
388 {
389 "comments": {"$ref": "#/definitions/comments" },
390 "id": {"$ref": "#/definitions/id" },
391 "is_regulator": {"$ref": "#/definitions/is_regulator" },
392 "fru": {"$ref": "#/definitions/inventory_path" },
393 "i2c_interface": {"$ref": "#/definitions/i2c_interface" },
394 "presence_detection": {"$ref": "#/definitions/presence_detection" },
395 "configuration": {"$ref": "#/definitions/configuration" },
Shawn McCarney846dde52021-08-14 12:47:44 -0500396 "phase_fault_detection": {"$ref": "#/definitions/phase_fault_detection" },
Shawn McCarney4dc9a302021-08-14 10:52:47 -0500397 "rails": {"$ref": "#/definitions/rails" }
398 },
399 "required": ["id", "is_regulator", "fru", "i2c_interface"],
400 "if":
401 {
402 "properties": { "is_regulator": { "const": false } }
403 },
404 "then":
405 {
Shawn McCarney846dde52021-08-14 12:47:44 -0500406 "not": {
407 "anyOf": [
408 { "required": ["phase_fault_detection"] },
409 { "required": ["rails"] }
410 ]
411 }
Shawn McCarney4dc9a302021-08-14 10:52:47 -0500412 },
413 "additionalProperties": false
414 },
415
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800416 "devices":
417 {
418 "type": "array",
Shawn McCarney4dc9a302021-08-14 10:52:47 -0500419 "items": {"$ref": "#/definitions/device" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800420 "minItems": 1
421 },
422
423 "is_regulator":
424 {
425 "type": "boolean"
426 },
427
428 "i2c_interface":
429 {
430 "type": "object",
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800431 "properties":
432 {
433 "bus": {"$ref": "#/definitions/bus" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800434 "address": {"$ref": "#/definitions/address" }
435 },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800436 "required": ["bus", "address"],
437 "additionalProperties": false
438 },
439
440 "bus":
441 {
442 "type": "integer",
443 "minimum": 0
444 },
445
446 "address":
447 {
448 "type": "string",
449 "pattern": "^0x[0-9A-Fa-f]{2}$"
450 },
451
452 "presence_detection":
453 {
454 "type": "object",
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800455 "properties":
456 {
457 "comments": {"$ref": "#/definitions/comments" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800458 "rule_id": {"$ref": "#/definitions/id" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800459 "actions": {"$ref": "#/definitions/actions" }
460 },
461 "additionalProperties": false,
462 "oneOf": [
463 {"required": ["rule_id"]},
464 {"required": ["actions"]}
465 ]
466 },
467
468 "configuration":
469 {
470 "type": "object",
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800471 "properties":
472 {
473 "comments": {"$ref": "#/definitions/comments" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800474 "volts": {"$ref": "#/definitions/volts" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800475 "rule_id": {"$ref": "#/definitions/id" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800476 "actions": {"$ref": "#/definitions/actions" }
477 },
478 "additionalProperties": false,
479 "oneOf": [
480 {"required": ["rule_id"]},
481 {"required": ["actions"]}
482 ]
483 },
484
Shawn McCarney846dde52021-08-14 12:47:44 -0500485 "phase_fault_detection":
486 {
487 "type": "object",
488 "properties":
489 {
490 "comments": {"$ref": "#/definitions/comments" },
491 "device_id": {"$ref": "#/definitions/id" },
492 "rule_id": {"$ref": "#/definitions/id" },
493 "actions": {"$ref": "#/definitions/actions" }
494 },
495 "additionalProperties": false,
496 "oneOf": [
497 {"required": ["rule_id"]},
498 {"required": ["actions"]}
499 ]
500 },
501
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800502 "rail":
503 {
504 "type": "object",
505 "properties":
506 {
507 "comments": {"$ref": "#/definitions/comments" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800508 "id": {"$ref": "#/definitions/id" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800509 "configuration": {"$ref": "#/definitions/configuration" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800510 "sensor_monitoring": {"$ref": "#/definitions/sensor_monitoring" }
511 },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800512 "required": ["id"],
513 "additionalProperties": false
514 },
515
516 "rails":
517 {
518 "type": "array",
519 "items": {"$ref": "#/definitions/rail" },
520 "minItems": 1
521 },
522
523 "sensor_monitoring":
524 {
525 "type": "object",
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800526 "properties":
527 {
528 "comments": {"$ref": "#/definitions/comments" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800529 "rule_id": {"$ref": "#/definitions/id" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800530 "actions": {"$ref": "#/definitions/actions" }
531 },
532 "additionalProperties": false,
533 "oneOf": [
534 {"required": ["rule_id"]},
535 {"required": ["actions"]}
536 ]
537 }
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800538 }
539}