1#!/usr/bin/env python3
2
3# System states
4# state can change to next state in 2 ways:
5# - a process emits a GotoSystemState signal with state name to goto
6# - objects specified in EXIT_STATE_DEPEND have started
7SYSTEM_STATES = [
8    "BASE_APPS",
9    "BMC_STARTING",
10    "BMC_READY",
11    "HOST_POWERING_ON",
12    "HOST_POWERED_ON",
13    "HOST_BOOTING",
14    "HOST_BOOTED",
15    "HOST_POWERED_OFF",
16]
17
18EXIT_STATE_DEPEND = {
19    "BASE_APPS": {
20        "/org/openbmc/sensors": 0,
21    },
22    "BMC_STARTING": {
23        "/org/openbmc/control/chassis0": 0,
24        "/org/openbmc/control/power0": 0,
25        "/org/openbmc/control/flash/bios": 0,
26    },
27}
28
29FRU_INSTANCES = {
30    "<inventory_root>/system": {
31        "fru_type": "SYSTEM",
32        "is_fru": True,
33        "present": "True",
34    },
35    "<inventory_root>/system/bios": {
36        "fru_type": "SYSTEM",
37        "is_fru": True,
38        "present": "True",
39    },
40    "<inventory_root>/system/misc": {
41        "fru_type": "SYSTEM",
42        "is_fru": False,
43    },
44    "<inventory_root>/system/chassis": {
45        "fru_type": "SYSTEM",
46        "is_fru": True,
47        "present": "True",
48    },
49    "<inventory_root>/system/chassis/motherboard": {
50        "fru_type": "MAIN_PLANAR",
51        "is_fru": True,
52    },
53    "<inventory_root>/system/systemevent": {
54        "fru_type": "SYSTEM_EVENT",
55        "is_fru": False,
56    },
57    "<inventory_root>/system/chassis/motherboard/refclock": {
58        "fru_type": "MAIN_PLANAR",
59        "is_fru": False,
60    },
61    "<inventory_root>/system/chassis/motherboard/pcieclock": {
62        "fru_type": "MAIN_PLANAR",
63        "is_fru": False,
64    },
65    "<inventory_root>/system/chassis/motherboard/todclock": {
66        "fru_type": "MAIN_PLANAR",
67        "is_fru": False,
68    },
69    "<inventory_root>/system/chassis/motherboard/apss": {
70        "fru_type": "MAIN_PLANAR",
71        "is_fru": False,
72    },
73    "<inventory_root>/system/chassis/fan0": {
74        "fru_type": "FAN",
75        "is_fru": True,
76    },
77    "<inventory_root>/system/chassis/fan1": {
78        "fru_type": "FAN",
79        "is_fru": True,
80    },
81    "<inventory_root>/system/chassis/fan2": {
82        "fru_type": "FAN",
83        "is_fru": True,
84    },
85    "<inventory_root>/system/chassis/fan3": {
86        "fru_type": "FAN",
87        "is_fru": True,
88    },
89    "<inventory_root>/system/chassis/motherboard/bmc": {
90        "fru_type": "BMC",
91        "is_fru": False,
92        "manufacturer": "ASPEED",
93    },
94    "<inventory_root>/system/chassis/motherboard/cpu0": {
95        "fru_type": "CPU",
96        "is_fru": True,
97    },
98    "<inventory_root>/system/chassis/motherboard/cpu1": {
99        "fru_type": "CPU",
100        "is_fru": True,
101    },
102    "<inventory_root>/system/chassis/motherboard/cpu0/core0": {
103        "fru_type": "CORE",
104        "is_fru": False,
105    },
106    "<inventory_root>/system/chassis/motherboard/cpu0/core1": {
107        "fru_type": "CORE",
108        "is_fru": False,
109    },
110    "<inventory_root>/system/chassis/motherboard/cpu0/core2": {
111        "fru_type": "CORE",
112        "is_fru": False,
113    },
114    "<inventory_root>/system/chassis/motherboard/cpu0/core3": {
115        "fru_type": "CORE",
116        "is_fru": False,
117    },
118    "<inventory_root>/system/chassis/motherboard/cpu0/core4": {
119        "fru_type": "CORE",
120        "is_fru": False,
121    },
122    "<inventory_root>/system/chassis/motherboard/cpu0/core5": {
123        "fru_type": "CORE",
124        "is_fru": False,
125    },
126    "<inventory_root>/system/chassis/motherboard/cpu0/core6": {
127        "fru_type": "CORE",
128        "is_fru": False,
129    },
130    "<inventory_root>/system/chassis/motherboard/cpu0/core7": {
131        "fru_type": "CORE",
132        "is_fru": False,
133    },
134    "<inventory_root>/system/chassis/motherboard/cpu0/core8": {
135        "fru_type": "CORE",
136        "is_fru": False,
137    },
138    "<inventory_root>/system/chassis/motherboard/cpu0/core9": {
139        "fru_type": "CORE",
140        "is_fru": False,
141    },
142    "<inventory_root>/system/chassis/motherboard/cpu0/core10": {
143        "fru_type": "CORE",
144        "is_fru": False,
145    },
146    "<inventory_root>/system/chassis/motherboard/cpu0/core11": {
147        "fru_type": "CORE",
148        "is_fru": False,
149    },
150    "<inventory_root>/system/chassis/motherboard/cpu1/core0": {
151        "fru_type": "CORE",
152        "is_fru": False,
153    },
154    "<inventory_root>/system/chassis/motherboard/cpu1/core1": {
155        "fru_type": "CORE",
156        "is_fru": False,
157    },
158    "<inventory_root>/system/chassis/motherboard/cpu1/core2": {
159        "fru_type": "CORE",
160        "is_fru": False,
161    },
162    "<inventory_root>/system/chassis/motherboard/cpu1/core3": {
163        "fru_type": "CORE",
164        "is_fru": False,
165    },
166    "<inventory_root>/system/chassis/motherboard/cpu1/core4": {
167        "fru_type": "CORE",
168        "is_fru": False,
169    },
170    "<inventory_root>/system/chassis/motherboard/cpu1/core5": {
171        "fru_type": "CORE",
172        "is_fru": False,
173    },
174    "<inventory_root>/system/chassis/motherboard/cpu1/core6": {
175        "fru_type": "CORE",
176        "is_fru": False,
177    },
178    "<inventory_root>/system/chassis/motherboard/cpu1/core7": {
179        "fru_type": "CORE",
180        "is_fru": False,
181    },
182    "<inventory_root>/system/chassis/motherboard/cpu1/core8": {
183        "fru_type": "CORE",
184        "is_fru": False,
185    },
186    "<inventory_root>/system/chassis/motherboard/cpu1/core9": {
187        "fru_type": "CORE",
188        "is_fru": False,
189    },
190    "<inventory_root>/system/chassis/motherboard/cpu1/core10": {
191        "fru_type": "CORE",
192        "is_fru": False,
193    },
194    "<inventory_root>/system/chassis/motherboard/cpu1/core11": {
195        "fru_type": "CORE",
196        "is_fru": False,
197    },
198    "<inventory_root>/system/chassis/motherboard/membuf0": {
199        "fru_type": "MEMORY_BUFFER",
200        "is_fru": False,
201    },
202    "<inventory_root>/system/chassis/motherboard/membuf1": {
203        "fru_type": "MEMORY_BUFFER",
204        "is_fru": False,
205    },
206    "<inventory_root>/system/chassis/motherboard/membuf2": {
207        "fru_type": "MEMORY_BUFFER",
208        "is_fru": False,
209    },
210    "<inventory_root>/system/chassis/motherboard/membuf3": {
211        "fru_type": "MEMORY_BUFFER",
212        "is_fru": False,
213    },
214    "<inventory_root>/system/chassis/motherboard/membuf4": {
215        "fru_type": "MEMORY_BUFFER",
216        "is_fru": False,
217    },
218    "<inventory_root>/system/chassis/motherboard/membuf5": {
219        "fru_type": "MEMORY_BUFFER",
220        "is_fru": False,
221    },
222    "<inventory_root>/system/chassis/motherboard/membuf6": {
223        "fru_type": "MEMORY_BUFFER",
224        "is_fru": False,
225    },
226    "<inventory_root>/system/chassis/motherboard/membuf7": {
227        "fru_type": "MEMORY_BUFFER",
228        "is_fru": False,
229    },
230    "<inventory_root>/system/chassis/motherboard/dimm0": {
231        "fru_type": "DIMM",
232        "is_fru": True,
233    },
234    "<inventory_root>/system/chassis/motherboard/dimm1": {
235        "fru_type": "DIMM",
236        "is_fru": True,
237    },
238    "<inventory_root>/system/chassis/motherboard/dimm2": {
239        "fru_type": "DIMM",
240        "is_fru": True,
241    },
242    "<inventory_root>/system/chassis/motherboard/dimm3": {
243        "fru_type": "DIMM",
244        "is_fru": True,
245    },
246    "<inventory_root>/system/chassis/motherboard/dimm4": {
247        "fru_type": "DIMM",
248        "is_fru": True,
249    },
250    "<inventory_root>/system/chassis/motherboard/dimm5": {
251        "fru_type": "DIMM",
252        "is_fru": True,
253    },
254    "<inventory_root>/system/chassis/motherboard/dimm6": {
255        "fru_type": "DIMM",
256        "is_fru": True,
257    },
258    "<inventory_root>/system/chassis/motherboard/dimm7": {
259        "fru_type": "DIMM",
260        "is_fru": True,
261    },
262    "<inventory_root>/system/chassis/motherboard/dimm8": {
263        "fru_type": "DIMM",
264        "is_fru": True,
265    },
266    "<inventory_root>/system/chassis/motherboard/dimm9": {
267        "fru_type": "DIMM",
268        "is_fru": True,
269    },
270    "<inventory_root>/system/chassis/motherboard/dimm10": {
271        "fru_type": "DIMM",
272        "is_fru": True,
273    },
274    "<inventory_root>/system/chassis/motherboard/dimm11": {
275        "fru_type": "DIMM",
276        "is_fru": True,
277    },
278    "<inventory_root>/system/chassis/motherboard/dimm12": {
279        "fru_type": "DIMM",
280        "is_fru": True,
281    },
282    "<inventory_root>/system/chassis/motherboard/dimm13": {
283        "fru_type": "DIMM",
284        "is_fru": True,
285    },
286    "<inventory_root>/system/chassis/motherboard/dimm14": {
287        "fru_type": "DIMM",
288        "is_fru": True,
289    },
290    "<inventory_root>/system/chassis/motherboard/dimm15": {
291        "fru_type": "DIMM",
292        "is_fru": True,
293    },
294    "<inventory_root>/system/chassis/motherboard/dimm16": {
295        "fru_type": "DIMM",
296        "is_fru": True,
297    },
298    "<inventory_root>/system/chassis/motherboard/dimm17": {
299        "fru_type": "DIMM",
300        "is_fru": True,
301    },
302    "<inventory_root>/system/chassis/motherboard/dimm18": {
303        "fru_type": "DIMM",
304        "is_fru": True,
305    },
306    "<inventory_root>/system/chassis/motherboard/dimm19": {
307        "fru_type": "DIMM",
308        "is_fru": True,
309    },
310    "<inventory_root>/system/chassis/motherboard/dimm20": {
311        "fru_type": "DIMM",
312        "is_fru": True,
313    },
314    "<inventory_root>/system/chassis/motherboard/dimm21": {
315        "fru_type": "DIMM",
316        "is_fru": True,
317    },
318    "<inventory_root>/system/chassis/motherboard/dimm22": {
319        "fru_type": "DIMM",
320        "is_fru": True,
321    },
322    "<inventory_root>/system/chassis/motherboard/dimm23": {
323        "fru_type": "DIMM",
324        "is_fru": True,
325    },
326    "<inventory_root>/system/chassis/motherboard/dimm24": {
327        "fru_type": "DIMM",
328        "is_fru": True,
329    },
330    "<inventory_root>/system/chassis/motherboard/dimm25": {
331        "fru_type": "DIMM",
332        "is_fru": True,
333    },
334    "<inventory_root>/system/chassis/motherboard/dimm26": {
335        "fru_type": "DIMM",
336        "is_fru": True,
337    },
338    "<inventory_root>/system/chassis/motherboard/dimm27": {
339        "fru_type": "DIMM",
340        "is_fru": True,
341    },
342    "<inventory_root>/system/chassis/motherboard/dimm28": {
343        "fru_type": "DIMM",
344        "is_fru": True,
345    },
346    "<inventory_root>/system/chassis/motherboard/dimm29": {
347        "fru_type": "DIMM",
348        "is_fru": True,
349    },
350    "<inventory_root>/system/chassis/motherboard/dimm30": {
351        "fru_type": "DIMM",
352        "is_fru": True,
353    },
354    "<inventory_root>/system/chassis/motherboard/dimm31": {
355        "fru_type": "DIMM",
356        "is_fru": True,
357    },
358}
359
360ID_LOOKUP = {
361    "FRU": {
362        0x01: "<inventory_root>/system/chassis/motherboard/cpu0",
363        0x02: "<inventory_root>/system/chassis/motherboard/cpu1",
364        0x03: "<inventory_root>/system/chassis/motherboard",
365        0x04: "<inventory_root>/system/chassis/motherboard/membuf0",
366        0x05: "<inventory_root>/system/chassis/motherboard/membuf1",
367        0x06: "<inventory_root>/system/chassis/motherboard/membuf2",
368        0x07: "<inventory_root>/system/chassis/motherboard/membuf3",
369        0x08: "<inventory_root>/system/chassis/motherboard/membuf4",
370        0x09: "<inventory_root>/system/chassis/motherboard/membuf5",
371        0x0C: "<inventory_root>/system/chassis/motherboard/dimm0",
372        0x0D: "<inventory_root>/system/chassis/motherboard/dimm1",
373        0x0E: "<inventory_root>/system/chassis/motherboard/dimm2",
374        0x0F: "<inventory_root>/system/chassis/motherboard/dimm3",
375        0x10: "<inventory_root>/system/chassis/motherboard/dimm4",
376        0x11: "<inventory_root>/system/chassis/motherboard/dimm5",
377        0x12: "<inventory_root>/system/chassis/motherboard/dimm6",
378        0x13: "<inventory_root>/system/chassis/motherboard/dimm7",
379        0x14: "<inventory_root>/system/chassis/motherboard/dimm8",
380        0x15: "<inventory_root>/system/chassis/motherboard/dimm9",
381        0x16: "<inventory_root>/system/chassis/motherboard/dimm10",
382        0x17: "<inventory_root>/system/chassis/motherboard/dimm11",
383        0x18: "<inventory_root>/system/chassis/motherboard/dimm12",
384        0x19: "<inventory_root>/system/chassis/motherboard/dimm13",
385        0x1A: "<inventory_root>/system/chassis/motherboard/dimm14",
386        0x1B: "<inventory_root>/system/chassis/motherboard/dimm15",
387        0x1C: "<inventory_root>/system/chassis/motherboard/dimm16",
388        0x1D: "<inventory_root>/system/chassis/motherboard/dimm17",
389        0x1E: "<inventory_root>/system/chassis/motherboard/dimm18",
390        0x1F: "<inventory_root>/system/chassis/motherboard/dimm19",
391        0x20: "<inventory_root>/system/chassis/motherboard/dimm20",
392        0x21: "<inventory_root>/system/chassis/motherboard/dimm21",
393        0x22: "<inventory_root>/system/chassis/motherboard/dimm22",
394        0x23: "<inventory_root>/system/chassis/motherboard/dimm23",
395        0x24: "<inventory_root>/system/chassis/motherboard/dimm24",
396        0x25: "<inventory_root>/system/chassis/motherboard/dimm25",
397        0x26: "<inventory_root>/system/chassis/motherboard/dimm26",
398        0x27: "<inventory_root>/system/chassis/motherboard/dimm27",
399        0x28: "<inventory_root>/system/chassis/motherboard/dimm28",
400        0x29: "<inventory_root>/system/chassis/motherboard/dimm29",
401        0x2A: "<inventory_root>/system/chassis/motherboard/dimm30",
402        0x2B: "<inventory_root>/system/chassis/motherboard/dimm31",
403    },
404    "FRU_STR": {
405        "PRODUCT_0": "<inventory_root>/system/bios",
406        "BOARD_1": "<inventory_root>/system/chassis/motherboard/cpu0",
407        "BOARD_2": "<inventory_root>/system/chassis/motherboard/cpu1",
408        "CHASSIS_3": "<inventory_root>/system/chassis/motherboard",
409        "BOARD_3": "<inventory_root>/system/misc",
410        "BOARD_4": "<inventory_root>/system/chassis/motherboard/membuf0",
411        "BOARD_5": "<inventory_root>/system/chassis/motherboard/membuf1",
412        "BOARD_6": "<inventory_root>/system/chassis/motherboard/membuf2",
413        "BOARD_7": "<inventory_root>/system/chassis/motherboard/membuf3",
414        "BOARD_8": "<inventory_root>/system/chassis/motherboard/membuf4",
415        "BOARD_9": "<inventory_root>/system/chassis/motherboard/membuf5",
416        "BOARD_10": "<inventory_root>/system/chassis/motherboard/membuf6",
417        "BOARD_11": "<inventory_root>/system/chassis/motherboard/membuf7",
418        "PRODUCT_12": "<inventory_root>/system/chassis/motherboard/dimm0",
419        "PRODUCT_13": "<inventory_root>/system/chassis/motherboard/dimm1",
420        "PRODUCT_14": "<inventory_root>/system/chassis/motherboard/dimm2",
421        "PRODUCT_15": "<inventory_root>/system/chassis/motherboard/dimm3",
422        "PRODUCT_16": "<inventory_root>/system/chassis/motherboard/dimm4",
423        "PRODUCT_17": "<inventory_root>/system/chassis/motherboard/dimm5",
424        "PRODUCT_18": "<inventory_root>/system/chassis/motherboard/dimm6",
425        "PRODUCT_19": "<inventory_root>/system/chassis/motherboard/dimm7",
426        "PRODUCT_20": "<inventory_root>/system/chassis/motherboard/dimm8",
427        "PRODUCT_21": "<inventory_root>/system/chassis/motherboard/dimm9",
428        "PRODUCT_22": "<inventory_root>/system/chassis/motherboard/dimm10",
429        "PRODUCT_23": "<inventory_root>/system/chassis/motherboard/dimm11",
430        "PRODUCT_24": "<inventory_root>/system/chassis/motherboard/dimm12",
431        "PRODUCT_25": "<inventory_root>/system/chassis/motherboard/dimm13",
432        "PRODUCT_26": "<inventory_root>/system/chassis/motherboard/dimm14",
433        "PRODUCT_27": "<inventory_root>/system/chassis/motherboard/dimm15",
434        "PRODUCT_28": "<inventory_root>/system/chassis/motherboard/dimm16",
435        "PRODUCT_29": "<inventory_root>/system/chassis/motherboard/dimm17",
436        "PRODUCT_30": "<inventory_root>/system/chassis/motherboard/dimm18",
437        "PRODUCT_31": "<inventory_root>/system/chassis/motherboard/dimm19",
438        "PRODUCT_32": "<inventory_root>/system/chassis/motherboard/dimm20",
439        "PRODUCT_33": "<inventory_root>/system/chassis/motherboard/dimm21",
440        "PRODUCT_34": "<inventory_root>/system/chassis/motherboard/dimm22",
441        "PRODUCT_35": "<inventory_root>/system/chassis/motherboard/dimm23",
442        "PRODUCT_36": "<inventory_root>/system/chassis/motherboard/dimm24",
443        "PRODUCT_37": "<inventory_root>/system/chassis/motherboard/dimm25",
444        "PRODUCT_38": "<inventory_root>/system/chassis/motherboard/dimm26",
445        "PRODUCT_39": "<inventory_root>/system/chassis/motherboard/dimm27",
446        "PRODUCT_40": "<inventory_root>/system/chassis/motherboard/dimm28",
447        "PRODUCT_41": "<inventory_root>/system/chassis/motherboard/dimm29",
448        "PRODUCT_42": "<inventory_root>/system/chassis/motherboard/dimm30",
449        "PRODUCT_43": "<inventory_root>/system/chassis/motherboard/dimm31",
450        "PRODUCT_47": "<inventory_root>/system/misc",
451    },
452    "SENSOR": {
453        0x02: "/org/openbmc/sensors/host/HostStatus",
454        0x03: "/org/openbmc/sensors/host/BootProgress",
455        0x5A: "<inventory_root>/system/chassis/motherboard/cpu0",
456        0xA4: "<inventory_root>/system/chassis/motherboard/cpu1",
457        0x1E: "<inventory_root>/system/chassis/motherboard/dimm3",
458        0x1F: "<inventory_root>/system/chassis/motherboard/dimm2",
459        0x20: "<inventory_root>/system/chassis/motherboard/dimm1",
460        0x21: "<inventory_root>/system/chassis/motherboard/dimm0",
461        0x22: "<inventory_root>/system/chassis/motherboard/dimm7",
462        0x23: "<inventory_root>/system/chassis/motherboard/dimm6",
463        0x24: "<inventory_root>/system/chassis/motherboard/dimm5",
464        0x25: "<inventory_root>/system/chassis/motherboard/dimm4",
465        0x26: "<inventory_root>/system/chassis/motherboard/dimm11",
466        0x27: "<inventory_root>/system/chassis/motherboard/dimm10",
467        0x28: "<inventory_root>/system/chassis/motherboard/dimm9",
468        0x29: "<inventory_root>/system/chassis/motherboard/dimm8",
469        0x2A: "<inventory_root>/system/chassis/motherboard/dimm15",
470        0x2B: "<inventory_root>/system/chassis/motherboard/dimm14",
471        0x2C: "<inventory_root>/system/chassis/motherboard/dimm13",
472        0x2D: "<inventory_root>/system/chassis/motherboard/dimm12",
473        0x2E: "<inventory_root>/system/chassis/motherboard/dimm19",
474        0x2F: "<inventory_root>/system/chassis/motherboard/dimm18",
475        0x30: "<inventory_root>/system/chassis/motherboard/dimm17",
476        0x31: "<inventory_root>/system/chassis/motherboard/dimm16",
477        0x32: "<inventory_root>/system/chassis/motherboard/dimm23",
478        0x33: "<inventory_root>/system/chassis/motherboard/dimm22",
479        0x34: "<inventory_root>/system/chassis/motherboard/dimm21",
480        0x35: "<inventory_root>/system/chassis/motherboard/dimm20",
481        0x36: "<inventory_root>/system/chassis/motherboard/dimm27",
482        0x37: "<inventory_root>/system/chassis/motherboard/dimm26",
483        0x38: "<inventory_root>/system/chassis/motherboard/dimm25",
484        0x39: "<inventory_root>/system/chassis/motherboard/dimm24",
485        0x3A: "<inventory_root>/system/chassis/motherboard/dimm31",
486        0x3B: "<inventory_root>/system/chassis/motherboard/dimm30",
487        0x3C: "<inventory_root>/system/chassis/motherboard/dimm29",
488        0x3D: "<inventory_root>/system/chassis/motherboard/dimm28",
489        0x3E: "<inventory_root>/system/chassis/motherboard/cpu0/core0",
490        0x3F: "<inventory_root>/system/chassis/motherboard/cpu0/core1",
491        0x40: "<inventory_root>/system/chassis/motherboard/cpu0/core2",
492        0x41: "<inventory_root>/system/chassis/motherboard/cpu0/core3",
493        0x42: "<inventory_root>/system/chassis/motherboard/cpu0/core4",
494        0x43: "<inventory_root>/system/chassis/motherboard/cpu0/core5",
495        0x44: "<inventory_root>/system/chassis/motherboard/cpu0/core6",
496        0x45: "<inventory_root>/system/chassis/motherboard/cpu0/core7",
497        0x46: "<inventory_root>/system/chassis/motherboard/cpu0/core8",
498        0x47: "<inventory_root>/system/chassis/motherboard/cpu0/core9",
499        0x48: "<inventory_root>/system/chassis/motherboard/cpu0/core10",
500        0x49: "<inventory_root>/system/chassis/motherboard/cpu0/core11",
501        0x4A: "<inventory_root>/system/chassis/motherboard/cpu1/core0",
502        0x4B: "<inventory_root>/system/chassis/motherboard/cpu1/core1",
503        0x4C: "<inventory_root>/system/chassis/motherboard/cpu1/core2",
504        0x4D: "<inventory_root>/system/chassis/motherboard/cpu1/core3",
505        0x4E: "<inventory_root>/system/chassis/motherboard/cpu1/core4",
506        0x4F: "<inventory_root>/system/chassis/motherboard/cpu1/core5",
507        0x50: "<inventory_root>/system/chassis/motherboard/cpu1/core6",
508        0x51: "<inventory_root>/system/chassis/motherboard/cpu1/core7",
509        0x52: "<inventory_root>/system/chassis/motherboard/cpu1/core8",
510        0x53: "<inventory_root>/system/chassis/motherboard/cpu1/core9",
511        0x54: "<inventory_root>/system/chassis/motherboard/cpu1/core10",
512        0x55: "<inventory_root>/system/chassis/motherboard/cpu1/core11",
513        0x56: "<inventory_root>/system/chassis/motherboard/membuf0",
514        0x57: "<inventory_root>/system/chassis/motherboard/membuf1",
515        0x58: "<inventory_root>/system/chassis/motherboard/membuf2",
516        0x59: "<inventory_root>/system/chassis/motherboard/membuf3",
517        0x5A: "<inventory_root>/system/chassis/motherboard/membuf4",
518        0x5B: "<inventory_root>/system/chassis/motherboard/membuf5",
519        0x5C: "<inventory_root>/system/chassis/motherboard/membuf6",
520        0x5D: "<inventory_root>/system/chassis/motherboard/membuf7",
521        0x07: "/org/openbmc/sensors/host/BootCount",
522        0x0C: "<inventory_root>/system/chassis/motherboard",
523        0x01: "<inventory_root>/system/systemevent",
524        0x08: "<inventory_root>/system/powerlimit",
525        0x0D: "<inventory_root>/system/chassis/motherboard/refclock",
526        0x0E: "<inventory_root>/system/chassis/motherboard/pcieclock",
527        0x0F: "<inventory_root>/system/chassis/motherboard/todclock",
528        0x10: "<inventory_root>/system/chassis/motherboard/apss",
529        0x02: "/org/openbmc/sensors/host/OperatingSystemStatus",
530        0x04: "<inventory_root>/system/chassis/motherboard/pcielink",
531        0x0B: "/xyz/openbmc_project/sensors/chassis/PowerSupplyRedundancy",
532        0xDA: "/org/openbmc/sensors/host/TurboAllowed",
533        0xD8: "/org/openbmc/sensors/host/PowerSupplyDerating",
534    },
535    "GPIO_PRESENT": {},
536}
537
538GPIO_CONFIG = {}
539GPIO_CONFIG["BMC_POWER_UP"] = {"gpio_pin": "D1", "direction": "out"}
540GPIO_CONFIG["SOFTWARE_PGOOD"] = {"gpio_pin": "R1", "direction": "out"}
541GPIO_CONFIG["SYS_PWROK_BUFF"] = {"gpio_pin": "D2", "direction": "in"}
542
543# PV_CP_MD_JTAG_ATTENTION_N
544GPIO_CONFIG["CHECKSTOP"] = {"gpio_pin": "J2", "direction": "falling"}
545
546GPIO_CONFIG["BMC_CP0_RESET_N"] = {"gpio_pin": "A1", "direction": "out"}
547# pcie switch reset
548GPIO_CONFIG["BMC_VS1_PERST_N"] = {"gpio_pin": "B7", "direction": "out"}
549# pcie slots reset - not connected?
550GPIO_CONFIG["BMC_CP0_PERST_ENABLE_R"] = {"gpio_pin": "A3", "direction": "out"}
551
552# SOFT_FSI_DAT
553GPIO_CONFIG["FSI_DATA"] = {"gpio_pin": "E0", "direction": "out"}
554# SOFT_FSI_CLK
555GPIO_CONFIG["FSI_CLK"] = {"gpio_pin": "AA0", "direction": "out"}
556# BMC_FSI_IN_ENA
557GPIO_CONFIG["FSI_ENABLE"] = {"gpio_pin": "D0", "direction": "out"}
558# FSI_JMFG0_PRSNT_N
559GPIO_CONFIG["CRONUS_SEL"] = {"gpio_pin": "A6", "direction": "out"}
560
561# FP_PWR_BTN_N
562GPIO_CONFIG["POWER_BUTTON"] = {"gpio_pin": "I3", "direction": "both"}
563# BMC_NMIBTN_IN_N
564GPIO_CONFIG["RESET_BUTTON"] = {"gpio_pin": "J1", "direction": "both"}
565
566# FP_ID_BTN_N
567GPIO_CONFIG["IDBTN"] = {"gpio_pin": "Q7", "direction": "out"}
568
569GPIO_CONFIGS = {
570    "power_config": {
571        "power_good_in": "SYS_PWROK_BUFF",
572        "power_up_outs": [
573            ("SOFTWARE_PGOOD", True),
574            ("BMC_POWER_UP", True),
575        ],
576        "reset_outs": [
577            ("BMC_CP0_RESET_N", False),
578        ],
579    },
580    "hostctl_config": {
581        "fsi_data": "FSI_DATA",
582        "fsi_clk": "FSI_CLK",
583        "fsi_enable": "FSI_ENABLE",
584        "cronus_sel": "CRONUS_SEL",
585        "optionals": [],
586    },
587}
588
589
590# Miscellaneous non-poll sensor with system specific properties.
591# The sensor id is the same as those defined in ID_LOOKUP['SENSOR'].
592MISC_SENSORS = {
593    0x07: {"class": "BootCountSensor"},
594    0x03: {"class": "BootProgressSensor"},
595    0x02: {"class": "OperatingSystemStatusSensor"},
596    # Garrison value is used, Not in P9 XML yet.
597    0x0B: {"class": "PowerSupplyRedundancySensor"},
598    0xDA: {"class": "TurboAllowedSensor"},
599    0xD8: {"class": "PowerSupplyDeratingSensor"},
600}
601
602# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
603