blob: dbfed584af42fe2ec754d378d05d3f6fe9608a1c [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" },
Shawn McCarneya2a830b2021-10-30 14:24:31 -0500136 "byte_values": {"$ref": "#/definitions/byte_values_min0" }
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" },
Shawn McCarneya2a830b2021-10-30 14:24:31 -0500239 "values": {"$ref": "#/definitions/byte_values" },
240 "masks": {"$ref": "#/definitions/byte_masks" }
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800241 },
242 "required": ["register", "values"],
243 "additionalProperties": false
244 },
245
Shawn McCarneya2a830b2021-10-30 14:24:31 -0500246 "byte_values":
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800247 {
248 "type": "array",
249 "items": {"$ref": "#/definitions/byte_value" },
250 "minItems": 1
251 },
252
Shawn McCarneya2a830b2021-10-30 14:24:31 -0500253 "byte_values_min0":
254 {
255 "type": "array",
256 "items": {"$ref": "#/definitions/byte_value" },
257 "minItems": 0
258 },
259
260 "byte_masks":
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800261 {
262 "type": "array",
263 "items": {"$ref": "#/definitions/byte_mask" },
264 "minItems": 1
265 },
266
267 "if":
268 {
269 "type": "object",
270 "properties":
271 {
272 "condition": {"$ref": "#/definitions/action" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800273 "then": {"$ref": "#/definitions/actions" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800274 "else": {"$ref": "#/definitions/actions" }
275 },
276 "required": ["condition", "then"],
277 "additionalProperties": false
278 },
279
Shawn McCarney846dde52021-08-14 12:47:44 -0500280 "log_phase_fault":
281 {
282 "type": "object",
283 "properties":
284 {
285 "type": {"$ref": "#/definitions/phase_fault_type" }
286 },
287 "required": ["type"],
288 "additionalProperties": false
289 },
290
291 "phase_fault_type":
292 {
293 "type": "string",
294 "enum": ["n+1", "n"]
295 },
296
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800297 "pmbus_write_vout_command":
298 {
299 "type": "object",
300 "properties":
301 {
302 "volts": {"$ref": "#/definitions/volts" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800303 "format": {"$ref": "#/definitions/write_vout_format" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800304 "exponent": {"$ref": "#/definitions/exponent" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800305 "is_verified": {"$ref": "#/definitions/is_verified" }
306 },
307 "required": ["format"],
308 "additionalProperties": false
309 },
310
311 "volts":
312 {
313 "type": "number"
314 },
315
316 "write_vout_format":
317 {
318 "type": "string",
319 "enum": ["linear"]
320 },
321
322 "exponent":
323 {
324 "type": "integer"
325 },
326
327 "is_verified":
328 {
329 "type": "boolean"
330 },
331
332 "pmbus_read_sensor":
333 {
334 "type": "object",
335 "properties":
336 {
337 "type": {"$ref": "#/definitions/pmbus_read_sensor_type" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800338 "command": {"$ref": "#/definitions/pmbus_read_sensor_command" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800339 "format": {"$ref": "#/definitions/read_sensor_format" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800340 "exponent": {"$ref": "#/definitions/exponent" }
341 },
342 "required": ["type", "command", "format"],
343 "additionalProperties": false
344 },
345
346 "pmbus_read_sensor_type":
347 {
348 "type": "string",
349 "enum": ["iout", "iout_peak", "iout_valley", "pout", "temperature", "temperature_peak", "vout", "vout_peak", "vout_valley"]
350 },
351
352 "pmbus_read_sensor_command":
353 {
354 "type": "string",
355 "pattern": "^0x[0-9a-fA-F]{2}$"
356 },
357
358 "read_sensor_format":
359 {
360 "type": "string",
361 "enum": ["linear_11", "linear_16"]
362 },
363
Shawn McCarney4dc9a302021-08-14 10:52:47 -0500364 "chassis_object":
365 {
366 "type": "object",
367 "properties":
368 {
369 "comments": {"$ref": "#/definitions/comments" },
370 "number": {"$ref": "#/definitions/number" },
371 "inventory_path": {"$ref": "#/definitions/inventory_path" },
372 "devices": {"$ref": "#/definitions/devices" }
373 },
Shawn McCarney4c88a4c2021-09-21 15:29:24 -0500374 "required": ["number", "inventory_path"],
Shawn McCarney4dc9a302021-08-14 10:52:47 -0500375 "additionalProperties": false
376 },
377
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800378 "chassis":
379 {
380 "type": "array",
Shawn McCarney4dc9a302021-08-14 10:52:47 -0500381 "items": {"$ref": "#/definitions/chassis_object" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800382 "minItems": 1
383 },
384
385 "number":
386 {
387 "type": "integer",
388 "minimum": 1
389 },
390
Shawn McCarney4dc9a302021-08-14 10:52:47 -0500391 "device":
392 {
393 "type": "object",
394 "properties":
395 {
396 "comments": {"$ref": "#/definitions/comments" },
397 "id": {"$ref": "#/definitions/id" },
398 "is_regulator": {"$ref": "#/definitions/is_regulator" },
399 "fru": {"$ref": "#/definitions/inventory_path" },
400 "i2c_interface": {"$ref": "#/definitions/i2c_interface" },
401 "presence_detection": {"$ref": "#/definitions/presence_detection" },
402 "configuration": {"$ref": "#/definitions/configuration" },
Shawn McCarney846dde52021-08-14 12:47:44 -0500403 "phase_fault_detection": {"$ref": "#/definitions/phase_fault_detection" },
Shawn McCarney4dc9a302021-08-14 10:52:47 -0500404 "rails": {"$ref": "#/definitions/rails" }
405 },
406 "required": ["id", "is_regulator", "fru", "i2c_interface"],
407 "if":
408 {
409 "properties": { "is_regulator": { "const": false } }
410 },
411 "then":
412 {
Shawn McCarney846dde52021-08-14 12:47:44 -0500413 "not": {
414 "anyOf": [
415 { "required": ["phase_fault_detection"] },
416 { "required": ["rails"] }
417 ]
418 }
Shawn McCarney4dc9a302021-08-14 10:52:47 -0500419 },
420 "additionalProperties": false
421 },
422
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800423 "devices":
424 {
425 "type": "array",
Shawn McCarney4dc9a302021-08-14 10:52:47 -0500426 "items": {"$ref": "#/definitions/device" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800427 "minItems": 1
428 },
429
430 "is_regulator":
431 {
432 "type": "boolean"
433 },
434
435 "i2c_interface":
436 {
437 "type": "object",
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800438 "properties":
439 {
440 "bus": {"$ref": "#/definitions/bus" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800441 "address": {"$ref": "#/definitions/address" }
442 },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800443 "required": ["bus", "address"],
444 "additionalProperties": false
445 },
446
447 "bus":
448 {
449 "type": "integer",
450 "minimum": 0
451 },
452
453 "address":
454 {
455 "type": "string",
456 "pattern": "^0x[0-9A-Fa-f]{2}$"
457 },
458
459 "presence_detection":
460 {
461 "type": "object",
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800462 "properties":
463 {
464 "comments": {"$ref": "#/definitions/comments" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800465 "rule_id": {"$ref": "#/definitions/id" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800466 "actions": {"$ref": "#/definitions/actions" }
467 },
468 "additionalProperties": false,
469 "oneOf": [
470 {"required": ["rule_id"]},
471 {"required": ["actions"]}
472 ]
473 },
474
475 "configuration":
476 {
477 "type": "object",
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800478 "properties":
479 {
480 "comments": {"$ref": "#/definitions/comments" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800481 "volts": {"$ref": "#/definitions/volts" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800482 "rule_id": {"$ref": "#/definitions/id" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800483 "actions": {"$ref": "#/definitions/actions" }
484 },
485 "additionalProperties": false,
486 "oneOf": [
487 {"required": ["rule_id"]},
488 {"required": ["actions"]}
489 ]
490 },
491
Shawn McCarney846dde52021-08-14 12:47:44 -0500492 "phase_fault_detection":
493 {
494 "type": "object",
495 "properties":
496 {
497 "comments": {"$ref": "#/definitions/comments" },
498 "device_id": {"$ref": "#/definitions/id" },
499 "rule_id": {"$ref": "#/definitions/id" },
500 "actions": {"$ref": "#/definitions/actions" }
501 },
502 "additionalProperties": false,
503 "oneOf": [
504 {"required": ["rule_id"]},
505 {"required": ["actions"]}
506 ]
507 },
508
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800509 "rail":
510 {
511 "type": "object",
512 "properties":
513 {
514 "comments": {"$ref": "#/definitions/comments" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800515 "id": {"$ref": "#/definitions/id" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800516 "configuration": {"$ref": "#/definitions/configuration" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800517 "sensor_monitoring": {"$ref": "#/definitions/sensor_monitoring" }
518 },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800519 "required": ["id"],
520 "additionalProperties": false
521 },
522
523 "rails":
524 {
525 "type": "array",
526 "items": {"$ref": "#/definitions/rail" },
527 "minItems": 1
528 },
529
530 "sensor_monitoring":
531 {
532 "type": "object",
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800533 "properties":
534 {
535 "comments": {"$ref": "#/definitions/comments" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800536 "rule_id": {"$ref": "#/definitions/id" },
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800537 "actions": {"$ref": "#/definitions/actions" }
538 },
539 "additionalProperties": false,
540 "oneOf": [
541 {"required": ["rule_id"]},
542 {"required": ["actions"]}
543 ]
544 }
Bob Kingdcb4b3b2019-12-17 18:07:06 +0800545 }
546}