Norman James | c9239a3 | 2015-10-06 16:54:31 -0500 | [diff] [blame] | 1 | #! /usr/bin/python |
| 2 | |
| 3 | import dbus |
| 4 | import Openbmc |
| 5 | |
| 6 | HOME_PATH = './' |
| 7 | BIN_PATH = HOME_PATH+'bin/' |
| 8 | CACHE_PATH = HOME_PATH+'cache/' |
| 9 | FRU_PATH = CACHE_PATH+'frus/' |
| 10 | |
| 11 | SYSTEM_STATES = [ |
| 12 | 'INIT', |
| 13 | 'STANDBY', |
| 14 | 'POWERING_ON', |
| 15 | 'POWERED_ON', |
| 16 | 'BOOTING', |
| 17 | 'HOST_UP', |
| 18 | 'SHUTTING_DOWN', |
| 19 | 'POWERING_DOWN' |
| 20 | ] |
| 21 | |
| 22 | ENTER_STATE_CALLBACK = { |
| 23 | 'POWERED_ON' : { |
| 24 | 'bus_name' : 'org.openbmc.control.Host', |
| 25 | 'obj_name' : '/org/openbmc/control/Host_0', |
| 26 | 'interface_name' : 'org.openbmc.control.Host', |
| 27 | 'method_name' : 'boot' |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | SYSTEM_CONFIG = {} |
| 32 | |
| 33 | SYSTEM_CONFIG['org.openbmc.control.Bmc'] = { |
| 34 | 'system_state' : 'INIT', |
| 35 | 'start_process' : True, |
| 36 | 'monitor_process' : True, |
| 37 | 'process_name' : 'control_bmc.exe', |
| 38 | 'heartbeat' : 'no', |
| 39 | 'instances' : [ { 'name' : 'Bmc_0' } ] |
| 40 | } |
| 41 | |
| 42 | SYSTEM_CONFIG['org.openbmc.managers.Inventory'] = { |
| 43 | 'system_state' : 'STANDBY', |
| 44 | 'start_process' : True, |
| 45 | 'monitor_process' : True, |
| 46 | 'process_name' : 'inventory_items.py', |
| 47 | 'heartbeat' : 'no', |
| 48 | 'instances' : [ { 'name' : 'Palmetto' } ] |
| 49 | } |
| 50 | SYSTEM_CONFIG['org.openbmc.control.PciePresent'] = { |
| 51 | 'system_state' : 'POWERING_ON', |
| 52 | 'start_process' : True, |
| 53 | 'monitor_process' : False, |
| 54 | 'process_name' : 'pcie_slot_present.exe', |
| 55 | 'heartbeat' : 'no', |
| 56 | 'instances' : [ { 'name' : 'Slots_0' } ] |
| 57 | } |
| 58 | |
| 59 | |
| 60 | SYSTEM_CONFIG['org.openbmc.managers.Sensors'] = { |
| 61 | 'system_state' : 'STANDBY', |
| 62 | 'start_process' : True, |
| 63 | 'monitor_process' : True, |
| 64 | 'process_name' : 'sensor_manager.py', |
| 65 | 'heartbeat' : 'no', |
| 66 | 'instances' : [ { 'name' : 'Palmetto' } ] |
| 67 | } |
| 68 | |
| 69 | SYSTEM_CONFIG['org.openbmc.watchdog.Host'] = { |
| 70 | 'system_state' : 'STANDBY', |
| 71 | 'start_process' : True, |
| 72 | 'monitor_process' : True, |
| 73 | 'process_name' : 'host_watchdog.exe', |
| 74 | 'heartbeat' : 'no', |
| 75 | 'instances' : [ |
| 76 | { |
| 77 | 'name' : 'HostWatchdog_0', |
| 78 | 'properties' : { |
| 79 | 'org.openbmc.Watchdog' : { |
| 80 | 'poll_interval': 3000, |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | ] |
| 85 | } |
| 86 | |
| 87 | SYSTEM_CONFIG['org.openbmc.control.Power'] = { |
| 88 | 'system_state' : 'STANDBY', |
| 89 | 'start_process' : True, |
| 90 | 'monitor_process' : True, |
| 91 | 'process_name' : 'power_control.exe', |
| 92 | 'heartbeat' : 'yes', |
| 93 | 'instances' : [ |
| 94 | { |
| 95 | 'name' : 'SystemPower_0', |
| 96 | 'user_label': 'Power control', |
| 97 | 'properties' : { |
| 98 | 'org.openbmc.Control': { |
| 99 | 'poll_interval' : 3000 |
| 100 | }, |
| 101 | 'org.openbmc.control.Power': { |
| 102 | 'pgood_timeout' : 10 |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | ] |
| 107 | } |
| 108 | |
| 109 | SYSTEM_CONFIG['org.openbmc.sensors.Temperature.Ambient'] = { |
| 110 | 'system_state' : 'STANDBY', |
| 111 | 'start_process' : True, |
| 112 | 'monitor_process' : True, |
| 113 | 'process_name' : 'sensor_ambient.exe', |
| 114 | 'heartbeat' : 'yes', |
| 115 | 'instances' : [ |
| 116 | { |
| 117 | 'name' : 'FrontChassis', |
| 118 | 'user_label': 'Ambient Temperature 1', |
| 119 | 'properties' : { |
| 120 | 'org.openbmc.SensorValue': { |
| 121 | 'poll_interval' : 5000, |
| 122 | }, |
| 123 | 'org.openbmc.SensorThreshold' : { |
| 124 | 'lower_critical': 5, |
| 125 | 'lower_warning' : 10, |
| 126 | 'upper_warning' : 15, |
| 127 | 'upper_critical': 20 |
| 128 | }, |
| 129 | 'org.openbmc.SensorI2c' : { |
| 130 | 'dev_path' : '/dev/i2c/i2c0', |
| 131 | 'address' : '0xA0' |
| 132 | } |
| 133 | } |
| 134 | }, |
| 135 | ] |
| 136 | } |
| 137 | SYSTEM_CONFIG['org.openbmc.buttons.Power'] = { |
| 138 | 'system_state' : 'STANDBY', |
| 139 | 'start_process' : True, |
| 140 | 'monitor_process' : True, |
| 141 | 'process_name' : 'button_power.exe', |
| 142 | 'heartbeat' : 'no', |
| 143 | 'instances' : [ { 'name' : 'PowerButton_0' } ] |
| 144 | } |
| 145 | SYSTEM_CONFIG['org.openbmc.sensors.HostStatus'] = { |
| 146 | 'system_state' : 'STANDBY', |
| 147 | 'start_process' : True, |
| 148 | 'monitor_process' : True, |
| 149 | 'process_name' : 'sensor_host_status.exe', |
| 150 | 'heartbeat' : "no", |
| 151 | 'instances' : [ { 'name' : 'HostStatus_0' } ] |
| 152 | } |
| 153 | SYSTEM_CONFIG['org.openbmc.leds.ChassisIdentify'] = { |
| 154 | 'system_state' : 'STANDBY', |
| 155 | 'start_process' : True, |
| 156 | 'monitor_process' : True, |
| 157 | 'process_name' : 'chassis_identify.exe', |
| 158 | 'heartbeat' : 'no', |
| 159 | 'instances' : [ { 'name' : 'ChassisIdentify_0' } ] |
| 160 | } |
| 161 | SYSTEM_CONFIG['org.openbmc.flash.Bios'] = { |
| 162 | 'system_state' : 'STANDBY', |
| 163 | 'start_process' : True, |
| 164 | 'monitor_process' : True, |
| 165 | 'process_name' : 'flash_bios.exe', |
| 166 | 'heartbeat' : 'no', |
| 167 | 'instances' : [ { 'name' : 'Bios_0' } ] |
| 168 | } |
| 169 | |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame^] | 170 | SYSTEM_CONFIG['org.openbmc.manager.Download'] = { |
Norman James | c9239a3 | 2015-10-06 16:54:31 -0500 | [diff] [blame] | 171 | 'system_state' : 'STANDBY', |
| 172 | 'start_process' : True, |
| 173 | 'monitor_process' : True, |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame^] | 174 | 'process_name' : 'download_manager.py', |
Norman James | c9239a3 | 2015-10-06 16:54:31 -0500 | [diff] [blame] | 175 | 'heartbeat' : 'no', |
Norman James | f066e87 | 2015-10-07 15:29:51 -0500 | [diff] [blame^] | 176 | 'instances' : [ { 'name' : 'DownloadManager_0' } ] |
Norman James | c9239a3 | 2015-10-06 16:54:31 -0500 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | SYSTEM_CONFIG['org.openbmc.control.Host'] = { |
| 180 | 'system_state' : 'STANDBY', |
| 181 | 'start_process' : True, |
| 182 | 'monitor_process' : True, |
| 183 | 'process_name' : 'control_host.exe', |
| 184 | 'heartbeat' : 'no', |
| 185 | 'instances' : [ { 'name' : 'Host_0' } ] |
| 186 | } |
| 187 | SYSTEM_CONFIG['org.openbmc.control.Chassis'] = { |
| 188 | 'system_state' : 'STANDBY', |
| 189 | 'start_process' : True, |
| 190 | 'monitor_process' : True, |
| 191 | 'process_name' : 'chassis_control.py', |
| 192 | 'heartbeat' : 'no', |
| 193 | 'instances' : [ { 'name' : 'Chassis' } ] |
| 194 | } |
| 195 | |
| 196 | SYSTEM_CONFIG['org.openbmc.vpd'] = { |
| 197 | 'system_state' : 'POWERING_ON', |
| 198 | 'start_process' : True, |
| 199 | 'monitor_process' : False, |
| 200 | 'process_name' : 'board_vpd.exe', |
| 201 | 'heartbeat' : 'no', |
| 202 | 'instances' : [ { 'name' : 'MBVPD_0' } ] |
| 203 | } |
| 204 | |
| 205 | SYSTEM_CONFIG['org.openbmc.sensors.Occ'] = { |
| 206 | 'system_state' : 'BOOTED', |
| 207 | 'start_process' : True, |
| 208 | 'monitor_process' : True, |
| 209 | 'process_name' : 'sensor_occ.exe', |
| 210 | 'heartbeat' : 'no', |
| 211 | 'instances' : [ |
| 212 | { |
| 213 | 'name' : 'Occ_0', |
| 214 | 'properties' : { |
| 215 | 'org.openbmc.Occ' : { |
| 216 | 'poll_interval' : 3000, |
| 217 | } |
| 218 | } |
| 219 | }, |
| 220 | |
| 221 | ] |
| 222 | } |
| 223 | |
| 224 | SYSTEM_CONFIG['org.openbmc.sensors.Fan'] = { |
| 225 | 'system_state' : 'STANDBY', |
| 226 | 'start_process' : True, |
| 227 | 'monitor_process' : True, |
| 228 | 'process_name' : 'fan.exe', |
| 229 | 'heartbeat' : 'no', |
| 230 | 'instances' : [ {'name' : 'Fan_0' }, {'name' : 'Fan_1'}, {'name' : 'Fan_2'} ] |
| 231 | } |
| 232 | |
| 233 | NON_CACHABLE_PROPERTIES = { |
| 234 | 'name' : True, |
| 235 | 'user_label' : True, |
| 236 | 'location' : True, |
| 237 | 'state' : True, |
| 238 | 'cache' : True |
| 239 | } |
| 240 | INVENTORY_ROOT = '/org/openbmc/inventory/items' |
| 241 | |
| 242 | FRU_INSTANCES = { |
| 243 | '<inventory_root>/system' : |
| 244 | { |
| 245 | 'fru_type' : Openbmc.FRU_TYPES['SYSTEM'], |
| 246 | 'is_fru' : True, |
| 247 | }, |
| 248 | '<inventory_root>/system/io_board' : |
| 249 | { |
| 250 | 'fru_type' : Openbmc.FRU_TYPES['MAIN_PLANAR'], |
| 251 | 'manufacturer' : 'FOXCONN', |
| 252 | 'is_fru' : True, |
| 253 | 'location' : 'C1', |
| 254 | }, |
| 255 | |
| 256 | '<inventory_root>/system/motherboard' : |
| 257 | { |
| 258 | 'fru_type' : Openbmc.FRU_TYPES['MAIN_PLANAR'], |
| 259 | 'manufacturer' : 'FOXCONN', |
| 260 | 'is_fru' : True, |
| 261 | 'location' : 'C0', |
| 262 | }, |
| 263 | '<inventory_root>/system/fan0' : |
| 264 | { |
| 265 | 'fru_type' : Openbmc.FRU_TYPES['FAN'], |
| 266 | 'manufacturer' : 'DELTA', |
| 267 | 'is_fru' : True, |
| 268 | 'location' : 'F0', |
| 269 | }, |
| 270 | '<inventory_root>/system/fan1' : |
| 271 | { |
| 272 | 'fru_type' : Openbmc.FRU_TYPES['FAN'], |
| 273 | 'manufacturer' : 'DELTA', |
| 274 | 'is_fru' : True, |
| 275 | 'location' : 'F1', |
| 276 | }, |
| 277 | '<inventory_root>/system/io_board/bmc' : |
| 278 | { |
| 279 | 'fru_type' : Openbmc.FRU_TYPES['BMC'], |
| 280 | 'manufacturer' : 'ASPEED', |
| 281 | 'is_fru' : False, |
| 282 | }, |
| 283 | '<inventory_root>/system/motherboard/cpu0' : |
| 284 | { |
| 285 | 'fru_type' : Openbmc.FRU_TYPES['CPU'], |
| 286 | 'manufacturer' : 'IBM', |
| 287 | 'is_fru' : True, |
| 288 | 'location' : 'P0', |
| 289 | }, |
| 290 | '<inventory_root>/system/motherboard/cpu0/core0' : |
| 291 | { |
| 292 | 'fru_type' : Openbmc.FRU_TYPES['CORE'], |
| 293 | 'is_fru' : False, |
| 294 | }, |
| 295 | '<inventory_root>/system/motherboard/cpu0/core1' : |
| 296 | { |
| 297 | 'fru_type' : Openbmc.FRU_TYPES['CORE'], |
| 298 | 'is_fru' : False, |
| 299 | }, |
| 300 | '<inventory_root>/system/motherboard/dimm0' : |
| 301 | { |
| 302 | 'fru_type' : Openbmc.FRU_TYPES['DIMM'], |
| 303 | 'is_fru' : True, |
| 304 | }, |
| 305 | '<inventory_root>/system/motherboard/dimm1' : |
| 306 | { |
| 307 | 'fru_type' : Openbmc.FRU_TYPES['DIMM'], |
| 308 | 'is_fru' : True, |
| 309 | }, |
| 310 | '<inventory_root>/system/motherboard/dimm2' : |
| 311 | { |
| 312 | 'fru_type' : Openbmc.FRU_TYPES['DIMM'], |
| 313 | 'is_fru' : True, |
| 314 | }, |
| 315 | '<inventory_root>/system/motherboard/dimm3' : |
| 316 | { |
| 317 | 'fru_type' : Openbmc.FRU_TYPES['DIMM'], |
| 318 | 'is_fru' : True, |
| 319 | }, |
| 320 | '<inventory_root>/system/io_board/pcie_slot0' : |
| 321 | { |
| 322 | 'fru_type' : Openbmc.FRU_TYPES['PCIE_CARD'], |
| 323 | 'user_label' : 'PCIe card 0', |
| 324 | 'is_fru' : True, |
| 325 | }, |
| 326 | '<inventory_root>/system/io_board/pcie_slot1' : |
| 327 | { |
| 328 | 'fru_type' : Openbmc.FRU_TYPES['PCIE_CARD'], |
| 329 | 'user_label' : 'PCIe card 1', |
| 330 | 'is_fru' : True, |
| 331 | }, |
| 332 | } |
| 333 | |
| 334 | ID_LOOKUP = { |
| 335 | 'FRU' : { |
| 336 | '14' : '<inventory_root>/system/motherboard/dimm0', |
| 337 | }, |
| 338 | 'SENSOR' : { |
| 339 | '21' : '<inventory_root>/system/motherboard/dimm0', |
| 340 | '14' : '/org/openbmc/sensors/HostStatus_0', |
| 341 | }, |
| 342 | 'GPIO_PRESENT' : { |
| 343 | 'SLOT0_RISER_PRESENT' : '<inventory_root>/system/io_board/pcie_left_slot_riser', |
| 344 | 'SLOT1_RISER_PRESENT' : '<inventory_root>/system/io_board/pcie_right_slot_riser', |
| 345 | 'SLOT2_RISER_PRESENT' : '<inventory_root>/system/io_board/pcie_x16_slot_riser', |
| 346 | 'SLOT0_PRESENT' : '<inventory_root>/system/io_board/pcie_slot0', |
| 347 | 'SLOT1_PRESENT' : '<inventory_root>/system/io_board/pcie_slot1', |
| 348 | 'SLOT2_PRESENT' : '<inventory_root>/system/io_board/pcie_slot2', |
| 349 | 'MEZZ0_PRESENT' : '<inventory_root>/system/io_board/pcie_mezz0', |
| 350 | 'MEZZ1_PRESENT' : '<inventory_root>/system/io_board/pcie_mezz1', |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | GPIO_CONFIG = {} |
| 355 | GPIO_CONFIG['FSI_CLK'] = { 'gpio_num': 4, 'direction': 'out' } |
| 356 | GPIO_CONFIG['FSI_DATA'] = { 'gpio_num': 5, 'direction': 'out' } |
| 357 | GPIO_CONFIG['FSI_ENABLE'] = { 'gpio_num': 24, 'direction': 'out' } |
| 358 | GPIO_CONFIG['POWER_PIN'] = { 'gpio_num': 33, 'direction': 'out' } |
| 359 | GPIO_CONFIG['CRONUS_SEL'] = { 'gpio_num': 6, 'direction': 'out' } |
| 360 | GPIO_CONFIG['PGOOD'] = { 'gpio_num': 23, 'direction': 'in' } |
| 361 | GPIO_CONFIG['IDENTIFY'] = { 'gpio_num': 34, 'direction': 'out' } |
| 362 | GPIO_CONFIG['POWER_BUTTON'] = { 'gpio_num': 32, 'direction': 'falling' } |
| 363 | GPIO_CONFIG['SLOT0_RISER_PRESENT'] = { 'gpio_num': 104, 'direction': 'in' } |
| 364 | GPIO_CONFIG['SLOT1_RISER_PRESENT'] = { 'gpio_num': 105, 'direction': 'in' } |
| 365 | GPIO_CONFIG['SLOT2_RISER_PRESENT'] = { 'gpio_num': 106, 'direction': 'in' } |
| 366 | GPIO_CONFIG['SLOT0_PRESENT'] = { 'gpio_num': 107, 'direction': 'in' } |
| 367 | GPIO_CONFIG['SLOT1_PRESENT'] = { 'gpio_num': 108, 'direction': 'in' } |
| 368 | GPIO_CONFIG['SLOT2_PRESENT'] = { 'gpio_num': 109, 'direction': 'in' } |
| 369 | GPIO_CONFIG['MEZZ0_PRESENT'] = { 'gpio_num': 112, 'direction': 'in' } |
| 370 | GPIO_CONFIG['MEZZ1_PRESENT'] = { 'gpio_num': 113, 'direction': 'in' } |
| 371 | |
| 372 | |