diff options
-rw-r--r-- | configs/Barreleye.py | 12 | ||||
-rw-r--r-- | configs/Firestone.py | 15 | ||||
-rw-r--r-- | configs/Garrison.py | 15 | ||||
-rw-r--r-- | configs/Palmetto.py | 11 | ||||
-rw-r--r-- | configs/Witherspoon.py | 12 | ||||
-rw-r--r-- | pysystemmgr/obmc/system/__init__.py | 9 | ||||
-rw-r--r-- | pysystemmgr/setup.py | 1 | ||||
-rw-r--r-- | pysystemmgr/system_manager.py | 3 | ||||
-rw-r--r-- | pytools/gpioutil | 7 |
9 files changed, 16 insertions, 69 deletions
diff --git a/configs/Barreleye.py b/configs/Barreleye.py index 8a3bbca..0273c4b 100644 --- a/configs/Barreleye.py +++ b/configs/Barreleye.py @@ -1,6 +1,3 @@ -GPIO_BASE = 320 - - ## System states ## state can change to next state in 2 ways: ## - a process emits a GotoSystemState signal with state name to goto @@ -366,15 +363,6 @@ GPIO_CONFIG['SLOT2_PRESENT'] = { 'gpio_pin': 'N5', 'direction': 'in' } GPIO_CONFIG['MEZZ0_PRESENT'] = { 'gpio_pin': 'O0', 'direction': 'in' } GPIO_CONFIG['MEZZ1_PRESENT'] = { 'gpio_pin': 'O1', 'direction': 'in' } -def convertGpio(name): - name = name.upper() - c = name[0:1] - offset = int(name[1:]) - a = ord(c)-65 - base = a*8+GPIO_BASE - return base+offset - - HWMON_CONFIG = { '0-004a' : { 'names' : { diff --git a/configs/Firestone.py b/configs/Firestone.py index f525661..0f28515 100644 --- a/configs/Firestone.py +++ b/configs/Firestone.py @@ -1,6 +1,3 @@ -GPIO_BASE = 320 - - ## System states ## state can change to next state in 2 ways: ## - a process emits a GotoSystemState signal with state name to goto @@ -346,18 +343,6 @@ GPIO_CONFIG['PS1_PRES_N'] = \ GPIO_CONFIG['CARD_PRES_N'] = \ {'gpio_pin': 'J0', 'direction': 'in'} - - - -def convertGpio(name): - name = name.upper() - c = name[0:1] - offset = int(name[1:]) - a = ord(c)-65 - base = a*8+GPIO_BASE - return base+offset - - HWMON_CONFIG = { '4-0050' : { 'names' : { diff --git a/configs/Garrison.py b/configs/Garrison.py index 56e3392..133bad8 100644 --- a/configs/Garrison.py +++ b/configs/Garrison.py @@ -1,6 +1,3 @@ -GPIO_BASE = 320 - - ## System states ## state can change to next state in 2 ways: ## - a process emits a GotoSystemState signal with state name to goto @@ -347,18 +344,6 @@ GPIO_CONFIG['PS1_PRES_N'] = \ GPIO_CONFIG['CARD_PRES_N'] = \ {'gpio_pin': 'J0', 'direction': 'in'} - - - -def convertGpio(name): - name = name.upper() - c = name[0:1] - offset = int(name[1:]) - a = ord(c)-65 - base = a*8+GPIO_BASE - return base+offset - - HWMON_CONFIG = { '4-0050' : { 'names' : { diff --git a/configs/Palmetto.py b/configs/Palmetto.py index f1ba970..98a04d2 100644 --- a/configs/Palmetto.py +++ b/configs/Palmetto.py @@ -1,6 +1,3 @@ -GPIO_BASE = 320 - - ## System states ## state can change to next state in 2 ways: ## - a process emits a GotoSystemState signal with state name to goto @@ -110,14 +107,6 @@ GPIO_CONFIG['MEZZ0_PRESENT'] = { 'gpio_pin': 'O0', 'direction': 'in' } GPIO_CONFIG['MEZZ1_PRESENT'] = { 'gpio_pin': 'O1', 'direction': 'in' } GPIO_CONFIG['CHECKSTOP'] = { 'gpio_pin': 'P5', 'direction': 'falling' } -def convertGpio(name): - name = name.upper() - c = name[0:1] - offset = int(name[1:]) - a = ord(c)-65 - base = a*8+GPIO_BASE - return base+offset - HWMON_CONFIG = { '2-004c' : { 'names' : { diff --git a/configs/Witherspoon.py b/configs/Witherspoon.py index debe096..7aee81a 100644 --- a/configs/Witherspoon.py +++ b/configs/Witherspoon.py @@ -1,6 +1,3 @@ -GPIO_BASE = 320 - - ## System states ## state can change to next state in 2 ways: ## - a process emits a GotoSystemState signal with state name to goto @@ -373,15 +370,6 @@ GPIO_CONFIG['PS1_PRES_N'] = \ GPIO_CONFIG['CARD_PRES_N'] = \ {'gpio_pin': 'I0', 'direction': 'in'} -def convertGpio(name): - name = name.upper() - c = name[0:1] - offset = int(name[1:]) - a = ord(c)-65 - base = a*8+GPIO_BASE - return base+offset - - HWMON_CONFIG = { '4-0050' : { 'names' : { diff --git a/pysystemmgr/obmc/system/__init__.py b/pysystemmgr/obmc/system/__init__.py new file mode 100644 index 0000000..8799b69 --- /dev/null +++ b/pysystemmgr/obmc/system/__init__.py @@ -0,0 +1,9 @@ +GPIO_BASE = 320 + +def convertGpio(name): + name = name.upper() + c = name[0:1] + offset = int(name[1:]) + a = ord(c)-65 + base = a*8+GPIO_BASE + return base+offset diff --git a/pysystemmgr/setup.py b/pysystemmgr/setup.py index 4207620..a921e9c 100644 --- a/pysystemmgr/setup.py +++ b/pysystemmgr/setup.py @@ -2,5 +2,6 @@ from distutils.core import setup setup(name='pysystemmgr', version='1.0', + packages=['obmc.system'], scripts=['system_manager.py'], ) diff --git a/pysystemmgr/system_manager.py b/pysystemmgr/system_manager.py index 93dfcba..4f9b261 100644 --- a/pysystemmgr/system_manager.py +++ b/pysystemmgr/system_manager.py @@ -11,6 +11,7 @@ import obmc.enums import obmc_system_config as System import obmc.mapper.utils import obmc.inventory +import obmc.system DBUS_NAME = 'org.openbmc.managers.System' OBJ_NAME = '/org/openbmc/managers/System' @@ -136,7 +137,7 @@ class SystemManager(DbusProperties, DbusObjectManager): gpio_num = gpio['gpio_num'] else: if 'gpio_pin' in System.GPIO_CONFIG[name]: - gpio_num = System.convertGpio(gpio['gpio_pin']) + gpio_num = obmc.system.convertGpio(gpio['gpio_pin']) else: print "ERROR: SystemManager - GPIO lookup failed for "+name diff --git a/pytools/gpioutil b/pytools/gpioutil index 58e02e6..0654cd9 100644 --- a/pytools/gpioutil +++ b/pytools/gpioutil @@ -4,6 +4,7 @@ import sys import os import getopt import obmc_system_config as System +import obmc.system def printUsage(): @@ -114,9 +115,9 @@ if __name__ == '__main__': elif opt in ("-v"): value = arg elif opt in ("-p"): - gpio_name = System.convertGpio(arg) + gpio_name = obmc.system.convertGpio(arg) elif opt in ("-l"): - gpio_name = System.convertGpio(arg) + gpio_name = obmc.system.convertGpio(arg) print gpio_name exit(0) @@ -133,7 +134,7 @@ if __name__ == '__main__': if (gpio_info.has_key('gpio_num')): gpio_name = str(gpio_info['gpio_num']) else: - gpio_name = str(System.convertGpio(gpio_info['gpio_pin'])) + gpio_name = str(obmc.system.convertGpio(gpio_info['gpio_pin'])) print "GPIO ID: "+gpio_name+"; DIRECTION: "+direction |