blob: 2863d0167996ff71bea10933d3f692883653b213 [file] [log] [blame]
Norman Jamesc9239a32015-10-06 16:54:31 -05001#! /usr/bin/python
2
3import dbus
4import Openbmc
5
6HOME_PATH = './'
Norman Jamesc9239a32015-10-06 16:54:31 -05007CACHE_PATH = HOME_PATH+'cache/'
8FRU_PATH = CACHE_PATH+'frus/'
Norman James25d80dd2015-10-08 07:02:25 -05009FLASH_DOWNLOAD_PATH = "/tmp"
10
Norman James969227c2015-10-08 15:10:47 -050011SYSTEM_NAME = "Palmetto"
Norman Jamesc9239a32015-10-06 16:54:31 -050012
13SYSTEM_STATES = [
14 'INIT',
15 'STANDBY',
16 'POWERING_ON',
17 'POWERED_ON',
18 'BOOTING',
19 'HOST_UP',
20 'SHUTTING_DOWN',
21 'POWERING_DOWN'
22]
23
24ENTER_STATE_CALLBACK = {
25 'POWERED_ON' : {
26 'bus_name' : 'org.openbmc.control.Host',
27 'obj_name' : '/org/openbmc/control/Host_0',
28 'interface_name' : 'org.openbmc.control.Host',
29 'method_name' : 'boot'
30 }
31}
32
33SYSTEM_CONFIG = {}
34
35SYSTEM_CONFIG['org.openbmc.control.Bmc'] = {
36 'system_state' : 'INIT',
37 'start_process' : True,
38 'monitor_process' : True,
39 'process_name' : 'control_bmc.exe',
40 'heartbeat' : 'no',
41 'instances' : [ { 'name' : 'Bmc_0' } ]
42 }
43
44SYSTEM_CONFIG['org.openbmc.managers.Inventory'] = {
45 'system_state' : 'STANDBY',
46 'start_process' : True,
47 'monitor_process' : True,
48 'process_name' : 'inventory_items.py',
49 'heartbeat' : 'no',
Norman James25d80dd2015-10-08 07:02:25 -050050 'instances' : [ { 'name' : SYSTEM_NAME } ]
Norman Jamesc9239a32015-10-06 16:54:31 -050051 }
52SYSTEM_CONFIG['org.openbmc.control.PciePresent'] = {
Norman James25d80dd2015-10-08 07:02:25 -050053 'system_state' : 'POWERED_ON',
Norman Jamesc9239a32015-10-06 16:54:31 -050054 'start_process' : True,
55 'monitor_process' : False,
56 'process_name' : 'pcie_slot_present.exe',
57 'heartbeat' : 'no',
58 'instances' : [ { 'name' : 'Slots_0' } ]
59 }
Norman James0ee61922015-10-14 09:39:11 -050060SYSTEM_CONFIG['org.openbmc.sensor.Power8Virtual'] = {
61 'system_state' : 'POWERING_ON',
62 'start_process' : True,
63 'monitor_process' : True,
64 'process_name' : 'sensors_virtual_p8.py',
65 'heartbeat' : 'no',
66 'instances' : [ { 'name' : 'Dummy' } ]
67 }
Norman Jamesc9239a32015-10-06 16:54:31 -050068
69SYSTEM_CONFIG['org.openbmc.managers.Sensors'] = {
70 'system_state' : 'STANDBY',
71 'start_process' : True,
72 'monitor_process' : True,
73 'process_name' : 'sensor_manager.py',
74 'heartbeat' : 'no',
Norman James25d80dd2015-10-08 07:02:25 -050075 'instances' : [ { 'name' : SYSTEM_NAME } ]
Norman Jamesc9239a32015-10-06 16:54:31 -050076 }
77
78SYSTEM_CONFIG['org.openbmc.watchdog.Host'] = {
79 'system_state' : 'STANDBY',
80 'start_process' : True,
81 'monitor_process' : True,
82 'process_name' : 'host_watchdog.exe',
83 'heartbeat' : 'no',
84 'instances' : [
85 {
86 'name' : 'HostWatchdog_0',
87 'properties' : {
88 'org.openbmc.Watchdog' : {
89 'poll_interval': 3000,
90 }
91 }
92 }
93 ]
94 }
95
96SYSTEM_CONFIG['org.openbmc.control.Power'] = {
97 'system_state' : 'STANDBY',
98 'start_process' : True,
99 'monitor_process' : True,
100 'process_name' : 'power_control.exe',
Norman James4fa99d42015-10-08 09:21:17 -0500101 'heartbeat' : 'no',
Norman Jamesc9239a32015-10-06 16:54:31 -0500102 'instances' : [
103 {
104 'name' : 'SystemPower_0',
105 'user_label': 'Power control',
106 'properties' : {
107 'org.openbmc.Control': {
108 'poll_interval' : 3000
109 },
110 'org.openbmc.control.Power': {
111 'pgood_timeout' : 10
112 }
113 }
114 }
115 ]
116 }
117
118SYSTEM_CONFIG['org.openbmc.sensors.Temperature.Ambient'] = {
119 'system_state' : 'STANDBY',
120 'start_process' : True,
121 'monitor_process' : True,
122 'process_name' : 'sensor_ambient.exe',
Norman James4fa99d42015-10-08 09:21:17 -0500123 'heartbeat' : 'no',
Norman Jamesc9239a32015-10-06 16:54:31 -0500124 'instances' : [
125 {
126 'name' : 'FrontChassis',
127 'user_label': 'Ambient Temperature 1',
128 'properties' : {
129 'org.openbmc.SensorValue': {
130 'poll_interval' : 5000,
131 },
132 'org.openbmc.SensorThreshold' : {
133 'lower_critical': 5,
134 'lower_warning' : 10,
135 'upper_warning' : 15,
136 'upper_critical': 20
137 },
138 'org.openbmc.SensorI2c' : {
139 'dev_path' : '/dev/i2c/i2c0',
140 'address' : '0xA0'
141 }
142 }
143 },
144 ]
145 }
146SYSTEM_CONFIG['org.openbmc.buttons.Power'] = {
147 'system_state' : 'STANDBY',
148 'start_process' : True,
149 'monitor_process' : True,
150 'process_name' : 'button_power.exe',
151 'heartbeat' : 'no',
152 'instances' : [ { 'name' : 'PowerButton_0' } ]
153 }
154SYSTEM_CONFIG['org.openbmc.sensors.HostStatus'] = {
155 'system_state' : 'STANDBY',
Norman James0ee61922015-10-14 09:39:11 -0500156 'start_process' : False,
157 'monitor_process' : False,
Norman Jamesc9239a32015-10-06 16:54:31 -0500158 'process_name' : 'sensor_host_status.exe',
159 'heartbeat' : "no",
160 'instances' : [ { 'name' : 'HostStatus_0' } ]
161 }
162SYSTEM_CONFIG['org.openbmc.leds.ChassisIdentify'] = {
163 'system_state' : 'STANDBY',
164 'start_process' : True,
165 'monitor_process' : True,
166 'process_name' : 'chassis_identify.exe',
167 'heartbeat' : 'no',
168 'instances' : [ { 'name' : 'ChassisIdentify_0' } ]
169 }
170SYSTEM_CONFIG['org.openbmc.flash.Bios'] = {
171 'system_state' : 'STANDBY',
172 'start_process' : True,
173 'monitor_process' : True,
174 'process_name' : 'flash_bios.exe',
175 'heartbeat' : 'no',
176 'instances' : [ { 'name' : 'Bios_0' } ]
177 }
178
Norman Jamesf066e872015-10-07 15:29:51 -0500179SYSTEM_CONFIG['org.openbmc.manager.Download'] = {
Norman Jamesc9239a32015-10-06 16:54:31 -0500180 'system_state' : 'STANDBY',
181 'start_process' : True,
182 'monitor_process' : True,
Norman Jamesf066e872015-10-07 15:29:51 -0500183 'process_name' : 'download_manager.py',
Norman Jamesc9239a32015-10-06 16:54:31 -0500184 'heartbeat' : 'no',
Norman James25d80dd2015-10-08 07:02:25 -0500185 'instances' : [ { 'name' : SYSTEM_NAME } ]
Norman Jamesc9239a32015-10-06 16:54:31 -0500186 }
187
188SYSTEM_CONFIG['org.openbmc.control.Host'] = {
189 'system_state' : 'STANDBY',
190 'start_process' : True,
191 'monitor_process' : True,
192 'process_name' : 'control_host.exe',
193 'heartbeat' : 'no',
194 'instances' : [ { 'name' : 'Host_0' } ]
195 }
196SYSTEM_CONFIG['org.openbmc.control.Chassis'] = {
197 'system_state' : 'STANDBY',
198 'start_process' : True,
199 'monitor_process' : True,
200 'process_name' : 'chassis_control.py',
201 'heartbeat' : 'no',
202 'instances' : [ { 'name' : 'Chassis' } ]
203 }
204
205SYSTEM_CONFIG['org.openbmc.vpd'] = {
206 'system_state' : 'POWERING_ON',
207 'start_process' : True,
208 'monitor_process' : False,
209 'process_name' : 'board_vpd.exe',
210 'heartbeat' : 'no',
211 'instances' : [ { 'name' : 'MBVPD_0' } ]
212 }
213
214SYSTEM_CONFIG['org.openbmc.sensors.Occ'] = {
215 'system_state' : 'BOOTED',
216 'start_process' : True,
217 'monitor_process' : True,
218 'process_name' : 'sensor_occ.exe',
219 'heartbeat' : 'no',
220 'instances' : [
221 {
222 'name' : 'Occ_0',
223 'properties' : {
224 'org.openbmc.Occ' : {
225 'poll_interval' : 3000,
226 }
227 }
228 },
229
230 ]
231 }
232
233SYSTEM_CONFIG['org.openbmc.sensors.Fan'] = {
234 'system_state' : 'STANDBY',
235 'start_process' : True,
236 'monitor_process' : True,
237 'process_name' : 'fan.exe',
238 'heartbeat' : 'no',
239 'instances' : [ {'name' : 'Fan_0' }, {'name' : 'Fan_1'}, {'name' : 'Fan_2'} ]
240 }
241
242NON_CACHABLE_PROPERTIES = {
243 'name' : True,
244 'user_label' : True,
245 'location' : True,
246 'state' : True,
247 'cache' : True
248}
249INVENTORY_ROOT = '/org/openbmc/inventory/items'
250
251FRU_INSTANCES = {
252 '<inventory_root>/system' :
253 {
254 'fru_type' : Openbmc.FRU_TYPES['SYSTEM'],
255 'is_fru' : True,
256 },
257 '<inventory_root>/system/io_board' :
258 {
259 'fru_type' : Openbmc.FRU_TYPES['MAIN_PLANAR'],
260 'manufacturer' : 'FOXCONN',
261 'is_fru' : True,
262 'location' : 'C1',
263 },
264
265 '<inventory_root>/system/motherboard' :
266 {
267 'fru_type' : Openbmc.FRU_TYPES['MAIN_PLANAR'],
268 'manufacturer' : 'FOXCONN',
269 'is_fru' : True,
270 'location' : 'C0',
271 },
272 '<inventory_root>/system/fan0' :
273 {
274 'fru_type' : Openbmc.FRU_TYPES['FAN'],
275 'manufacturer' : 'DELTA',
276 'is_fru' : True,
277 'location' : 'F0',
278 },
279 '<inventory_root>/system/fan1' :
280 {
281 'fru_type' : Openbmc.FRU_TYPES['FAN'],
282 'manufacturer' : 'DELTA',
283 'is_fru' : True,
284 'location' : 'F1',
285 },
286 '<inventory_root>/system/io_board/bmc' :
287 {
288 'fru_type' : Openbmc.FRU_TYPES['BMC'],
289 'manufacturer' : 'ASPEED',
290 'is_fru' : False,
291 },
292 '<inventory_root>/system/motherboard/cpu0' :
293 {
294 'fru_type' : Openbmc.FRU_TYPES['CPU'],
295 'manufacturer' : 'IBM',
296 'is_fru' : True,
297 'location' : 'P0',
298 },
299 '<inventory_root>/system/motherboard/cpu0/core0' :
300 {
301 'fru_type' : Openbmc.FRU_TYPES['CORE'],
302 'is_fru' : False,
303 },
Norman James0ee61922015-10-14 09:39:11 -0500304 '<inventory_root>/system/motherboard/cpu0/core1' : {
305 'fru_type' : Openbmc.FRU_TYPES['CORE'],
306 'is_fru' : False,
307 },
308 '<inventory_root>/system/motherboard/cpu0/core2' : {
309 'fru_type' : Openbmc.FRU_TYPES['CORE'],
310 'is_fru' : False,
311 },
312 '<inventory_root>/system/motherboard/cpu0/core3' : {
313 'fru_type' : Openbmc.FRU_TYPES['CORE'],
314 'is_fru' : False,
315 },
316 '<inventory_root>/system/motherboard/cpu0/core4' : {
317 'fru_type' : Openbmc.FRU_TYPES['CORE'],
318 'is_fru' : False,
319 },
320 '<inventory_root>/system/motherboard/cpu0/core5' : {
321 'fru_type' : Openbmc.FRU_TYPES['CORE'],
322 'is_fru' : False,
323 },
324 '<inventory_root>/system/motherboard/cpu0/core6' : {
325 'fru_type' : Openbmc.FRU_TYPES['CORE'],
326 'is_fru' : False,
327 },
328 '<inventory_root>/system/motherboard/cpu0/core7' : {
329 'fru_type' : Openbmc.FRU_TYPES['CORE'],
330 'is_fru' : False,
331 },
332 '<inventory_root>/system/motherboard/cpu0/core8' : {
333 'fru_type' : Openbmc.FRU_TYPES['CORE'],
334 'is_fru' : False,
335 },
336 '<inventory_root>/system/motherboard/cpu0/core9' : {
337 'fru_type' : Openbmc.FRU_TYPES['CORE'],
338 'is_fru' : False,
339 },
340 '<inventory_root>/system/motherboard/cpu0/core10' : {
341 'fru_type' : Openbmc.FRU_TYPES['CORE'],
342 'is_fru' : False,
343 },
344 '<inventory_root>/system/motherboard/cpu0/core11' : {
Norman Jamesc9239a32015-10-06 16:54:31 -0500345 'fru_type' : Openbmc.FRU_TYPES['CORE'],
346 'is_fru' : False,
347 },
348 '<inventory_root>/system/motherboard/dimm0' :
349 {
350 'fru_type' : Openbmc.FRU_TYPES['DIMM'],
351 'is_fru' : True,
352 },
353 '<inventory_root>/system/motherboard/dimm1' :
354 {
355 'fru_type' : Openbmc.FRU_TYPES['DIMM'],
356 'is_fru' : True,
357 },
358 '<inventory_root>/system/motherboard/dimm2' :
359 {
360 'fru_type' : Openbmc.FRU_TYPES['DIMM'],
361 'is_fru' : True,
362 },
363 '<inventory_root>/system/motherboard/dimm3' :
364 {
365 'fru_type' : Openbmc.FRU_TYPES['DIMM'],
366 'is_fru' : True,
367 },
368 '<inventory_root>/system/io_board/pcie_slot0' :
369 {
370 'fru_type' : Openbmc.FRU_TYPES['PCIE_CARD'],
371 'user_label' : 'PCIe card 0',
372 'is_fru' : True,
373 },
374 '<inventory_root>/system/io_board/pcie_slot1' :
375 {
376 'fru_type' : Openbmc.FRU_TYPES['PCIE_CARD'],
377 'user_label' : 'PCIe card 1',
378 'is_fru' : True,
379 },
380}
381
382ID_LOOKUP = {
383 'FRU' : {
Norman James0ee61922015-10-14 09:39:11 -0500384 0x01 : '<inventory_root>/system/motherboard/cpu0',
385 0x03 : '<inventory_root>/system/motherboard/dimm0',
386 0x04 : '<inventory_root>/system/motherboard/dimm1',
387 0x05 : '<inventory_root>/system/motherboard/dimm2',
388 0x06 : '<inventory_root>/system/motherboard/dimm3',
Norman Jamesc9239a32015-10-06 16:54:31 -0500389 },
390 'SENSOR' : {
Norman James0ee61922015-10-14 09:39:11 -0500391 0x2f : '<inventory_root>/system/motherboard/cpu0',
392 0x22 : '<inventory_root>/system/motherboard/cpu0/core0',
393 0x23 : '<inventory_root>/system/motherboard/cpu0/core1',
394 0x24 : '<inventory_root>/system/motherboard/cpu0/core2',
395 0x25 : '<inventory_root>/system/motherboard/cpu0/core3',
396 0x26 : '<inventory_root>/system/motherboard/cpu0/core4',
397 0x27 : '<inventory_root>/system/motherboard/cpu0/core5',
398 0x28 : '<inventory_root>/system/motherboard/cpu0/core6',
399 0x29 : '<inventory_root>/system/motherboard/cpu0/core7',
400 0x2a : '<inventory_root>/system/motherboard/cpu0/core8',
401 0x2b : '<inventory_root>/system/motherboard/cpu0/core9',
402 0x2c : '<inventory_root>/system/motherboard/cpu0/core10',
403 0x2d : '<inventory_root>/system/motherboard/cpu0/core11',
404 0x1e : '<inventory_root>/system/motherboard/dimm0',
405 0x1f : '<inventory_root>/system/motherboard/dimm1',
406 0x20 : '<inventory_root>/system/motherboard/dimm2',
407 0x21 : '<inventory_root>/system/motherboard/dimm3',
408 0x09 : '/org/openbmc/sensor/virtual/BootCount',
409 0x05 : '/org/openbmc/sensor/virtual/BootProgress',
410 0x04 : '/org/openbmc/sensor/virtual/HostStatus',
411 0x08 : '/org/openbmc/sensor/virtual/OccStatus',
412 0x32 : '/org/openbmc/sensor/virtual/OperatingSystemStatus',
413 0x87 : '/org/openbmc/sensors/Power/Memory',
414 0x83 : '/org/openbmc/sensors/Power/Cpu0',
415 0x84 : '/org/openbmc/sensors/Power/Pcie',
416 0x85 : '/org/openbmc/sensors/Power/Misc',
Norman Jamesc9239a32015-10-06 16:54:31 -0500417 },
418 'GPIO_PRESENT' : {
Norman Jamesc9239a32015-10-06 16:54:31 -0500419 'SLOT0_PRESENT' : '<inventory_root>/system/io_board/pcie_slot0',
420 'SLOT1_PRESENT' : '<inventory_root>/system/io_board/pcie_slot1',
421 'SLOT2_PRESENT' : '<inventory_root>/system/io_board/pcie_slot2',
Norman Jamesc9239a32015-10-06 16:54:31 -0500422 }
423}
424
425GPIO_CONFIG = {}
Norman James25d80dd2015-10-08 07:02:25 -0500426GPIO_CONFIG['FSI_CLK'] = { 'gpio_num': 484, 'direction': 'out' }
427GPIO_CONFIG['FSI_DATA'] = { 'gpio_num': 485, 'direction': 'out' }
428GPIO_CONFIG['FSI_ENABLE'] = { 'gpio_num': 504, 'direction': 'out' }
429GPIO_CONFIG['POWER_PIN'] = { 'gpio_num': 449, 'direction': 'out' }
430GPIO_CONFIG['CRONUS_SEL'] = { 'gpio_num': 486, 'direction': 'out' }
431GPIO_CONFIG['PGOOD'] = { 'gpio_num': 503, 'direction': 'in' }
432GPIO_CONFIG['IDENTIFY'] = { 'gpio_num': 365, 'direction': 'out' }
433GPIO_CONFIG['POWER_BUTTON'] = { 'gpio_num': 448, 'direction': 'falling' }
Norman Jamesc9239a32015-10-06 16:54:31 -0500434GPIO_CONFIG['SLOT0_RISER_PRESENT'] = { 'gpio_num': 104, 'direction': 'in' }
435GPIO_CONFIG['SLOT1_RISER_PRESENT'] = { 'gpio_num': 105, 'direction': 'in' }
436GPIO_CONFIG['SLOT2_RISER_PRESENT'] = { 'gpio_num': 106, 'direction': 'in' }
437GPIO_CONFIG['SLOT0_PRESENT'] = { 'gpio_num': 107, 'direction': 'in' }
438GPIO_CONFIG['SLOT1_PRESENT'] = { 'gpio_num': 108, 'direction': 'in' }
439GPIO_CONFIG['SLOT2_PRESENT'] = { 'gpio_num': 109, 'direction': 'in' }
440GPIO_CONFIG['MEZZ0_PRESENT'] = { 'gpio_num': 112, 'direction': 'in' }
441GPIO_CONFIG['MEZZ1_PRESENT'] = { 'gpio_num': 113, 'direction': 'in' }
442
443