blob: 0c8ca4629553fd457aaaee6c51ee0132f771edfd [file] [log] [blame]
Norman Jamesc9239a32015-10-06 16:54:31 -05001#! /usr/bin/python
2
Norman Jamesc9239a32015-10-06 16:54:31 -05003HOME_PATH = './'
Norman Jamesa9966b32015-10-28 06:55:58 -05004GPIO_BASE = 320
Norman James969227c2015-10-08 15:10:47 -05005SYSTEM_NAME = "Palmetto"
Norman Jamesc9239a32015-10-06 16:54:31 -05006
Norman Jamesa3e47c42015-10-18 14:43:10 -05007
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
Norman Jamesc9239a32015-10-06 16:54:31 -050012SYSTEM_STATES = [
Norman Jamesb714eb22015-10-26 17:12:57 -050013 'BASE_APPS',
Norman Jamesa3e47c42015-10-18 14:43:10 -050014 'BMC_STARTING',
15 'BMC_READY',
16 'HOST_POWERING_ON',
17 'HOST_POWERED_ON',
18 'HOST_BOOTING',
Norman James2656f332015-10-26 06:42:41 -050019 'HOST_BOOTED',
Adriana Kobylakc5a16052016-03-01 14:29:47 -060020 'HOST_POWERED_OFF',
Norman Jamesc9239a32015-10-06 16:54:31 -050021]
22
Norman Jamesa3e47c42015-10-18 14:43:10 -050023EXIT_STATE_DEPEND = {
Norman Jamesb714eb22015-10-26 17:12:57 -050024 'BASE_APPS' : {
Norman James76abea32015-10-29 06:17:54 -050025 '/org/openbmc/sensors': 0,
Norman Jamesb714eb22015-10-26 17:12:57 -050026 },
Norman Jamesa3e47c42015-10-18 14:43:10 -050027 'BMC_STARTING' : {
28 '/org/openbmc/control/chassis0': 0,
29 '/org/openbmc/control/power0' : 0,
Adriana Kobylak9c751042016-02-09 13:44:32 -060030 '/org/openbmc/control/led/identify' : 0,
Norman Jamesb38ea5a2015-10-28 12:44:56 -050031 '/org/openbmc/control/host0' : 0,
Norman James2943cc62015-10-28 18:59:53 -050032 '/org/openbmc/control/flash/bios' : 0,
Norman Jamesa3e47c42015-10-18 14:43:10 -050033 }
34}
35
Norman James2656f332015-10-26 06:42:41 -050036CACHED_INTERFACES = {
37 "org.openbmc.InventoryItem" : True,
38 "org.openbmc.control.Chassis" : True,
39 }
Norman Jamesa3e47c42015-10-18 14:43:10 -050040INVENTORY_ROOT = '/org/openbmc/inventory'
Norman Jamesc9239a32015-10-06 16:54:31 -050041
42FRU_INSTANCES = {
Norman Jamesb38ea5a2015-10-28 12:44:56 -050043 '<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, },
Norman Jamesc9239a32015-10-06 16:54:31 -050046
Norman Jamesb38ea5a2015-10-28 12:44:56 -050047 '<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, },
Norman Jamesa42446a2015-10-19 11:12:45 -050052
Norman Jamesb38ea5a2015-10-28 12:44:56 -050053 '<inventory_root>/system/chassis/motherboard/bmc' : { 'fru_type' : 'BMC','is_fru' : False,
Norman Jamesa42446a2015-10-19 11:12:45 -050054 'manufacturer' : 'ASPEED' },
Norman Jamesb38ea5a2015-10-28 12:44:56 -050055 '<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, },
Norman Jamesa42446a2015-10-19 11:12:45 -050068
Norman Jamesa42446a2015-10-19 11:12:45 -050069
Chris Austen46136de2016-05-12 00:27:37 -050070 '<inventory_root>/system/chassis/motherboard/membuf0' : { 'fru_type' : 'MEMORY_BUFFER', 'is_fru' : False, },
Norman Jamesa42446a2015-10-19 11:12:45 -050071
Norman Jamesb38ea5a2015-10-28 12:44:56 -050072 '<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,},
Norman Jamesa42446a2015-10-19 11:12:45 -050076
Norman Jamesb38ea5a2015-10-28 12:44:56 -050077 '<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,},
Norman Jamesa42446a2015-10-19 11:12:45 -050079
Chris Austen4c9ea5d2015-12-09 23:26:08 -060080 '<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, },
Norman Jamesc9239a32015-10-06 16:54:31 -050085}
86
87ID_LOOKUP = {
88 'FRU' : {
Norman Jamesa42446a2015-10-19 11:12:45 -050089 0x0d : '<inventory_root>/system/chassis',
90 0x34 : '<inventory_root>/system/chassis/motherboard',
91 0x01 : '<inventory_root>/system/chassis/motherboard/cpu0',
Chris Austen46136de2016-05-12 00:27:37 -050092 0x02 : '<inventory_root>/system/chassis/motherboard/membuf0',
Norman Jamesa42446a2015-10-19 11:12:45 -050093 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',
Norman James2656f332015-10-26 06:42:41 -050097 0x35 : '<inventory_root>/system',
Norman Jamesc9239a32015-10-06 16:54:31 -050098 },
Norman Jamesa42446a2015-10-19 11:12:45 -050099 'FRU_STR' : {
Norman Jamesfe635e82015-10-20 07:47:22 -0500100 'PRODUCT_15' : '<inventory_root>/system',
101 'CHASSIS_2' : '<inventory_root>/system/chassis',
102 'BOARD_1' : '<inventory_root>/system/chassis/motherboard/cpu0',
Chris Austen46136de2016-05-12 00:27:37 -0500103 'BOARD_2' : '<inventory_root>/system/chassis/motherboard/membuf0',
Chris Austen4c9ea5d2015-12-09 23:26:08 -0600104 'BOARD_14' : '<inventory_root>/system/chassis/motherboard',
Norman Jamesfe635e82015-10-20 07:47:22 -0500105 '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',
Norman Jamesa42446a2015-10-19 11:12:45 -0500109 },
Norman Jamesc9239a32015-10-06 16:54:31 -0500110 'SENSOR' : {
Chris Austen4c9ea5d2015-12-09 23:26:08 -0600111 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',
Norman Jamesa42446a2015-10-19 11:12:45 -0500117 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',
Chris Austen46136de2016-05-12 00:27:37 -0500130 0x2e : '<inventory_root>/system/chassis/motherboard/membuf0',
Norman Jamesa42446a2015-10-19 11:12:45 -0500131 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',
Chris Austen4c9ea5d2015-12-09 23:26:08 -0600135 0x09 : '/org/openbmc/sensors/host/BootCount',
136 0x05 : '/org/openbmc/sensors/host/BootProgress',
Norman James86f2a072016-01-30 22:48:54 -0600137 0x08 : '/org/openbmc/sensors/host/cpu0/OccStatus',
Chris Austen4c9ea5d2015-12-09 23:26:08 -0600138 0x32 : '/org/openbmc/sensors/host/OperatingSystemStatus',
139 0x33 : '/org/openbmc/sensors/host/PowerCap',
Norman Jamesc9239a32015-10-06 16:54:31 -0500140 },
141 'GPIO_PRESENT' : {
Chris Austen4c9ea5d2015-12-09 23:26:08 -0600142 'SLOT0_PRESENT' : '<inventory_root>/system/chassis/io_board/pcie_slot0',
143 'SLOT1_PRESENT' : '<inventory_root>/system/chassis/io_board/pcie_slot1',
Norman Jamesc9239a32015-10-06 16:54:31 -0500144 }
145}
146
147GPIO_CONFIG = {}
Norman Jamesb38ea5a2015-10-28 12:44:56 -0500148GPIO_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' }
Norman James7b8811e2016-01-12 12:51:29 -0600154GPIO_CONFIG['BMC_THROTTLE'] = { 'gpio_pin': 'J3', 'direction': 'out' }
Chris Austencd6a5602016-05-24 13:33:51 -0500155GPIO_CONFIG['IDBTN'] = { 'gpio_pin': 'Q7', 'direction': 'out' }
Norman James2943cc62015-10-28 18:59:53 -0500156GPIO_CONFIG['POWER_BUTTON'] = { 'gpio_pin': 'E0', 'direction': 'both' }
Norman Jamese62f4452015-10-31 17:33:10 -0500157GPIO_CONFIG['PCIE_RESET'] = { 'gpio_pin': 'B5', 'direction': 'out' }
158GPIO_CONFIG['USB_RESET'] = { 'gpio_pin': 'B6', 'direction': 'out' }
Norman Jamesb38ea5a2015-10-28 12:44:56 -0500159GPIO_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' }
Adriana Kobylak341c8c22016-06-16 09:20:55 -0500167GPIO_CONFIG['CHECKSTOP'] = { 'gpio_pin': 'P5', 'direction': 'falling' }
Norman Jamesc9239a32015-10-06 16:54:31 -0500168
Norman James6bbe0b52015-10-27 09:18:05 -0500169def convertGpio(name):
170 name = name.upper()
171 c = name[0:1]
Norman Jamesa9966b32015-10-28 06:55:58 -0500172 offset = int(name[1:])
Norman James6bbe0b52015-10-27 09:18:05 -0500173 a = ord(c)-65
Norman Jamesa9966b32015-10-28 06:55:58 -0500174 base = a*8+GPIO_BASE
Norman James7b8811e2016-01-12 12:51:29 -0600175 return base+offset
176
177HWMON_CONFIG = {
178 '2-004c' : {
179 'names' : {
Edward A. Jamesc14f6fe2016-08-11 11:02:15 -0500180 'temp1_input' : { 'object_path' : 'temperature/ambient','poll_interval' : 5000,'scale' : -3,'units' : 'C' },
Norman James7b8811e2016-01-12 12:51:29 -0600181 }
Yi Li155f93f2016-01-30 15:30:14 +0800182 },
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 }
Norman James7b8811e2016-01-12 12:51:29 -0600192 }
193}
Yi Li54decc82016-05-05 17:42:56 +0800194
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}