1#! /usr/bin/python 2 3HOME_PATH = './' 4GPIO_BASE = 320 5SYSTEM_NAME = "Palmetto" 6 7 8## System states 9## state can change to next state in 2 ways: 10## - a process emits a GotoSystemState signal with state name to goto 11## - objects specified in EXIT_STATE_DEPEND have started 12SYSTEM_STATES = [ 13 'BASE_APPS', 14 'BMC_STARTING', 15 'BMC_READY', 16 'HOST_POWERING_ON', 17 'HOST_POWERED_ON', 18 'HOST_BOOTING', 19 'HOST_BOOTED', 20 'HOST_POWERED_OFF', 21] 22 23EXIT_STATE_DEPEND = { 24 'BASE_APPS' : { 25 '/org/openbmc/sensors': 0, 26 }, 27 'BMC_STARTING' : { 28 '/org/openbmc/control/chassis0': 0, 29 '/org/openbmc/control/power0' : 0, 30 '/org/openbmc/control/led/identify' : 0, 31 '/org/openbmc/control/host0' : 0, 32 '/org/openbmc/control/flash/bios' : 0, 33 } 34} 35 36CACHED_INTERFACES = { 37 "org.openbmc.InventoryItem" : True, 38 "org.openbmc.control.Chassis" : True, 39 } 40INVENTORY_ROOT = '/org/openbmc/inventory' 41 42FRU_INSTANCES = { 43 '<inventory_root>/system' : { 'fru_type' : 'SYSTEM','is_fru' : True, }, 44 '<inventory_root>/system/chassis' : { 'fru_type' : 'SYSTEM','is_fru' : True, }, 45 '<inventory_root>/system/chassis/motherboard' : { 'fru_type' : 'MAIN_PLANAR','is_fru' : True, }, 46 47 '<inventory_root>/system/chassis/fan0' : { 'fru_type' : 'FAN','is_fru' : True, }, 48 '<inventory_root>/system/chassis/fan1' : { 'fru_type' : 'FAN','is_fru' : True, }, 49 '<inventory_root>/system/chassis/fan2' : { 'fru_type' : 'FAN','is_fru' : True, }, 50 '<inventory_root>/system/chassis/fan3' : { 'fru_type' : 'FAN','is_fru' : True, }, 51 '<inventory_root>/system/chassis/fan4' : { 'fru_type' : 'FAN','is_fru' : True, }, 52 53 '<inventory_root>/system/chassis/motherboard/bmc' : { 'fru_type' : 'BMC','is_fru' : False, 54 'manufacturer' : 'ASPEED' }, 55 '<inventory_root>/system/chassis/motherboard/cpu0' : { 'fru_type' : 'CPU', 'is_fru' : True, }, 56 '<inventory_root>/system/chassis/motherboard/cpu0/core0' : { 'fru_type' : 'CORE', 'is_fru' : False, }, 57 '<inventory_root>/system/chassis/motherboard/cpu0/core1' : { 'fru_type' : 'CORE', 'is_fru' : False, }, 58 '<inventory_root>/system/chassis/motherboard/cpu0/core2' : { 'fru_type' : 'CORE', 'is_fru' : False, }, 59 '<inventory_root>/system/chassis/motherboard/cpu0/core3' : { 'fru_type' : 'CORE', 'is_fru' : False, }, 60 '<inventory_root>/system/chassis/motherboard/cpu0/core4' : { 'fru_type' : 'CORE', 'is_fru' : False, }, 61 '<inventory_root>/system/chassis/motherboard/cpu0/core5' : { 'fru_type' : 'CORE', 'is_fru' : False, }, 62 '<inventory_root>/system/chassis/motherboard/cpu0/core6' : { 'fru_type' : 'CORE', 'is_fru' : False, }, 63 '<inventory_root>/system/chassis/motherboard/cpu0/core7' : { 'fru_type' : 'CORE', 'is_fru' : False, }, 64 '<inventory_root>/system/chassis/motherboard/cpu0/core8' : { 'fru_type' : 'CORE', 'is_fru' : False, }, 65 '<inventory_root>/system/chassis/motherboard/cpu0/core9' : { 'fru_type' : 'CORE', 'is_fru' : False, }, 66 '<inventory_root>/system/chassis/motherboard/cpu0/core10' : { 'fru_type' : 'CORE', 'is_fru' : False, }, 67 '<inventory_root>/system/chassis/motherboard/cpu0/core11' : { 'fru_type' : 'CORE', 'is_fru' : False, }, 68 69 70 '<inventory_root>/system/chassis/motherboard/membuf0' : { 'fru_type' : 'MEMORY_BUFFER', 'is_fru' : False, }, 71 72 '<inventory_root>/system/chassis/motherboard/dimm0' : { 'fru_type' : 'DIMM', 'is_fru' : True,}, 73 '<inventory_root>/system/chassis/motherboard/dimm1' : { 'fru_type' : 'DIMM', 'is_fru' : True,}, 74 '<inventory_root>/system/chassis/motherboard/dimm2' : { 'fru_type' : 'DIMM', 'is_fru' : True,}, 75 '<inventory_root>/system/chassis/motherboard/dimm3' : { 'fru_type' : 'DIMM', 'is_fru' : True,}, 76 77 '<inventory_root>/system/chassis/io_board/pcie_slot0' : { 'fru_type' : 'PCIE_CARD', 'is_fru' : True,}, 78 '<inventory_root>/system/chassis/io_board/pcie_slot1' : { 'fru_type' : 'PCIE_CARD', 'is_fru' : True,}, 79 80 '<inventory_root>/system/systemevent' : { 'fru_type' : 'SYSTEM_EVENT', 'is_fru' : False, }, 81 '<inventory_root>/system/chassis/motherboard/refclock' : { 'fru_type' : 'MAIN_PLANAR', 'is_fru' : False, }, 82 '<inventory_root>/system/chassis/motherboard/pcieclock': { 'fru_type' : 'MAIN_PLANAR', 'is_fru' : False, }, 83 '<inventory_root>/system/chassis/motherboard/todclock' : { 'fru_type' : 'MAIN_PLANAR', 'is_fru' : False, }, 84 '<inventory_root>/system/chassis/motherboard/apss' : { 'fru_type' : 'MAIN_PLANAR', 'is_fru' : False, }, 85} 86 87ID_LOOKUP = { 88 'FRU' : { 89 0x0d : '<inventory_root>/system/chassis', 90 0x34 : '<inventory_root>/system/chassis/motherboard', 91 0x01 : '<inventory_root>/system/chassis/motherboard/cpu0', 92 0x02 : '<inventory_root>/system/chassis/motherboard/membuf0', 93 0x03 : '<inventory_root>/system/chassis/motherboard/dimm0', 94 0x04 : '<inventory_root>/system/chassis/motherboard/dimm1', 95 0x05 : '<inventory_root>/system/chassis/motherboard/dimm2', 96 0x06 : '<inventory_root>/system/chassis/motherboard/dimm3', 97 0x35 : '<inventory_root>/system', 98 }, 99 'FRU_STR' : { 100 'PRODUCT_15' : '<inventory_root>/system', 101 'CHASSIS_2' : '<inventory_root>/system/chassis', 102 'BOARD_1' : '<inventory_root>/system/chassis/motherboard/cpu0', 103 'BOARD_2' : '<inventory_root>/system/chassis/motherboard/membuf0', 104 'BOARD_14' : '<inventory_root>/system/chassis/motherboard', 105 'PRODUCT_3' : '<inventory_root>/system/chassis/motherboard/dimm0', 106 'PRODUCT_4' : '<inventory_root>/system/chassis/motherboard/dimm1', 107 'PRODUCT_5' : '<inventory_root>/system/chassis/motherboard/dimm2', 108 'PRODUCT_6' : '<inventory_root>/system/chassis/motherboard/dimm3', 109 }, 110 'SENSOR' : { 111 0x34 : '<inventory_root>/system/chassis/motherboard', 112 0x35 : '<inventory_root>/system/systemevent', 113 0x37 : '<inventory_root>/system/chassis/motherboard/refclock', 114 0x38 : '<inventory_root>/system/chassis/motherboard/pcieclock', 115 0x39 : '<inventory_root>/system/chassis/motherboard/todclock', 116 0x3A : '<inventory_root>/system/chassis/motherboard/apss', 117 0x2f : '<inventory_root>/system/chassis/motherboard/cpu0', 118 0x22 : '<inventory_root>/system/chassis/motherboard/cpu0/core0', 119 0x23 : '<inventory_root>/system/chassis/motherboard/cpu0/core1', 120 0x24 : '<inventory_root>/system/chassis/motherboard/cpu0/core2', 121 0x25 : '<inventory_root>/system/chassis/motherboard/cpu0/core3', 122 0x26 : '<inventory_root>/system/chassis/motherboard/cpu0/core4', 123 0x27 : '<inventory_root>/system/chassis/motherboard/cpu0/core5', 124 0x28 : '<inventory_root>/system/chassis/motherboard/cpu0/core6', 125 0x29 : '<inventory_root>/system/chassis/motherboard/cpu0/core7', 126 0x2a : '<inventory_root>/system/chassis/motherboard/cpu0/core8', 127 0x2b : '<inventory_root>/system/chassis/motherboard/cpu0/core9', 128 0x2c : '<inventory_root>/system/chassis/motherboard/cpu0/core10', 129 0x2d : '<inventory_root>/system/chassis/motherboard/cpu0/core11', 130 0x2e : '<inventory_root>/system/chassis/motherboard/membuf0', 131 0x1e : '<inventory_root>/system/chassis/motherboard/dimm0', 132 0x1f : '<inventory_root>/system/chassis/motherboard/dimm1', 133 0x20 : '<inventory_root>/system/chassis/motherboard/dimm2', 134 0x21 : '<inventory_root>/system/chassis/motherboard/dimm3', 135 0x09 : '/org/openbmc/sensors/host/BootCount', 136 0x05 : '/org/openbmc/sensors/host/BootProgress', 137 0x08 : '/org/openbmc/sensors/host/cpu0/OccStatus', 138 0x32 : '/org/openbmc/sensors/host/OperatingSystemStatus', 139 0x33 : '/org/openbmc/sensors/host/PowerCap', 140 }, 141 'GPIO_PRESENT' : { 142 'SLOT0_PRESENT' : '<inventory_root>/system/chassis/io_board/pcie_slot0', 143 'SLOT1_PRESENT' : '<inventory_root>/system/chassis/io_board/pcie_slot1', 144 } 145} 146 147GPIO_CONFIG = {} 148GPIO_CONFIG['FSI_CLK'] = { 'gpio_pin': 'A4', 'direction': 'out' } 149GPIO_CONFIG['FSI_DATA'] = { 'gpio_pin': 'A5', 'direction': 'out' } 150GPIO_CONFIG['FSI_ENABLE'] = { 'gpio_pin': 'D0', 'direction': 'out' } 151GPIO_CONFIG['POWER_PIN'] = { 'gpio_pin': 'E1', 'direction': 'out' } 152GPIO_CONFIG['CRONUS_SEL'] = { 'gpio_pin': 'A6', 'direction': 'out' } 153GPIO_CONFIG['PGOOD'] = { 'gpio_pin': 'C7', 'direction': 'in' } 154GPIO_CONFIG['BMC_THROTTLE'] = { 'gpio_pin': 'J3', 'direction': 'out' } 155GPIO_CONFIG['IDBTN'] = { 'gpio_pin': 'Q7', 'direction': 'out' } 156GPIO_CONFIG['POWER_BUTTON'] = { 'gpio_pin': 'E0', 'direction': 'both' } 157GPIO_CONFIG['PCIE_RESET'] = { 'gpio_pin': 'B5', 'direction': 'out' } 158GPIO_CONFIG['USB_RESET'] = { 'gpio_pin': 'B6', 'direction': 'out' } 159GPIO_CONFIG['SLOT0_RISER_PRESENT'] = { 'gpio_pin': 'N0', 'direction': 'in' } 160GPIO_CONFIG['SLOT1_RISER_PRESENT'] = { 'gpio_pin': 'N1', 'direction': 'in' } 161GPIO_CONFIG['SLOT2_RISER_PRESENT'] = { 'gpio_pin': 'N2', 'direction': 'in' } 162GPIO_CONFIG['SLOT0_PRESENT'] = { 'gpio_pin': 'N3', 'direction': 'in' } 163GPIO_CONFIG['SLOT1_PRESENT'] = { 'gpio_pin': 'N4', 'direction': 'in' } 164GPIO_CONFIG['SLOT2_PRESENT'] = { 'gpio_pin': 'N5', 'direction': 'in' } 165GPIO_CONFIG['MEZZ0_PRESENT'] = { 'gpio_pin': 'O0', 'direction': 'in' } 166GPIO_CONFIG['MEZZ1_PRESENT'] = { 'gpio_pin': 'O1', 'direction': 'in' } 167GPIO_CONFIG['CHECKSTOP'] = { 'gpio_pin': 'P5', 'direction': 'falling' } 168 169def convertGpio(name): 170 name = name.upper() 171 c = name[0:1] 172 offset = int(name[1:]) 173 a = ord(c)-65 174 base = a*8+GPIO_BASE 175 return base+offset 176 177HWMON_CONFIG = { 178 '2-004c' : { 179 'names' : { 180 'temp1_input' : { 'object_path' : 'temperature/ambient','poll_interval' : 5000,'scale' : -3,'units' : 'C' }, 181 } 182 }, 183 '3-0050' : { 184 'names' : { 185 'caps_curr_powercap' : { 'object_path' : 'powercap/curr_cap','poll_interval' : 10000,'scale' : 1,'units' : 'W' }, 186 'caps_curr_powerreading' : { 'object_path' : 'powercap/system_power','poll_interval' : 10000,'scale' : 1,'units' : 'W' }, 187 'caps_max_powercap' : { 'object_path' : 'powercap/max_cap','poll_interval' : 10000,'scale' : 1,'units' : 'W' }, 188 'caps_min_powercap' : { 'object_path' : 'powercap/min_cap','poll_interval' : 10000,'scale' : 1,'units' : 'W' }, 189 'caps_norm_powercap' : { 'object_path' : 'powercap/n_cap','poll_interval' : 10000,'scale' : 1,'units' : 'W' }, 190 'caps_user_powerlimit' : { 'object_path' : 'powercap/user_cap','poll_interval' : 10000,'scale' : 1,'units' : 'W' }, 191 } 192 } 193} 194 195# Miscellaneous non-poll sensor with system specific properties. 196# The sensor id is the same as those defined in ID_LOOKUP['SENSOR']. 197MISC_SENSORS = { 198 0x09 : { 'class' : 'BootCountSensor' }, 199 0x05 : { 'class' : 'BootProgressSensor' }, 200 0x08 : { 'class' : 'OccStatusSensor', 201 'os_path' : '/sys/class/i2c-adapter/i2c-3/3-0050/online' }, 202 0x32 : { 'class' : 'OperatingSystemStatusSensor' }, 203 0x33 : { 'class' : 'PowerCap', 204 'os_path' : '/sys/class/hwmon/hwmon1/user_powercap' }, 205} 206