Merge pull request #86 from anoo1/mb
Read vpd from motherboard and add it to the inventory
diff --git a/bin/Barreleye.py b/bin/Barreleye.py
index 98dce40..66691fa 100755
--- a/bin/Barreleye.py
+++ b/bin/Barreleye.py
@@ -546,6 +546,7 @@
GPIO_CONFIG['PCIE_RESET'] = { 'gpio_pin': 'B5', 'direction': 'out' }
GPIO_CONFIG['USB_RESET'] = { 'gpio_pin': 'B6', 'direction': 'out' }
+GPIO_CONFIG['IDBTN'] = { 'gpio_pin': 'Q7', 'direction': 'out' }
GPIO_CONFIG['BMC_THROTTLE'] = { 'gpio_pin': 'J3', 'direction': 'out' }
GPIO_CONFIG['RESET_BUTTON'] = { 'gpio_pin': 'E2', 'direction': 'both' }
GPIO_CONFIG['CPLD_TCK'] = { 'gpio_pin': 'P0', 'direction': 'out' }
@@ -747,3 +748,16 @@
},
}
+# Miscellaneous non-poll sensor with system specific properties.
+# The sensor id is the same as those defined in ID_LOOKUP['SENSOR'].
+MISC_SENSORS = {
+ 0x09 : { 'class' : 'BootCountSensor' },
+ 0x05 : { 'class' : 'BootProgressSensor' },
+ 0x08 : { 'class' : 'OccStatusSensor',
+ 'os_path' : '/sys/class/i2c-adapter/i2c-3/3-0050/online' },
+ 0x0A : { 'class' : 'OccStatusSensor',
+ 'os_path' : '/sys/class/i2c-adapter/i2c-3/3-0051/online' },
+ 0x32 : { 'class' : 'OperatingSystemStatusSensor' },
+ 0x33 : { 'class' : 'PowerCap',
+ 'os_path' : '/sys/class/hwmon/hwmon3/user_powercap' },
+}
diff --git a/bin/Firestone.py b/bin/Firestone.py
index 91a6099..4767178 100755
--- a/bin/Firestone.py
+++ b/bin/Firestone.py
@@ -466,7 +466,8 @@
{'gpio_pin': 'N3', 'direction': 'out'}
GPIO_CONFIG['CP1_DEVICES_RESET_N'] = \
{'gpio_pin': 'N5', 'direction': 'out'}
-
+GPIO_CONFIG['IDBTN'] = \
+ { 'gpio_pin': 'Q7', 'direction': 'out' }
GPIO_CONFIG['FSI_DATA'] = \
{'gpio_pin': 'A5', 'direction': 'out'}
GPIO_CONFIG['FSI_CLK'] = \
@@ -608,3 +609,18 @@
}
},
}
+
+
+# Miscellaneous non-poll sensor with system specific properties.
+# The sensor id is the same as those defined in ID_LOOKUP['SENSOR'].
+MISC_SENSORS = {
+ 0x5f : { 'class' : 'BootCountSensor' },
+ 0x05 : { 'class' : 'BootProgressSensor' },
+ 0x08 : { 'class' : 'OccStatusSensor',
+ 'os_path' : '/sys/class/i2c-adapter/i2c-3/3-0050/online' },
+ 0x09 : { 'class' : 'OccStatusSensor',
+ 'os_path' : '/sys/class/i2c-adapter/i2c-3/3-0051/online' },
+ 0xb5 : { 'class' : 'OperatingSystemStatusSensor' },
+ 0xb3 : { 'class' : 'PowerCap',
+ 'os_path' : '/sys/class/hwmon/hwmon3/user_powercap' },
+}
diff --git a/bin/Garrison.py b/bin/Garrison.py
index 5564162..e8f0927 100755
--- a/bin/Garrison.py
+++ b/bin/Garrison.py
@@ -478,6 +478,8 @@
GPIO_CONFIG['BMC_THROTTLE'] = \
{'gpio_pin': 'J3', 'direction': 'out'}
+GPIO_CONFIG['IDBTN'] = \
+ { 'gpio_pin': 'Q7', 'direction': 'out' }
GPIO_CONFIG['POWER_BUTTON'] = \
{'gpio_pin': 'E0', 'direction': 'both'}
GPIO_CONFIG['RESET_BUTTON'] = \
@@ -608,3 +610,17 @@
}
},
}
+
+# Miscellaneous non-poll sensor with system specific properties.
+# The sensor id is the same as those defined in ID_LOOKUP['SENSOR'].
+MISC_SENSORS = {
+ 0x5f : { 'class' : 'BootCountSensor' },
+ 0x05 : { 'class' : 'BootProgressSensor' },
+ 0x08 : { 'class' : 'OccStatusSensor',
+ 'os_path' : '/sys/class/i2c-adapter/i2c-3/3-0050/online' },
+ 0x09 : { 'class' : 'OccStatusSensor',
+ 'os_path' : '/sys/class/i2c-adapter/i2c-3/3-0051/online' },
+ 0xb5 : { 'class' : 'OperatingSystemStatusSensor' },
+ 0xb3 : { 'class' : 'PowerCap',
+ 'os_path' : '/sys/class/hwmon/hwmon3/user_powercap' },
+}
diff --git a/bin/Palmetto.py b/bin/Palmetto.py
index bbfc2e1..bb4d6f2 100755
--- a/bin/Palmetto.py
+++ b/bin/Palmetto.py
@@ -275,6 +275,7 @@
GPIO_CONFIG['CRONUS_SEL'] = { 'gpio_pin': 'A6', 'direction': 'out' }
GPIO_CONFIG['PGOOD'] = { 'gpio_pin': 'C7', 'direction': 'in' }
GPIO_CONFIG['BMC_THROTTLE'] = { 'gpio_pin': 'J3', 'direction': 'out' }
+GPIO_CONFIG['IDBTN'] = { 'gpio_pin': 'Q7', 'direction': 'out' }
GPIO_CONFIG['POWER_BUTTON'] = { 'gpio_pin': 'E0', 'direction': 'both' }
GPIO_CONFIG['PCIE_RESET'] = { 'gpio_pin': 'B5', 'direction': 'out' }
GPIO_CONFIG['USB_RESET'] = { 'gpio_pin': 'B6', 'direction': 'out' }
@@ -312,3 +313,15 @@
}
}
}
+
+# Miscellaneous non-poll sensor with system specific properties.
+# The sensor id is the same as those defined in ID_LOOKUP['SENSOR'].
+MISC_SENSORS = {
+ 0x09 : { 'class' : 'BootCountSensor' },
+ 0x05 : { 'class' : 'BootProgressSensor' },
+ 0x08 : { 'class' : 'OccStatusSensor',
+ 'os_path' : '/sys/class/i2c-adapter/i2c-3/3-0050/online' },
+ 0x32 : { 'class' : 'OperatingSystemStatusSensor' },
+ 0x33 : { 'class' : 'PowerCap',
+ 'os_path' : '/sys/class/hwmon/hwmon1/user_powercap' },
+}
diff --git a/bin/bmc_update.py b/bin/bmc_update.py
index a3032cf..5d66be2 100755
--- a/bin/bmc_update.py
+++ b/bin/bmc_update.py
@@ -49,6 +49,12 @@
self.TftpDownload(ip,filename)
self.Set(DBUS_NAME,"status","Downloading")
+ @dbus.service.method(DBUS_NAME,
+ in_signature='s', out_signature='')
+ def update(self,filename):
+ self.Set(DBUS_NAME,"filename",filename)
+ self.download_complete_handler(filename, filename)
+
@dbus.service.signal(DOWNLOAD_INTF,signature='ss')
def TftpDownload(self,ip,filename):
self.Set(DBUS_NAME,"filename",filename)
diff --git a/bin/sensor_manager2.py b/bin/sensor_manager2.py
index b5aac53..619e8e5 100755
--- a/bin/sensor_manager2.py
+++ b/bin/sensor_manager2.py
@@ -9,6 +9,8 @@
import Openbmc
import Sensors
+System = __import__(sys.argv[1])
+
DBUS_NAME = 'org.openbmc.Sensors'
OBJ_PATH = '/org/openbmc/sensors'
@@ -50,32 +52,13 @@
## instantiate non-polling sensors
## these don't need to be in seperate process
- ## TODO: this should not be hardcoded
-
- obj_path = OBJ_PATH+"/host/PowerCap"
- sensor_obj = Sensors.PowerCap(bus,obj_path)
- ## hwmon3 is default for master OCC on Barreleye.
- ## should rewrite sensor_manager to remove hardcode
- sensor_obj.sysfs_attr = "/sys/class/hwmon/hwmon3/user_powercap"
- root_sensor.add(obj_path,sensor_obj)
-
- obj_path = OBJ_PATH+"/host/BootProgress"
- root_sensor.add(obj_path,Sensors.BootProgressSensor(bus,obj_path))
-
- obj_path = OBJ_PATH+"/host/cpu0/OccStatus"
- sensor_obj = Sensors.OccStatusSensor(bus,obj_path)
- sensor_obj.sysfs_attr = "/sys/class/i2c-adapter/i2c-3/3-0050/online"
- root_sensor.add(obj_path,sensor_obj)
-
- obj_path = OBJ_PATH+"/host/cpu1/OccStatus"
- sensor_obj = Sensors.OccStatusSensor(bus,obj_path)
- sensor_obj.sysfs_attr = "/sys/class/i2c-adapter/i2c-3/3-0051/online"
- root_sensor.add(obj_path,sensor_obj)
-
- obj_path = OBJ_PATH+"/host/BootCount"
- root_sensor.add(obj_path,Sensors.BootCountSensor(bus,obj_path))
- obj_path = OBJ_PATH+"/host/OperatingSystemStatus"
- root_sensor.add(obj_path,Sensors.OperatingSystemStatusSensor(bus,obj_path))
+ for (id, the_sensor) in System.MISC_SENSORS.items():
+ sensor_class = the_sensor['class']
+ obj_path = System.ID_LOOKUP['SENSOR'][id]
+ sensor_obj = getattr(Sensors, sensor_class)(bus, obj_path)
+ if 'os_path' in the_sensor:
+ sensor_obj.sysfs_attr = the_sensor['os_path']
+ root_sensor.add(obj_path, sensor_obj)
mainloop = gobject.MainLoop()
print "Starting sensor manager"
diff --git a/objects/control_host_obj.c b/objects/control_host_obj.c
old mode 100644
new mode 100755
index 9253007..e65f0af
--- a/objects/control_host_obj.c
+++ b/objects/control_host_obj.c
@@ -21,6 +21,7 @@
GPIO fsi_enable = (GPIO){ "FSI_ENABLE" };
GPIO cronus_sel = (GPIO){ "CRONUS_SEL" };
GPIO Throttle = (GPIO){ "BMC_THROTTLE" };
+GPIO idbtn = (GPIO){ "IDBTN" };
/* Bit bang patterns */
@@ -104,6 +105,7 @@
rc |= gpio_open(&fsi_enable);
rc |= gpio_open(&cronus_sel);
rc |= gpio_open(&Throttle);
+ rc |= gpio_open(&idbtn);
if(rc!=GPIO_OK) { break; }
//setup dc pins
@@ -111,6 +113,7 @@
rc |= gpio_write(&fsi_enable,1);
rc |= gpio_write(&fsi_clk,1);
rc |= gpio_write(&Throttle,1);
+ rc |= gpio_write(&idbtn,0);
if(rc!=GPIO_OK) { break; }
//data standy state
@@ -169,6 +172,7 @@
gpio_close(&fsi_enable);
gpio_close(&cronus_sel);
gpio_close(&Throttle);
+ gpio_close(&idbtn);
control_host_emit_booted(host);
return TRUE;
@@ -219,6 +223,7 @@
gpio_init(connection,&fsi_enable);
gpio_init(connection,&cronus_sel);
gpio_init(connection,&Throttle);
+ gpio_init(connection,&idbtn);
}
static void