Merge remote-tracking branch 'upstream/master'
diff --git a/Makefile b/Makefile
index c9300cb..b303513 100644
--- a/Makefile
+++ b/Makefile
@@ -37,8 +37,8 @@
power_control: power_control_obj.o gpio.o
$(CC) -o bin/$@.exe obj/gpio.o obj/power_control_obj.o $(OFLAGS) $(CFLAGS)
-chassis_identify: chassis_identify_obj.o gpio.o
- $(CC) -o bin/$@.exe obj/gpio.o obj/chassis_identify_obj.o $(OFLAGS) $(CFLAGS)
+led_controller: led_controller.o gpio.o
+ $(CC) -o bin/$@.exe obj/gpio.o obj/led_controller.o $(OFLAGS) $(CFLAGS)
sensor_ambient: sensor_threshold.o sensor_temperature_ambient_obj.o
$(CC) -o bin/$@.exe obj/sensor_threshold.o obj/sensor_temperature_ambient_obj.o $(OFLAGS) $(CFLAGS)
@@ -46,9 +46,6 @@
button_power: button_power_obj.o gpio.o
$(CC) -o bin/$@.exe obj/button_power_obj.o obj/gpio.o $(OFLAGS) $(CFLAGS)
-sensor_host_status: sensor_host_status_obj.o
- $(CC) -o bin/$@.exe obj/sensor_host_status_obj.o $(OFLAGS) $(CFLAGS)
-
control_host: control_host_obj.o gpio.o
$(CC) -o bin/$@.exe obj/gpio.o obj/control_host_obj.o $(OFLAGS) $(CFLAGS)
@@ -76,5 +73,8 @@
flasher: $(OBJS2) flasher_obj.o
$(CC) -o bin/$@.exe obj/flasher_obj.o $(OFLAGS) $(OBJS3) $(CFLAGS)
+hwmon: hwmon_intf.o
+ $(CC) -o bin/$@.exe obj/hwmon_intf.o $(OFLAGS) $(CFLAGS)
-all: clean setup libopenbmc_intf power_control chassis_identify sensor_ambient button_power sensor_host_status control_host fan host_watchdog control_bmc sensor_occ board_vpd pcie_slot_present flash_bios flasher
+
+all: clean setup libopenbmc_intf power_control led_controller sensor_ambient button_power control_host fan host_watchdog control_bmc board_vpd pcie_slot_present flash_bios flasher
diff --git a/bin/Openbmc.py b/bin/Openbmc.py
index cb2746a..1518f74 100755
--- a/bin/Openbmc.py
+++ b/bin/Openbmc.py
@@ -12,10 +12,12 @@
'DIMM' : 2,
'MAIN_PLANAR' : 3,
'RISER_CARD' : 4,
- 'FAN' : 5,
- 'BMC' : 6,
- 'CORE' : 7,
- 'PCIE_CARD' : 8,
+ 'DAUGHTER_CARD' : 5,
+ 'FAN' : 6,
+ 'BMC' : 7,
+ 'CORE' : 8,
+ 'PCIE_CARD' : 9,
+ 'MEMORY_BUFFER' : 10,
}
FRU_STATES = {
'NORMAL' : 0,
@@ -103,8 +105,55 @@
parent = False
+class DbusProperties(dbus.service.Object):
+ def __init__(self):
+ dbus.service.Object.__init__(self)
+ self.properties = {}
-class DbusProperty:
+ @dbus.service.method(dbus.PROPERTIES_IFACE,
+ in_signature='ss', out_signature='v')
+ def Get(self, interface_name, property_name):
+ d = self.GetAll(interface_name)
+ try:
+ v = d[property_name]
+ return v
+ except:
+ raise dbus.exceptions.DBusException(
+ "org.freedesktop.UnknownPropery: "+property_name)
+
+ @dbus.service.method(dbus.PROPERTIES_IFACE,
+ in_signature='s', out_signature='a{sv}')
+ def GetAll(self, interface_name):
+ try:
+ d = self.properties[interface_name]
+ return d
+ except:
+ raise dbus.exceptions.DBusException(
+ "org.freedesktop.UnknownInterface: "+interface_name)
+
+ @dbus.service.method(dbus.PROPERTIES_IFACE,
+ in_signature='ssv')
+ def Set(self, interface_name, property_name, new_value):
+ if (self.properties.has_key(interface_name) == False):
+ self.properties[interface_name] = {}
+ try:
+ old_value = self.properties[interface_name][property_name]
+ if (old_value != new_value):
+ self.properties[interface_name][property_name] = new_value
+ self.PropertiesChanged(interface_name,{ property_name: new_value }, [])
+
+ except:
+ self.properties[interface_name][property_name] = new_value
+
+ @dbus.service.signal(dbus.PROPERTIES_IFACE,
+ signature='sa{sv}as')
+ def PropertiesChanged(self, interface_name, changed_properties,
+ invalidated_properties):
+ pass
+
+
+
+class DbusVariable:
def __init__(self,name,value):
self.name = str(name)
self.dbusType = str(type(value)).split("'")[1]
diff --git a/bin/Palmetto.py b/bin/Palmetto.py
index db940b7..5cec95c 100755
--- a/bin/Palmetto.py
+++ b/bin/Palmetto.py
@@ -10,30 +10,51 @@
SYSTEM_NAME = "Palmetto"
+
+## System states
+## state can change to next state in 2 ways:
+## - a process emits a GotoSystemState signal with state name to goto
+## - objects specified in EXIT_STATE_DEPEND have started
SYSTEM_STATES = [
- 'INIT',
- 'STANDBY',
- 'POWERING_ON',
- 'POWERED_ON',
- 'BOOTING',
+ 'BMC_INIT',
+ 'BMC_STARTING',
+ 'BMC_READY',
+ 'HOST_POWERING_ON',
+ 'HOST_POWERED_ON',
+ 'HOST_BOOTING',
'HOST_UP',
- 'SHUTTING_DOWN',
- 'POWERING_DOWN'
+ 'HOST_POWERED_DOWN',
]
+EXIT_STATE_DEPEND = {
+ 'BMC_STARTING' : {
+ '/org/openbmc/control/chassis0': 0,
+ '/org/openbmc/control/power0' : 0,
+ '/org/openbmc/control/led/BMC_READY' : 0,
+ '/org/openbmc/control/Host_0' : 0,
+ }
+}
+
+## method will be called when state is entered
ENTER_STATE_CALLBACK = {
- 'POWERED_ON' : {
+ 'HOST_POWERED_ON' : {
'bus_name' : 'org.openbmc.control.Host',
'obj_name' : '/org/openbmc/control/Host_0',
'interface_name' : 'org.openbmc.control.Host',
'method_name' : 'boot'
+ },
+ 'BMC_READY' : {
+ 'bus_name' : 'org.openbmc.control.led',
+ 'obj_name' : '/org/openbmc/control/led/BMC_READY',
+ 'interface_name' : 'org.openbmc.Led',
+ 'method_name' : 'setOn'
}
}
SYSTEM_CONFIG = {}
SYSTEM_CONFIG['org.openbmc.control.Bmc'] = {
- 'system_state' : 'INIT',
+ 'system_state' : 'BMC_INIT',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'control_bmc.exe',
@@ -42,7 +63,7 @@
}
SYSTEM_CONFIG['org.openbmc.managers.Inventory'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'inventory_items.py',
@@ -50,7 +71,7 @@
'instances' : [ { 'name' : SYSTEM_NAME } ]
}
SYSTEM_CONFIG['org.openbmc.control.PciePresent'] = {
- 'system_state' : 'POWERED_ON',
+ 'system_state' : 'HOST_POWERED_ON',
'start_process' : True,
'monitor_process' : False,
'process_name' : 'pcie_slot_present.exe',
@@ -58,16 +79,16 @@
'instances' : [ { 'name' : 'Slots_0' } ]
}
SYSTEM_CONFIG['org.openbmc.sensor.Power8Virtual'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'sensors_virtual_p8.py',
'heartbeat' : 'no',
- 'instances' : [ { 'name' : 'Dummy' } ]
+ 'instances' : [ { 'name' : 'virtual' } ]
}
SYSTEM_CONFIG['org.openbmc.managers.Sensors'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'sensor_manager.py',
@@ -76,7 +97,7 @@
}
SYSTEM_CONFIG['org.openbmc.watchdog.Host'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'host_watchdog.exe',
@@ -94,14 +115,14 @@
}
SYSTEM_CONFIG['org.openbmc.control.Power'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'power_control.exe',
'heartbeat' : 'no',
'instances' : [
{
- 'name' : 'SystemPower_0',
+ 'name' : 'power0',
'user_label': 'Power control',
'properties' : {
'org.openbmc.Control': {
@@ -115,60 +136,24 @@
]
}
-SYSTEM_CONFIG['org.openbmc.sensors.Temperature.Ambient'] = {
- 'system_state' : 'STANDBY',
- 'start_process' : True,
- 'monitor_process' : True,
- 'process_name' : 'sensor_ambient.exe',
- 'heartbeat' : 'no',
- 'instances' : [
- {
- 'name' : 'FrontChassis',
- 'user_label': 'Ambient Temperature 1',
- 'properties' : {
- 'org.openbmc.SensorValue': {
- 'poll_interval' : 5000,
- },
- 'org.openbmc.SensorThreshold' : {
- 'lower_critical': 5,
- 'lower_warning' : 10,
- 'upper_warning' : 15,
- 'upper_critical': 20
- },
- 'org.openbmc.SensorI2c' : {
- 'dev_path' : '/dev/i2c/i2c0',
- 'address' : '0xA0'
- }
- }
- },
- ]
- }
SYSTEM_CONFIG['org.openbmc.buttons.Power'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'button_power.exe',
'heartbeat' : 'no',
'instances' : [ { 'name' : 'PowerButton_0' } ]
}
-SYSTEM_CONFIG['org.openbmc.sensors.HostStatus'] = {
- 'system_state' : 'STANDBY',
- 'start_process' : False,
- 'monitor_process' : False,
- 'process_name' : 'sensor_host_status.exe',
- 'heartbeat' : "no",
- 'instances' : [ { 'name' : 'HostStatus_0' } ]
- }
-SYSTEM_CONFIG['org.openbmc.leds.ChassisIdentify'] = {
- 'system_state' : 'STANDBY',
+SYSTEM_CONFIG['org.openbmc.control.led'] = {
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
- 'process_name' : 'chassis_identify.exe',
+ 'process_name' : 'led_controller.exe',
'heartbeat' : 'no',
- 'instances' : [ { 'name' : 'ChassisIdentify_0' } ]
+ 'instances' : [ { 'name' : 'Dummy' } ]
}
SYSTEM_CONFIG['org.openbmc.flash.Bios'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'flash_bios.exe',
@@ -177,7 +162,7 @@
}
SYSTEM_CONFIG['org.openbmc.manager.Download'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'download_manager.py',
@@ -186,7 +171,7 @@
}
SYSTEM_CONFIG['org.openbmc.control.Host'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'control_host.exe',
@@ -194,44 +179,25 @@
'instances' : [ { 'name' : 'Host_0' } ]
}
SYSTEM_CONFIG['org.openbmc.control.Chassis'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'chassis_control.py',
'heartbeat' : 'no',
- 'instances' : [ { 'name' : 'Chassis' } ]
+ 'instances' : [ { 'name' : 'chassis0' } ]
}
SYSTEM_CONFIG['org.openbmc.vpd'] = {
- 'system_state' : 'POWERING_ON',
- 'start_process' : True,
+ 'system_state' : 'HOST_POWERED_ON',
+ 'start_process' : False,
'monitor_process' : False,
'process_name' : 'board_vpd.exe',
'heartbeat' : 'no',
'instances' : [ { 'name' : 'MBVPD_0' } ]
}
-SYSTEM_CONFIG['org.openbmc.sensors.Occ'] = {
- 'system_state' : 'BOOTED',
- 'start_process' : True,
- 'monitor_process' : True,
- 'process_name' : 'sensor_occ.exe',
- 'heartbeat' : 'no',
- 'instances' : [
- {
- 'name' : 'Occ_0',
- 'properties' : {
- 'org.openbmc.Occ' : {
- 'poll_interval' : 3000,
- }
- }
- },
-
- ]
- }
-
SYSTEM_CONFIG['org.openbmc.sensors.Fan'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'fan.exe',
@@ -246,171 +212,130 @@
'state' : True,
'cache' : True
}
-INVENTORY_ROOT = '/org/openbmc/inventory/items'
+INVENTORY_ROOT = '/org/openbmc/inventory'
FRU_INSTANCES = {
'<inventory_root>/system' :
- {
- 'fru_type' : Openbmc.FRU_TYPES['SYSTEM'],
- 'is_fru' : True,
- },
- '<inventory_root>/system/io_board' :
- {
- 'fru_type' : Openbmc.FRU_TYPES['MAIN_PLANAR'],
- 'manufacturer' : 'FOXCONN',
- 'is_fru' : True,
- 'location' : 'C1',
- },
+ { 'fru_type' : 'SYSTEM','is_fru' : True, },
- '<inventory_root>/system/motherboard' :
- {
- 'fru_type' : Openbmc.FRU_TYPES['MAIN_PLANAR'],
- 'manufacturer' : 'FOXCONN',
- 'is_fru' : True,
- 'location' : 'C0',
- },
- '<inventory_root>/system/fan0' :
- {
- 'fru_type' : Openbmc.FRU_TYPES['FAN'],
- 'manufacturer' : 'DELTA',
- 'is_fru' : True,
- 'location' : 'F0',
- },
- '<inventory_root>/system/fan1' :
- {
- 'fru_type' : Openbmc.FRU_TYPES['FAN'],
- 'manufacturer' : 'DELTA',
- 'is_fru' : True,
- 'location' : 'F1',
- },
- '<inventory_root>/system/io_board/bmc' :
- {
- 'fru_type' : Openbmc.FRU_TYPES['BMC'],
- 'manufacturer' : 'ASPEED',
- 'is_fru' : False,
- },
- '<inventory_root>/system/motherboard/cpu0' :
- {
- 'fru_type' : Openbmc.FRU_TYPES['CPU'],
- 'manufacturer' : 'IBM',
- 'is_fru' : True,
- 'location' : 'P0',
- },
- '<inventory_root>/system/motherboard/cpu0/core0' :
- {
- 'fru_type' : Openbmc.FRU_TYPES['CORE'],
- 'is_fru' : False,
- },
- '<inventory_root>/system/motherboard/cpu0/core1' : {
- 'fru_type' : Openbmc.FRU_TYPES['CORE'],
- 'is_fru' : False,
- },
- '<inventory_root>/system/motherboard/cpu0/core2' : {
- 'fru_type' : Openbmc.FRU_TYPES['CORE'],
- 'is_fru' : False,
- },
- '<inventory_root>/system/motherboard/cpu0/core3' : {
- 'fru_type' : Openbmc.FRU_TYPES['CORE'],
- 'is_fru' : False,
- },
- '<inventory_root>/system/motherboard/cpu0/core4' : {
- 'fru_type' : Openbmc.FRU_TYPES['CORE'],
- 'is_fru' : False,
- },
- '<inventory_root>/system/motherboard/cpu0/core5' : {
- 'fru_type' : Openbmc.FRU_TYPES['CORE'],
- 'is_fru' : False,
- },
- '<inventory_root>/system/motherboard/cpu0/core6' : {
- 'fru_type' : Openbmc.FRU_TYPES['CORE'],
- 'is_fru' : False,
- },
- '<inventory_root>/system/motherboard/cpu0/core7' : {
- 'fru_type' : Openbmc.FRU_TYPES['CORE'],
- 'is_fru' : False,
- },
- '<inventory_root>/system/motherboard/cpu0/core8' : {
- 'fru_type' : Openbmc.FRU_TYPES['CORE'],
- 'is_fru' : False,
- },
- '<inventory_root>/system/motherboard/cpu0/core9' : {
- 'fru_type' : Openbmc.FRU_TYPES['CORE'],
- 'is_fru' : False,
- },
- '<inventory_root>/system/motherboard/cpu0/core10' : {
- 'fru_type' : Openbmc.FRU_TYPES['CORE'],
- 'is_fru' : False,
- },
- '<inventory_root>/system/motherboard/cpu0/core11' : {
- 'fru_type' : Openbmc.FRU_TYPES['CORE'],
- 'is_fru' : False,
- },
- '<inventory_root>/system/motherboard/centaur0' :
- {
- 'fru_type' : 0,
- 'is_fru' : False,
- },
- '<inventory_root>/system/motherboard/dimm0' :
- {
- 'fru_type' : Openbmc.FRU_TYPES['DIMM'],
- 'is_fru' : True,
- },
- '<inventory_root>/system/motherboard/dimm1' :
- {
- 'fru_type' : Openbmc.FRU_TYPES['DIMM'],
- 'is_fru' : True,
- },
- '<inventory_root>/system/motherboard/dimm2' :
- {
- 'fru_type' : Openbmc.FRU_TYPES['DIMM'],
- 'is_fru' : True,
- },
- '<inventory_root>/system/motherboard/dimm3' :
- {
- 'fru_type' : Openbmc.FRU_TYPES['DIMM'],
- 'is_fru' : True,
- },
- '<inventory_root>/system/io_board/pcie_slot0' :
- {
- 'fru_type' : Openbmc.FRU_TYPES['PCIE_CARD'],
- 'user_label' : 'PCIe card 0',
- 'is_fru' : True,
- },
- '<inventory_root>/system/io_board/pcie_slot1' :
- {
- 'fru_type' : Openbmc.FRU_TYPES['PCIE_CARD'],
- 'user_label' : 'PCIe card 1',
- 'is_fru' : True,
- },
+ '<inventory_root>/system/chassis' :
+ { 'fru_type' : 'SYSTEM','is_fru' : True, },
+
+ '<inventory_root>/system/chassis/motherboard' :
+ { 'fru_type' : 'MAIN_PLANAR','is_fru' : True, },
+
+ '<inventory_root>/system/chassis/fan0' :
+ { 'fru_type' : 'FAN','is_fru' : True, },
+ '<inventory_root>/system/chassis/fan1' :
+ { 'fru_type' : 'FAN','is_fru' : True, },
+ '<inventory_root>/system/chassis/fan2' :
+ { 'fru_type' : 'FAN','is_fru' : True, },
+ '<inventory_root>/system/chassis/fan3' :
+ { 'fru_type' : 'FAN','is_fru' : True, },
+ '<inventory_root>/system/chassis/fan4' :
+ { 'fru_type' : 'FAN','is_fru' : True, },
+
+ '<inventory_root>/system/chassis/motherboard/bmc' :
+ { 'fru_type' : 'BMC','is_fru' : False,
+ 'manufacturer' : 'ASPEED' },
+ '<inventory_root>/system/chassis/motherboard/cpu0' :
+ { 'fru_type' : 'CPU', 'is_fru' : True, },
+
+ '<inventory_root>/system/chassis/motherboard/cpu0/core0' :
+ { 'fru_type' : 'CORE', 'is_fru' : False, },
+
+ '<inventory_root>/system/chassis/motherboard/cpu0/core1' :
+ { 'fru_type' : 'CORE', 'is_fru' : False, },
+
+ '<inventory_root>/system/chassis/motherboard/cpu0/core2' :
+ { 'fru_type' : 'CORE', 'is_fru' : False, },
+
+ '<inventory_root>/system/chassis/motherboard/cpu0/core3' :
+ { 'fru_type' : 'CORE', 'is_fru' : False, },
+
+ '<inventory_root>/system/chassis/motherboard/cpu0/core4' :
+ { 'fru_type' : 'CORE', 'is_fru' : False, },
+
+ '<inventory_root>/system/chassis/motherboard/cpu0/core5' :
+ { 'fru_type' : 'CORE', 'is_fru' : False, },
+
+ '<inventory_root>/system/chassis/motherboard/cpu0/core6' :
+ { 'fru_type' : 'CORE', 'is_fru' : False, },
+
+ '<inventory_root>/system/chassis/motherboard/cpu0/core7' :
+ { 'fru_type' : 'CORE', 'is_fru' : False, },
+
+ '<inventory_root>/system/chassis/motherboard/cpu0/core8' :
+ { 'fru_type' : 'CORE', 'is_fru' : False, },
+
+ '<inventory_root>/system/chassis/motherboard/cpu0/core9' :
+ { 'fru_type' : 'CORE', 'is_fru' : False, },
+
+ '<inventory_root>/system/chassis/motherboard/cpu0/core10' :
+ { 'fru_type' : 'CORE', 'is_fru' : False, },
+
+ '<inventory_root>/system/chassis/motherboard/cpu0/core11' :
+ { 'fru_type' : 'CORE', 'is_fru' : False, },
+
+ '<inventory_root>/system/chassis/motherboard/centaur0' :
+ { 'fru_type' : 'MEMORY_BUFFER', 'is_fru' : False, },
+
+ '<inventory_root>/system/chassis/motherboard/dimm0' :
+ { 'fru_type' : 'DIMM', 'is_fru' : True,},
+
+ '<inventory_root>/system/chassis/motherboard/dimm1' :
+ { 'fru_type' : 'DIMM', 'is_fru' : True,},
+
+ '<inventory_root>/system/chassis/motherboard/dimm2' :
+ { 'fru_type' : 'DIMM', 'is_fru' : True,},
+
+ '<inventory_root>/system/chassis/motherboard/dimm3' :
+ { 'fru_type' : 'DIMM', 'is_fru' : True,},
+
+ '<inventory_root>/system/chassis/io_board/pcie_slot0' :
+ { 'fru_type' : 'PCIE_CARD', 'is_fru' : True,},
+
+ '<inventory_root>/system/chassis/io_board/pcie_slot1' :
+ { 'fru_type' : 'PCIE_CARD', 'is_fru' : True,},
+
}
ID_LOOKUP = {
'FRU' : {
- 0x01 : '<inventory_root>/system/motherboard/cpu0',
- 0x03 : '<inventory_root>/system/motherboard/dimm0',
- 0x04 : '<inventory_root>/system/motherboard/dimm1',
- 0x05 : '<inventory_root>/system/motherboard/dimm2',
- 0x06 : '<inventory_root>/system/motherboard/dimm3',
+ 0x0d : '<inventory_root>/system/chassis',
+ 0x34 : '<inventory_root>/system/chassis/motherboard',
+ 0x01 : '<inventory_root>/system/chassis/motherboard/cpu0',
+ 0x02 : '<inventory_root>/system/chassis/motherboard/centaur0',
+ 0x03 : '<inventory_root>/system/chassis/motherboard/dimm0',
+ 0x04 : '<inventory_root>/system/chassis/motherboard/dimm1',
+ 0x05 : '<inventory_root>/system/chassis/motherboard/dimm2',
+ 0x06 : '<inventory_root>/system/chassis/motherboard/dimm3',
+ 0xff : '<inventory_root>/system',
+ },
+ 'FRU_STR' : {
+ 'CHASSIS' : '<inventory_root>/system/chassis',
+ 'PRODUCT' : '<inventory_root>/system',
+ 'BOARD' : '<inventory_root>/system/chassis/motherboard',
},
'SENSOR' : {
- 0x2f : '<inventory_root>/system/motherboard/cpu0',
- 0x22 : '<inventory_root>/system/motherboard/cpu0/core0',
- 0x23 : '<inventory_root>/system/motherboard/cpu0/core1',
- 0x24 : '<inventory_root>/system/motherboard/cpu0/core2',
- 0x25 : '<inventory_root>/system/motherboard/cpu0/core3',
- 0x26 : '<inventory_root>/system/motherboard/cpu0/core4',
- 0x27 : '<inventory_root>/system/motherboard/cpu0/core5',
- 0x28 : '<inventory_root>/system/motherboard/cpu0/core6',
- 0x29 : '<inventory_root>/system/motherboard/cpu0/core7',
- 0x2a : '<inventory_root>/system/motherboard/cpu0/core8',
- 0x2b : '<inventory_root>/system/motherboard/cpu0/core9',
- 0x2c : '<inventory_root>/system/motherboard/cpu0/core10',
- 0x2d : '<inventory_root>/system/motherboard/cpu0/core11',
- 0x2e : '<inventory_root>/system/motherboard/centaur0',
- 0x1e : '<inventory_root>/system/motherboard/dimm0',
- 0x1f : '<inventory_root>/system/motherboard/dimm1',
- 0x20 : '<inventory_root>/system/motherboard/dimm2',
- 0x21 : '<inventory_root>/system/motherboard/dimm3',
+ 0x2f : '<inventory_root>/system/chassis/motherboard/cpu0',
+ 0x22 : '<inventory_root>/system/chassis/motherboard/cpu0/core0',
+ 0x23 : '<inventory_root>/system/chassis/motherboard/cpu0/core1',
+ 0x24 : '<inventory_root>/system/chassis/motherboard/cpu0/core2',
+ 0x25 : '<inventory_root>/system/chassis/motherboard/cpu0/core3',
+ 0x26 : '<inventory_root>/system/chassis/motherboard/cpu0/core4',
+ 0x27 : '<inventory_root>/system/chassis/motherboard/cpu0/core5',
+ 0x28 : '<inventory_root>/system/chassis/motherboard/cpu0/core6',
+ 0x29 : '<inventory_root>/system/chassis/motherboard/cpu0/core7',
+ 0x2a : '<inventory_root>/system/chassis/motherboard/cpu0/core8',
+ 0x2b : '<inventory_root>/system/chassis/motherboard/cpu0/core9',
+ 0x2c : '<inventory_root>/system/chassis/motherboard/cpu0/core10',
+ 0x2d : '<inventory_root>/system/chassis/motherboard/cpu0/core11',
+ 0x2e : '<inventory_root>/system/chassis/motherboard/centaur0',
+ 0x1e : '<inventory_root>/system/chassis/motherboard/dimm0',
+ 0x1f : '<inventory_root>/system/chassis/motherboard/dimm1',
+ 0x20 : '<inventory_root>/system/chassis/motherboard/dimm2',
+ 0x21 : '<inventory_root>/system/chassis/motherboard/dimm3',
0x09 : '/org/openbmc/sensor/virtual/BootCount',
0x05 : '/org/openbmc/sensor/virtual/BootProgress',
0x04 : '/org/openbmc/sensor/virtual/HostStatus',
@@ -418,9 +343,8 @@
0x32 : '/org/openbmc/sensor/virtual/OperatingSystemStatus',
},
'GPIO_PRESENT' : {
- 'SLOT0_PRESENT' : '<inventory_root>/system/io_board/pcie_slot0',
- 'SLOT1_PRESENT' : '<inventory_root>/system/io_board/pcie_slot1',
- 'SLOT2_PRESENT' : '<inventory_root>/system/io_board/pcie_slot2',
+ 'SLOT0_PRESENT' : '<inventory_root>/system/chassis/io_board/pcie_slot0',
+ 'SLOT1_PRESENT' : '<inventory_root>/system/chassis/io_board/pcie_slot1',
}
}
@@ -432,12 +356,13 @@
GPIO_CONFIG['CRONUS_SEL'] = { 'gpio_num': 486, 'direction': 'out' }
GPIO_CONFIG['PGOOD'] = { 'gpio_num': 503, 'direction': 'in' }
GPIO_CONFIG['IDENTIFY'] = { 'gpio_num': 365, 'direction': 'out' }
+GPIO_CONFIG['BMC_READY'] = { 'gpio_num': 365, 'direction': 'out' }
GPIO_CONFIG['POWER_BUTTON'] = { 'gpio_num': 448, 'direction': 'falling' }
GPIO_CONFIG['SLOT0_RISER_PRESENT'] = { 'gpio_num': 104, 'direction': 'in' }
GPIO_CONFIG['SLOT1_RISER_PRESENT'] = { 'gpio_num': 105, 'direction': 'in' }
GPIO_CONFIG['SLOT2_RISER_PRESENT'] = { 'gpio_num': 106, 'direction': 'in' }
-GPIO_CONFIG['SLOT0_PRESENT'] = { 'gpio_num': 107, 'direction': 'in' }
-GPIO_CONFIG['SLOT1_PRESENT'] = { 'gpio_num': 108, 'direction': 'in' }
+GPIO_CONFIG['SLOT0_PRESENT'] = { 'gpio_num': 470, 'direction': 'in' }
+GPIO_CONFIG['SLOT1_PRESENT'] = { 'gpio_num': 471, 'direction': 'in' }
GPIO_CONFIG['SLOT2_PRESENT'] = { 'gpio_num': 109, 'direction': 'in' }
GPIO_CONFIG['MEZZ0_PRESENT'] = { 'gpio_num': 112, 'direction': 'in' }
GPIO_CONFIG['MEZZ1_PRESENT'] = { 'gpio_num': 113, 'direction': 'in' }
diff --git a/bin/PropertyManager.py b/bin/PropertyManager.py
index b89ed12..1fa8d87 100755
--- a/bin/PropertyManager.py
+++ b/bin/PropertyManager.py
@@ -23,7 +23,7 @@
for prop_interface in properties.keys():
for prop in properties[prop_interface]:
tmp_val = dbus_properties.Get(prop_interface,prop)
- dbus_prop = Openbmc.DbusProperty(prop,tmp_val)
+ dbus_prop = Openbmc.DbusVariable(prop,tmp_val)
value = properties[prop_interface][prop]
dbus_prop.setValue(value)
dbus_properties.Set(prop_interface,prop,dbus_prop.getValue())
@@ -66,7 +66,7 @@
print "Caching: "+obj_path
all_properties = prop_intf.GetAll(interface_name)
for prop in all_properties.keys():
- dbus_prop = Openbmc.DbusProperty(prop,all_properties[prop])
+ dbus_prop = Openbmc.DbusVariable(prop,all_properties[prop])
dbus_props.append(dbus_prop)
try:
diff --git a/bin/chassis_control.py b/bin/chassis_control.py
index 2770507..6283aca 100755
--- a/bin/chassis_control.py
+++ b/bin/chassis_control.py
@@ -10,6 +10,7 @@
DBUS_NAME = 'org.openbmc.control.Chassis'
OBJ_NAME = '/org/openbmc/control/'+sys.argv[1]
+CONTROL_INTF = 'org.openbmc.Control'
POWER_OFF = 0
POWER_ON = 1
@@ -25,12 +26,12 @@
self.dbus_objects = {
'power_control' : {
'bus_name' : 'org.openbmc.control.Power',
- 'object_name' : '/org/openbmc/control/SystemPower_0',
+ 'object_name' : '/org/openbmc/control/power0',
'interface_name' : 'org.openbmc.control.Power'
},
'identify_led' : {
- 'bus_name' : 'org.openbmc.leds.ChassisIdentify',
- 'object_name' : '/org/openbmc/leds/ChassisIdentify_0',
+ 'bus_name' : 'org.openbmc.control.led',
+ 'object_name' : '/org/openbmc/led/IDENTIFY',
'interface_name' : 'org.openbmc.Led'
}
}
@@ -125,7 +126,7 @@
## Signal handler
def SystemStateHandler(self,state_name):
- if (state_name == "POWERED_OFF" and self.reboot==1):
+ if (state_name == "HOST_POWERED_OFF" and self.reboot==1):
self.powerOn()
diff --git a/bin/inventory_items.py b/bin/inventory_items.py
index d337d95..d27abd3 100755
--- a/bin/inventory_items.py
+++ b/bin/inventory_items.py
@@ -18,6 +18,7 @@
INTF_NAME = 'org.openbmc.InventoryItem'
DBUS_NAME = 'org.openbmc.managers.Inventory'
+ENUM_INTF = 'org.openbmc.Object.Enumerate'
FRUS = System.FRU_INSTANCES
FRU_PATH = System.FRU_PATH
@@ -35,74 +36,70 @@
def addItem(self,item):
self.objects.append(item)
- @dbus.service.method("org.openbmc.managers.Inventory",
+ @dbus.service.method(ENUM_INTF,
in_signature='', out_signature='a{sa{sv}}')
- def getItems(self):
+ def enumerate(self):
tmp_obj = {}
for item in self.objects:
- tmp_obj[str(item.item['name'])]=item.getItemDict()
+ tmp_obj[str(item.name)]=item.GetAll(INTF_NAME)
return tmp_obj
-class InventoryItem(dbus.service.Object):
- def __init__(self,bus,name):
+class InventoryItem(Openbmc.DbusProperties):
+ def __init__(self,bus,name):
+ Openbmc.DbusProperties.__init__(self)
dbus.service.Object.__init__(self,bus,name)
- ## store all properties in a dict so can easily
- ## send on dbus
- self.item = {
- 'name' : name,
- 'is_fru' : False,
- 'fru_type' : 0,
- 'state' : 0,
- 'manufacturer' : "",
- }
+ self.name = name
self.cache = True
-
- def getItemDict(self):
- return self.item
-
- @dbus.service.method('org.openbmc.InventoryItem',
+ self.Set(INTF_NAME,'is_fru',False)
+ self.Set(INTF_NAME,'fru_type',0)
+ self.Set(INTF_NAME,'present',"INACTIVE")
+ self.Set(INTF_NAME,'fault',"NONE")
+
+
+
+ @dbus.service.method(INTF_NAME,
in_signature='a{sv}', out_signature='')
def update(self,data):
## translate dbus data into basic data types
for k in data.keys():
- d = Openbmc.DbusProperty(k,data[k])
- self.item[str(k)] = d.getBaseValue()
+ self.setField(k,data[k])
+
self.saveToCache()
- @dbus.service.method("org.openbmc.InventoryItem",
+ @dbus.service.method(INTF_NAME,
in_signature='s', out_signature='')
def setPresent(self,present):
- self.item['present'] = present
- print "Set Present: "+str(present)
+ self.setField('present',present)
- @dbus.service.method("org.openbmc.InventoryItem",
+ @dbus.service.method(INTF_NAME,
in_signature='s', out_signature='')
def setFault(self,fault):
- self.item['fault_state'] = fault
- print "Set Fault: "+str(fault)
+ self.setField('fault',fault)
def setField(self,field,value):
- self.item[field] = value
+ f = str(field)
+ d = Openbmc.DbusVariable(f,value)
+ self.Set(INTF_NAME,f,d.getBaseValue())
def isCached(self):
return self.cache
def getCacheFilename(self):
global FRU_PATH
- name = self.item['name'].replace('/','.')
+ name = self.name.replace('/','.')
filename = FRU_PATH+name[1:]+".fru"
return filename
def saveToCache(self):
if (self.isCached() == False):
return
- print "Caching: "+self.item['name']
+ print "Caching: "+self.name
try:
output = open(self.getCacheFilename(), 'wb')
- ## just pickle dict not whole object
- cPickle.dump(self.item,output)
+ ## save properties
+ cPickle.dump(self.properties[INTF_NAME],output)
except Exception as e:
print "ERROR: "+str(e)
finally:
@@ -119,7 +116,7 @@
p = open(filename, 'rb')
data2 = cPickle.load(p)
for k in data2.keys():
- self.item[k] = data2[k]
+ self.setField(k,data2[k])
except Exception as e:
print "No cache file found: " +str(e)
finally:
@@ -131,7 +128,7 @@
bus = Openbmc.getDBus()
name = dbus.service.BusName(DBUS_NAME,bus)
mainloop = gobject.MainLoop()
- obj_parent = Inventory(bus, '/org/openbmc/managers/Inventory')
+ obj_parent = Inventory(bus, '/org/openbmc/inventory')
for f in FRUS.keys():
obj_path=f.replace("<inventory_root>",System.INVENTORY_ROOT)
diff --git a/bin/ipmi_example.py b/bin/ipmi_example.py
index 965332c..589c0ca 100755
--- a/bin/ipmi_example.py
+++ b/bin/ipmi_example.py
@@ -25,7 +25,7 @@
def getChassisControl():
obj = bus.get_object('org.openbmc.control.Chassis',
- '/org/openbmc/control/Chassis')
+ '/org/openbmc/control/chassis0')
intf = dbus.Interface(obj, 'org.openbmc.control.Chassis' )
return intf
@@ -76,18 +76,25 @@
d = { 'manufacturer' : data }
intf_sys = Openbmc.getManagerInterface(bus,"System")
c = chr(int(ipmi_id))
- obj_info = intf_sys.getObjectFromByteId("FRU",chr(int(ipmi_id)))
+ print c
+ obj_info = intf_sys.getObjectFromByteId("FRU",c)
+ intf_name = obj_info[2]
obj_path = obj_info[1]
bus_name = obj_info[0]
if (obj_path != "" and bus_name != ""):
obj = bus.get_object(bus_name,obj_path)
- intf = dbus.Interface(obj,"org.openbmc.InventoryItem")
+ intf = dbus.Interface(obj,intf_name)
intf.update(d)
elif (cmd == "getfrus"):
- intf_fru = Openbmc.getManagerInterface(bus,"Inventory")
- data = intf_fru.getItems()
+ obj = bus.get_object('org.openbmc.managers.Inventory',
+ '/org/openbmc/inventory')
+ intf_fru = dbus.Interface(obj,'org.openbmc.Object.Enumerate')
+
+ data = intf_fru.enumerate()
for i in data:
+ print ">>>>>>>>"
+ print i
for k in data[i].keys():
print k+" = "+str(data[i][k])
elif (cmd == "updatefwftp"):
diff --git a/bin/sensor_manager.py b/bin/sensor_manager.py
index 9f3ab56..a91235e 100755
--- a/bin/sensor_manager.py
+++ b/bin/sensor_manager.py
@@ -14,7 +14,8 @@
import Openbmc
DBUS_NAME = 'org.openbmc.managers.Sensors'
-OBJ_NAME = '/org/openbmc/managers/Sensors'
+OBJ_NAME = '/org/openbmc/sensors'
+ENUM_INTF = 'org.openbmc.Object.Enumerate'
class SensorManager(dbus.service.Object):
def __init__(self,bus,name):
@@ -37,9 +38,9 @@
self.sensor_cache = {}
- @dbus.service.method(DBUS_NAME,
+ @dbus.service.method(ENUM_INTF,
in_signature='', out_signature='a{sa{sv}}')
- def getSensors(self):
+ def enumerate(self):
return self.sensor_cache;
diff --git a/bin/sensors_virtual_p8.py b/bin/sensors_virtual_p8.py
index d8bf1ef..c348e83 100755
--- a/bin/sensors_virtual_p8.py
+++ b/bin/sensors_virtual_p8.py
@@ -8,163 +8,114 @@
import dbus.mainloop.glib
import Openbmc
-SENSOR_INTERFACE = 'org.openbmc.SensorValue'
DBUS_NAME = 'org.openbmc.sensor.Power8Virtual'
-OBJ_NAME = '/org/openbmc/sensor/virtual/'
+OBJ_PATH = '/org/openbmc/sensor/virtual/'
-class BootProgress(dbus.service.Object):
- def __init__(self,bus,name):
- self.object_name = "BootProgress"
- self.value = 0
- self.units = ""
- dbus.service.Object.__init__(self,bus,name+self.object_name)
-
- @dbus.service.method(SENSOR_INTERFACE,
+class SensorValue(Openbmc.DbusProperties):
+ IFACE_NAME = 'org.openbmc.SensorValue'
+ def __init__(self):
+ Openbmc.DbusProperties.__init__(self)
+ self.Set(SensorValue.IFACE_NAME,'units',"")
+
+ @dbus.service.method(IFACE_NAME,
in_signature='v', out_signature='')
def setValue(self,value):
- if (value != self.value):
- self.value=value
- self.Changed()
+ changed = False
+ try:
+ old_value = self.Get(SensorValue.IFACE_NAME,'value')
+ if (value != old_value):
+ changed = True
+ except:
+ changed = True
- @dbus.service.method(SENSOR_INTERFACE,
+ if (changed == True):
+ self.Set(SensorValue.IFACE_NAME,'value',value)
+ self.Changed(self.getValue(),self.getUnits())
+
+
+
+ @dbus.service.method(IFACE_NAME,
in_signature='', out_signature='v')
def getValue(self):
- return self.value;
+ return self.Get(SensorValue.IFACE_NAME,'value')
- @dbus.service.method(SENSOR_INTERFACE,
+ @dbus.service.method(IFACE_NAME,
in_signature='', out_signature='s')
def getUnits(self):
- return self.units;
+ return self.Get(SensorValue.IFACE_NAME,'units')
- @dbus.service.signal(SENSOR_INTERFACE,signature='vs')
- def Changed(self,value,units):
- pass
-
-class HostStatus(dbus.service.Object):
- def __init__(self,bus,name):
- self.object_name = "HostStatus"
- self.value = 0
- self.units = ""
- dbus.service.Object.__init__(self,bus,name+self.object_name)
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='v', out_signature='')
- def setValue(self,value):
- if (value != self.value):
- self.value=value
- self.Changed(self.value,self.units)
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='v')
- def getValue(self):
- return self.value;
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='s')
- def getUnits(self):
- return self.units;
-
- @dbus.service.signal(SENSOR_INTERFACE,signature='vs')
+ @dbus.service.signal(IFACE_NAME,signature='vs')
def Changed(self,value,units):
pass
-class OsStatus(dbus.service.Object):
+class VirtualSensor(SensorValue):
def __init__(self,bus,name):
- self.object_name = "OperatingSystemStatus"
- self.value = 0
- self.units = ""
- dbus.service.Object.__init__(self,bus,name+self.object_name)
+ SensorValue.__init__(self)
+ dbus.service.Object.__init__(self,bus,name)
+
+CONTROL_IFACE = 'org.openbmc.Control'
+class HostStatusSensor(SensorValue):
+ def __init__(self,bus,name):
+ SensorValue.__init__(self)
+ dbus.service.Object.__init__(self,bus,name)
- @dbus.service.method(SENSOR_INTERFACE,
+ ##override setValue method
+ @dbus.service.method(SensorValue.IFACE_NAME,
in_signature='v', out_signature='')
def setValue(self,value):
- if (value != self.value):
- self.value=value
- self.Changed(self.value,self.units)
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='v')
- def getValue(self):
- return self.value;
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='s')
- def getUnits(self):
- return self.units;
-
- @dbus.service.signal(SENSOR_INTERFACE,signature='vs')
- def Changed(self,value,units):
+ SensorValue.setValue(self,value)
+ if (value == "BLAH"):
+ self.GotoSystemState("OS_BOOTED")
+
+ @dbus.service.signal(CONTROL_IFACE,signature='s')
+ def GotoSystemState(self,state):
pass
-class BootCount(dbus.service.Object):
+CONTROL_IFACE = 'org.openbmc.Control'
+class BootProgressSensor(SensorValue):
def __init__(self,bus,name):
- self.object_name = "BootCount"
- self.value = 0
- self.units = ""
- dbus.service.Object.__init__(self,bus,name+self.object_name)
+ SensorValue.__init__(self)
+ dbus.service.Object.__init__(self,bus,name)
- @dbus.service.method(SENSOR_INTERFACE,
+ ##override setValue method
+ @dbus.service.method(SensorValue.IFACE_NAME,
in_signature='v', out_signature='')
def setValue(self,value):
- if (value != self.value):
- self.value=value
- self.Changed(self.value,self.units)
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='v')
- def getValue(self):
- return self.value;
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='s')
- def getUnits(self):
- return self.units;
-
- @dbus.service.signal(SENSOR_INTERFACE,signature='vs')
- def Changed(self,value,units):
+ SensorValue.setValue(self,value)
+ if (value == "FW Progress, Starting OS"):
+ self.GotoSystemState("HOST_BOOTED")
+
+ @dbus.service.signal(CONTROL_IFACE,signature='s')
+ def GotoSystemState(self,state):
pass
-
-
-class OccStatus(dbus.service.Object):
- def __init__(self,bus,name):
- self.object_name = "OccStatus"
- self.value = 0
- self.units = ""
- dbus.service.Object.__init__(self,bus,name+self.object_name)
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='v', out_signature='')
- def setValue(self,value):
- if (value != self.value):
- self.value=value
- self.Changed(self.value,self.units)
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='v')
- def getValue(self):
- return self.value;
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='s')
- def getUnits(self):
- return self.units;
- @dbus.service.signal(SENSOR_INTERFACE,signature='vs')
- def Changed(self,value,units):
- pass
+
if __name__ == '__main__':
- dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
- bus = Openbmc.getDBus()
- name = dbus.service.BusName(DBUS_NAME,bus)
- boot_progress = BootProgress(bus,OBJ_NAME)
- host_status = HostStatus(bus,OBJ_NAME)
- os_status = OsStatus(bus,OBJ_NAME)
- boot_count = BootCount(bus,OBJ_NAME)
- occ_status = OccStatus(bus,OBJ_NAME)
- mainloop = gobject.MainLoop()
+
+ sensors = {
+ 'OperatingSystemStatus' : None,
+ 'BootCount' : None,
+ 'OccStatus' : None,
+ }
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+ bus = Openbmc.getDBus()
+ name = dbus.service.BusName(DBUS_NAME,bus)
+ for instance in sensors.keys():
+ sensors[instance]= VirtualSensor(bus,OBJ_PATH+instance)
- print "Starting virtual sensors"
- mainloop.run()
+ sensors['HostStatus'] = HostStatusSensor(bus,OBJ_PATH+"HostStatus")
+ sensors['BootProgress'] = BootProgressSensor(bus,OBJ_PATH+"BootProgress")
+ mainloop = gobject.MainLoop()
+
+ ## Initialize sensors
+ sensors['BootProgress'].setValue("INACTIVE")
+ sensors['HostStatus'].setValue("OFF")
+ sensors['OperatingSystemStatus'].setValue("OFF")
+ sensors['BootCount'].setValue(0)
+ sensors['OccStatus'].setValue(0)
+
+ print "Starting virtual sensors"
+ mainloop.run()
diff --git a/bin/system_manager.py b/bin/system_manager.py
index 17285b2..7f94578 100755
--- a/bin/system_manager.py
+++ b/bin/system_manager.py
@@ -25,7 +25,7 @@
STATE_START_TIMEOUT = 10
INTF_SENSOR = 'org.openbmc.SensorValue'
INTF_ITEM = 'org.openbmc.InventoryItem'
-
+INTF_CONTROL = 'org.openbmc.Control'
class SystemManager(dbus.service.Object):
def __init__(self,bus,name):
@@ -41,7 +41,6 @@
self.current_state = ""
self.system_states = {}
self.bus_name_lookup = {}
-
self.bin_path = os.path.dirname(os.path.realpath(sys.argv[0]))
for bus_name in System.SYSTEM_CONFIG.keys():
@@ -57,9 +56,10 @@
new_val = val.replace("<inventory_root>",System.INVENTORY_ROOT)
System.ID_LOOKUP[category][key] = new_val
- self.SystemStateHandler("INIT")
+ self.SystemStateHandler(System.SYSTEM_STATES[0])
print "SystemManager Init Done"
+
def SystemStateHandler(self,state_name):
print "Checking previous state started..."
i = 0
@@ -72,27 +72,53 @@
if (i == STATE_START_TIMEOUT):
print "ERROR: Timeout waiting for state to finish: "+self.current_state
return
+
+ ## clearing object started flags
+ try:
+ for obj_path in System.EXIT_STATE_DEPEND[self.current_state]:
+ System.EXIT_STATE_DEPEND[self.current_state][obj_path] = 0
+ except:
+ pass
print "Running System State: "+state_name
if (self.system_states.has_key(state_name)):
for bus_name in self.system_states[state_name]:
self.start_process(bus_name)
- if (state_name == "INIT"):
+ if (state_name == "BMC_INIT"):
## Add poll for heartbeat
gobject.timeout_add(HEARTBEAT_CHECK_INTERVAL, self.heartbeat_check)
- if (System.ENTER_STATE_CALLBACK.has_key(state_name)):
+ try:
cb = System.ENTER_STATE_CALLBACK[state_name]
obj = bus.get_object(cb['bus_name'],cb['obj_name'])
method = obj.get_dbus_method(cb['method_name'],cb['interface_name'])
method()
+ except:
+ pass
self.current_state = state_name
-
+
+ def gotoNextState(self):
+ s = 0
+ for i in range(len(System.SYSTEM_STATES)):
+ if (System.SYSTEM_STATES[i] == self.current_state):
+ s = i+1
+
+ if (s == len(System.SYSTEM_STATES)):
+ print "ERROR SystemManager: No more system states"
+ else:
+ new_state_name = System.SYSTEM_STATES[s]
+ print "SystemManager Goto System State: "+new_state_name
+ self.SystemStateHandler(new_state_name)
+
+
@dbus.service.method(DBUS_NAME,
- in_signature='ss', out_signature='(sss)')
- def getObjectFromId(self,category,key):
+ in_signature='', out_signature='s')
+ def getSystemState(self):
+ return self.current_state
+
+ def doObjectLookup(self,category,key):
bus_name = ""
obj_path = ""
intf_name = INTF_ITEM
@@ -100,32 +126,23 @@
obj_path = System.ID_LOOKUP[category][key]
bus_name = self.bus_name_lookup[obj_path]
parts = obj_path.split('/')
- if (parts[2] == 'sensor'):
+ if (parts[3] == 'sensor'):
intf_name = INTF_SENSOR
except Exception as e:
print "ERROR SystemManager: "+str(e)+" not found in lookup"
return [bus_name,obj_path,intf_name]
+ @dbus.service.method(DBUS_NAME,
+ in_signature='ss', out_signature='(sss)')
+ def getObjectFromId(self,category,key):
+ return self.doObjectLookup(category,key)
@dbus.service.method(DBUS_NAME,
in_signature='sy', out_signature='(sss)')
def getObjectFromByteId(self,category,key):
- bus_name = ""
- obj_path = ""
- intf_name = INTF_ITEM
- try:
- byte = int(key)
- obj_path = System.ID_LOOKUP[category][byte]
- bus_name = self.bus_name_lookup[obj_path]
- parts = obj_path.split('/')
- if (parts[2] == 'sensor'):
- intf_name = INTF_SENSOR
- except Exception as e:
- print "ERROR SystemManager: "+str(e)+" not found in lookup"
-
- return [bus_name,obj_path,intf_name]
-
+ byte = int(key)
+ return self.doObjectLookup(category,byte)
def start_process(self,bus_name):
if (System.SYSTEM_CONFIG[bus_name]['start_process'] == True):
@@ -168,19 +185,21 @@
break;
return r
-
def NewBusHandler(self, bus_name, a, b):
if (len(b) > 0 and bus_name.find(Openbmc.BUS_PREFIX) == 0):
objects = {}
try:
Openbmc.get_objs(bus,bus_name,"",objects)
for instance_name in objects.keys():
- self.bus_name_lookup[objects[instance_name]['PATH']] = bus_name
+ obj_path = objects[instance_name]['PATH']
+ self.bus_name_lookup[obj_path] = bus_name
+ if (System.EXIT_STATE_DEPEND[self.current_state].has_key(obj_path) == True):
+ System.EXIT_STATE_DEPEND[self.current_state][obj_path] = 1
+
except:
pass
-
+
if (System.SYSTEM_CONFIG.has_key(bus_name)):
- System.SYSTEM_CONFIG[bus_name]['heartbeat_count'] = 0
for instance_name in objects.keys():
obj_path = objects[instance_name]['PATH']
for instance in System.SYSTEM_CONFIG[bus_name]['instances']:
@@ -195,6 +214,19 @@
print "Calling init method: " +obj_path+" : "+init_intf
intf.init()
+ ## check if all objects are started to move to next state
+ try:
+ state = 1
+ for obj_path in System.EXIT_STATE_DEPEND[self.current_state]:
+ if (System.EXIT_STATE_DEPEND[self.current_state][obj_path] == 0):
+ state = 0
+ ## all required objects have started so go to next state
+ if (state == 1):
+ self.gotoNextState()
+ except:
+ pass
+
+
@dbus.service.method(DBUS_NAME,
in_signature='s', out_signature='sis')
diff --git a/interfaces/openbmc_intf.c b/interfaces/openbmc_intf.c
index 1e163d5..cf60578 100644
--- a/interfaces/openbmc_intf.c
+++ b/interfaces/openbmc_intf.c
@@ -149,6 +149,7 @@
}
/* ------------------------------------------------------------------------
+<<<<<<< HEAD
* Code for interface org.openbmc.Occ
* ------------------------------------------------------------------------
*/
@@ -1679,6 +1680,8 @@
}
/* ------------------------------------------------------------------------
+=======
+>>>>>>> upstream/master
* Code for interface org.openbmc.Fan
* ------------------------------------------------------------------------
*/
@@ -12491,10 +12494,22 @@
"goto-system-state"
};
+static const _ExtendedGDBusSignalInfo _control_signal_info_started =
+{
+ {
+ -1,
+ (gchar *) "Started",
+ NULL,
+ NULL
+ },
+ "started"
+};
+
static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
{
&_control_signal_info_heartbeat,
&_control_signal_info_goto_system_state,
+ &_control_signal_info_started,
NULL
};
@@ -12592,6 +12607,7 @@
* @get_poll_interval: Getter for the #Control:poll-interval property.
* @goto_system_state: Handler for the #Control::goto-system-state signal.
* @heartbeat: Handler for the #Control::heartbeat signal.
+ * @started: Handler for the #Control::started signal.
*
* Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
*/
@@ -12664,6 +12680,24 @@
G_TYPE_NONE,
1, G_TYPE_STRING);
+ /**
+ * Control::started:
+ * @object: A #Control.
+ *
+ * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> is received.
+ *
+ * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
+ */
+ g_signal_new ("started",
+ G_TYPE_FROM_INTERFACE (iface),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ControlIface, started),
+ NULL,
+ NULL,
+ g_cclosure_marshal_generic,
+ G_TYPE_NONE,
+ 0);
+
/* GObject properties for D-Bus properties: */
/**
* Control:poll-interval:
@@ -12778,6 +12812,19 @@
}
/**
+ * control_emit_started:
+ * @object: A #Control.
+ *
+ * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> D-Bus signal.
+ */
+void
+control_emit_started (
+ Control *object)
+{
+ g_signal_emit_by_name (object, "started");
+}
+
+/**
* control_call_init:
* @proxy: A #ControlProxy.
* @cancellable: (allow-none): A #GCancellable or %NULL.
@@ -13591,6 +13638,28 @@
g_list_free_full (connections, g_object_unref);
}
+static void
+_control_on_signal_started (
+ Control *object)
+{
+ ControlSkeleton *skeleton = CONTROL_SKELETON (object);
+
+ GList *connections, *l;
+ GVariant *signal_variant;
+ connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
+
+ signal_variant = g_variant_ref_sink (g_variant_new ("()"));
+ for (l = connections; l != NULL; l = l->next)
+ {
+ GDBusConnection *connection = l->data;
+ g_dbus_connection_emit_signal (connection,
+ NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Started",
+ signal_variant, NULL);
+ }
+ g_variant_unref (signal_variant);
+ g_list_free_full (connections, g_object_unref);
+}
+
static void control_skeleton_iface_init (ControlIface *iface);
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
@@ -13826,6 +13895,7 @@
{
iface->heartbeat = _control_on_signal_heartbeat;
iface->goto_system_state = _control_on_signal_goto_system_state;
+ iface->started = _control_on_signal_started;
iface->get_poll_interval = control_skeleton_get_poll_interval;
iface->get_heatbeat = control_skeleton_get_heatbeat;
}
@@ -28677,15 +28747,6 @@
object_default_init (ObjectIface *iface)
{
/**
- * Object:occ:
- *
- * The #Occ instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>, if any.
- *
- * Connect to the #GObject::notify signal to get informed of property changes.
- */
- g_object_interface_install_property (iface, g_param_spec_object ("occ", "occ", "occ", TYPE_OCC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
-
- /**
* Object:fan:
*
* The #Fan instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>, if any.
@@ -28850,23 +28911,6 @@
}
/**
- * object_get_occ:
- * @object: A #Object.
- *
- * Gets the #Occ instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> on @object, if any.
- *
- * Returns: (transfer full): A #Occ that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
- */
-Occ *object_get_occ (Object *object)
-{
- GDBusInterface *ret;
- ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
- if (ret == NULL)
- return NULL;
- return OCC (ret);
-}
-
-/**
* object_get_fan:
* @object: A #Object.
*
@@ -29174,26 +29218,6 @@
/**
- * object_peek_occ: (skip)
- * @object: A #Object.
- *
- * Like object_get_occ() but doesn't increase the reference count on the returned object.
- *
- * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>
- *
- * Returns: (transfer none): A #Occ or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
- */
-Occ *object_peek_occ (Object *object)
-{
- GDBusInterface *ret;
- ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
- if (ret == NULL)
- return NULL;
- g_object_unref (ret);
- return OCC (ret);
-}
-
-/**
* object_peek_fan: (skip)
* @object: A #Object.
*
@@ -29621,96 +29645,91 @@
switch (prop_id)
{
case 1:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
- g_value_take_object (value, interface);
- break;
-
- case 2:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
g_value_take_object (value, interface);
break;
- case 3:
+ case 2:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
g_value_take_object (value, interface);
break;
- case 4:
+ case 3:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
g_value_take_object (value, interface);
break;
- case 5:
+ case 4:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
g_value_take_object (value, interface);
break;
- case 6:
+ case 5:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
g_value_take_object (value, interface);
break;
- case 7:
+ case 6:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
g_value_take_object (value, interface);
break;
- case 8:
+ case 7:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
g_value_take_object (value, interface);
break;
- case 9:
+ case 8:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
g_value_take_object (value, interface);
break;
- case 10:
+ case 9:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
g_value_take_object (value, interface);
break;
- case 11:
+ case 10:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
g_value_take_object (value, interface);
break;
- case 12:
+ case 11:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
g_value_take_object (value, interface);
break;
- case 13:
+ case 12:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
g_value_take_object (value, interface);
break;
- case 14:
+ case 13:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
g_value_take_object (value, interface);
break;
- case 15:
+ case 14:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
g_value_take_object (value, interface);
break;
- case 16:
+ case 15:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
g_value_take_object (value, interface);
break;
- case 17:
+ case 16:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
g_value_take_object (value, interface);
break;
- case 18:
+ case 17:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
g_value_take_object (value, interface);
break;
- case 19:
+ case 18:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
g_value_take_object (value, interface);
break;
@@ -29729,25 +29748,24 @@
gobject_class->set_property = object_proxy_set_property;
gobject_class->get_property = object_proxy_get_property;
- g_object_class_override_property (gobject_class, 1, "occ");
- g_object_class_override_property (gobject_class, 2, "fan");
- g_object_class_override_property (gobject_class, 3, "sensor-value");
- g_object_class_override_property (gobject_class, 4, "sensor-threshold");
- g_object_class_override_property (gobject_class, 5, "sensor-i2c");
- g_object_class_override_property (gobject_class, 6, "sensor-match");
- g_object_class_override_property (gobject_class, 7, "process");
- g_object_class_override_property (gobject_class, 8, "shared-resource");
- g_object_class_override_property (gobject_class, 9, "control");
- g_object_class_override_property (gobject_class, 10, "control-bmc");
- g_object_class_override_property (gobject_class, 11, "control-host");
- g_object_class_override_property (gobject_class, 12, "control-power");
- g_object_class_override_property (gobject_class, 13, "watchdog");
- g_object_class_override_property (gobject_class, 14, "event-log");
- g_object_class_override_property (gobject_class, 15, "flash");
- g_object_class_override_property (gobject_class, 16, "flash-control");
- g_object_class_override_property (gobject_class, 17, "button");
- g_object_class_override_property (gobject_class, 18, "led");
- g_object_class_override_property (gobject_class, 19, "host-ipmi");
+ g_object_class_override_property (gobject_class, 1, "fan");
+ g_object_class_override_property (gobject_class, 2, "sensor-value");
+ g_object_class_override_property (gobject_class, 3, "sensor-threshold");
+ g_object_class_override_property (gobject_class, 4, "sensor-i2c");
+ g_object_class_override_property (gobject_class, 5, "sensor-match");
+ g_object_class_override_property (gobject_class, 6, "process");
+ g_object_class_override_property (gobject_class, 7, "shared-resource");
+ g_object_class_override_property (gobject_class, 8, "control");
+ g_object_class_override_property (gobject_class, 9, "control-bmc");
+ g_object_class_override_property (gobject_class, 10, "control-host");
+ g_object_class_override_property (gobject_class, 11, "control-power");
+ g_object_class_override_property (gobject_class, 12, "watchdog");
+ g_object_class_override_property (gobject_class, 13, "event-log");
+ g_object_class_override_property (gobject_class, 14, "flash");
+ g_object_class_override_property (gobject_class, 15, "flash-control");
+ g_object_class_override_property (gobject_class, 16, "button");
+ g_object_class_override_property (gobject_class, 17, "led");
+ g_object_class_override_property (gobject_class, 18, "host-ipmi");
}
/**
@@ -29818,19 +29836,6 @@
interface = g_value_get_object (value);
if (interface != NULL)
{
- g_warn_if_fail (IS_OCC (interface));
- g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
- }
- else
- {
- g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Occ");
- }
- break;
-
- case 2:
- interface = g_value_get_object (value);
- if (interface != NULL)
- {
g_warn_if_fail (IS_FAN (interface));
g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
}
@@ -29840,7 +29845,7 @@
}
break;
- case 3:
+ case 2:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29853,7 +29858,7 @@
}
break;
- case 4:
+ case 3:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29866,7 +29871,7 @@
}
break;
- case 5:
+ case 4:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29879,7 +29884,7 @@
}
break;
- case 6:
+ case 5:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29892,7 +29897,7 @@
}
break;
- case 7:
+ case 6:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29905,7 +29910,7 @@
}
break;
- case 8:
+ case 7:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29918,7 +29923,7 @@
}
break;
- case 9:
+ case 8:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29931,7 +29936,7 @@
}
break;
- case 10:
+ case 9:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29944,7 +29949,7 @@
}
break;
- case 11:
+ case 10:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29957,7 +29962,7 @@
}
break;
- case 12:
+ case 11:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29970,7 +29975,7 @@
}
break;
- case 13:
+ case 12:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29983,7 +29988,7 @@
}
break;
- case 14:
+ case 13:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29996,7 +30001,7 @@
}
break;
- case 15:
+ case 14:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -30009,7 +30014,7 @@
}
break;
- case 16:
+ case 15:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -30022,7 +30027,7 @@
}
break;
- case 17:
+ case 16:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -30035,7 +30040,7 @@
}
break;
- case 18:
+ case 17:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -30048,7 +30053,7 @@
}
break;
- case 19:
+ case 18:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -30079,96 +30084,91 @@
switch (prop_id)
{
case 1:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
- g_value_take_object (value, interface);
- break;
-
- case 2:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
g_value_take_object (value, interface);
break;
- case 3:
+ case 2:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
g_value_take_object (value, interface);
break;
- case 4:
+ case 3:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
g_value_take_object (value, interface);
break;
- case 5:
+ case 4:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
g_value_take_object (value, interface);
break;
- case 6:
+ case 5:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
g_value_take_object (value, interface);
break;
- case 7:
+ case 6:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
g_value_take_object (value, interface);
break;
- case 8:
+ case 7:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
g_value_take_object (value, interface);
break;
- case 9:
+ case 8:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
g_value_take_object (value, interface);
break;
- case 10:
+ case 9:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
g_value_take_object (value, interface);
break;
- case 11:
+ case 10:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
g_value_take_object (value, interface);
break;
- case 12:
+ case 11:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
g_value_take_object (value, interface);
break;
- case 13:
+ case 12:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
g_value_take_object (value, interface);
break;
- case 14:
+ case 13:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
g_value_take_object (value, interface);
break;
- case 15:
+ case 14:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
g_value_take_object (value, interface);
break;
- case 16:
+ case 15:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
g_value_take_object (value, interface);
break;
- case 17:
+ case 16:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
g_value_take_object (value, interface);
break;
- case 18:
+ case 17:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
g_value_take_object (value, interface);
break;
- case 19:
+ case 18:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
g_value_take_object (value, interface);
break;
@@ -30187,25 +30187,24 @@
gobject_class->set_property = object_skeleton_set_property;
gobject_class->get_property = object_skeleton_get_property;
- g_object_class_override_property (gobject_class, 1, "occ");
- g_object_class_override_property (gobject_class, 2, "fan");
- g_object_class_override_property (gobject_class, 3, "sensor-value");
- g_object_class_override_property (gobject_class, 4, "sensor-threshold");
- g_object_class_override_property (gobject_class, 5, "sensor-i2c");
- g_object_class_override_property (gobject_class, 6, "sensor-match");
- g_object_class_override_property (gobject_class, 7, "process");
- g_object_class_override_property (gobject_class, 8, "shared-resource");
- g_object_class_override_property (gobject_class, 9, "control");
- g_object_class_override_property (gobject_class, 10, "control-bmc");
- g_object_class_override_property (gobject_class, 11, "control-host");
- g_object_class_override_property (gobject_class, 12, "control-power");
- g_object_class_override_property (gobject_class, 13, "watchdog");
- g_object_class_override_property (gobject_class, 14, "event-log");
- g_object_class_override_property (gobject_class, 15, "flash");
- g_object_class_override_property (gobject_class, 16, "flash-control");
- g_object_class_override_property (gobject_class, 17, "button");
- g_object_class_override_property (gobject_class, 18, "led");
- g_object_class_override_property (gobject_class, 19, "host-ipmi");
+ g_object_class_override_property (gobject_class, 1, "fan");
+ g_object_class_override_property (gobject_class, 2, "sensor-value");
+ g_object_class_override_property (gobject_class, 3, "sensor-threshold");
+ g_object_class_override_property (gobject_class, 4, "sensor-i2c");
+ g_object_class_override_property (gobject_class, 5, "sensor-match");
+ g_object_class_override_property (gobject_class, 6, "process");
+ g_object_class_override_property (gobject_class, 7, "shared-resource");
+ g_object_class_override_property (gobject_class, 8, "control");
+ g_object_class_override_property (gobject_class, 9, "control-bmc");
+ g_object_class_override_property (gobject_class, 10, "control-host");
+ g_object_class_override_property (gobject_class, 11, "control-power");
+ g_object_class_override_property (gobject_class, 12, "watchdog");
+ g_object_class_override_property (gobject_class, 13, "event-log");
+ g_object_class_override_property (gobject_class, 14, "flash");
+ g_object_class_override_property (gobject_class, 15, "flash-control");
+ g_object_class_override_property (gobject_class, 16, "button");
+ g_object_class_override_property (gobject_class, 17, "led");
+ g_object_class_override_property (gobject_class, 18, "host-ipmi");
}
/**
@@ -30224,18 +30223,6 @@
}
/**
- * object_skeleton_set_occ:
- * @object: A #ObjectSkeleton.
- * @interface_: (allow-none): A #Occ or %NULL to clear the interface.
- *
- * Sets the #Occ instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> on @object.
- */
-void object_skeleton_set_occ (ObjectSkeleton *object, Occ *interface_)
-{
- g_object_set (G_OBJECT (object), "occ", interface_, NULL);
-}
-
-/**
* object_skeleton_set_fan:
* @object: A #ObjectSkeleton.
* @interface_: (allow-none): A #Fan or %NULL to clear the interface.
@@ -30513,7 +30500,6 @@
if (g_once_init_enter (&once_init_value))
{
lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
- g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Occ", GSIZE_TO_POINTER (TYPE_OCC_PROXY));
g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
diff --git a/interfaces/openbmc_intf.h b/interfaces/openbmc_intf.h
index db435fd..c8d251d 100644
--- a/interfaces/openbmc_intf.h
+++ b/interfaces/openbmc_intf.h
@@ -13,200 +13,6 @@
/* ------------------------------------------------------------------------ */
-/* Declarations for org.openbmc.Occ */
-
-#define TYPE_OCC (occ_get_type ())
-#define OCC(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OCC, Occ))
-#define IS_OCC(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OCC))
-#define OCC_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_OCC, OccIface))
-
-struct _Occ;
-typedef struct _Occ Occ;
-typedef struct _OccIface OccIface;
-
-struct _OccIface
-{
- GTypeInterface parent_iface;
-
-
- gboolean (*handle_collect) (
- Occ *object,
- GDBusMethodInvocation *invocation);
-
- gboolean (*handle_init) (
- Occ *object,
- GDBusMethodInvocation *invocation);
-
- const gchar * (*get_instance_name) (Occ *object);
-
- gint (*get_poll_interval) (Occ *object);
-
- const gchar * (*get_state) (Occ *object);
-
-};
-
-GType occ_get_type (void) G_GNUC_CONST;
-
-GDBusInterfaceInfo *occ_interface_info (void);
-guint occ_override_properties (GObjectClass *klass, guint property_id_begin);
-
-
-/* D-Bus method call completion functions: */
-void occ_complete_init (
- Occ *object,
- GDBusMethodInvocation *invocation);
-
-void occ_complete_collect (
- Occ *object,
- GDBusMethodInvocation *invocation);
-
-
-
-/* D-Bus method calls: */
-void occ_call_init (
- Occ *proxy,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-gboolean occ_call_init_finish (
- Occ *proxy,
- GAsyncResult *res,
- GError **error);
-
-gboolean occ_call_init_sync (
- Occ *proxy,
- GCancellable *cancellable,
- GError **error);
-
-void occ_call_collect (
- Occ *proxy,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-gboolean occ_call_collect_finish (
- Occ *proxy,
- GAsyncResult *res,
- GError **error);
-
-gboolean occ_call_collect_sync (
- Occ *proxy,
- GCancellable *cancellable,
- GError **error);
-
-
-
-/* D-Bus property accessors: */
-const gchar *occ_get_state (Occ *object);
-gchar *occ_dup_state (Occ *object);
-void occ_set_state (Occ *object, const gchar *value);
-
-const gchar *occ_get_instance_name (Occ *object);
-gchar *occ_dup_instance_name (Occ *object);
-void occ_set_instance_name (Occ *object, const gchar *value);
-
-gint occ_get_poll_interval (Occ *object);
-void occ_set_poll_interval (Occ *object, gint value);
-
-
-/* ---- */
-
-#define TYPE_OCC_PROXY (occ_proxy_get_type ())
-#define OCC_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OCC_PROXY, OccProxy))
-#define OCC_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OCC_PROXY, OccProxyClass))
-#define OCC_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OCC_PROXY, OccProxyClass))
-#define IS_OCC_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OCC_PROXY))
-#define IS_OCC_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OCC_PROXY))
-
-typedef struct _OccProxy OccProxy;
-typedef struct _OccProxyClass OccProxyClass;
-typedef struct _OccProxyPrivate OccProxyPrivate;
-
-struct _OccProxy
-{
- /*< private >*/
- GDBusProxy parent_instance;
- OccProxyPrivate *priv;
-};
-
-struct _OccProxyClass
-{
- GDBusProxyClass parent_class;
-};
-
-GType occ_proxy_get_type (void) G_GNUC_CONST;
-
-void occ_proxy_new (
- GDBusConnection *connection,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-Occ *occ_proxy_new_finish (
- GAsyncResult *res,
- GError **error);
-Occ *occ_proxy_new_sync (
- GDBusConnection *connection,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GError **error);
-
-void occ_proxy_new_for_bus (
- GBusType bus_type,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-Occ *occ_proxy_new_for_bus_finish (
- GAsyncResult *res,
- GError **error);
-Occ *occ_proxy_new_for_bus_sync (
- GBusType bus_type,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GError **error);
-
-
-/* ---- */
-
-#define TYPE_OCC_SKELETON (occ_skeleton_get_type ())
-#define OCC_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OCC_SKELETON, OccSkeleton))
-#define OCC_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OCC_SKELETON, OccSkeletonClass))
-#define OCC_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OCC_SKELETON, OccSkeletonClass))
-#define IS_OCC_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OCC_SKELETON))
-#define IS_OCC_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OCC_SKELETON))
-
-typedef struct _OccSkeleton OccSkeleton;
-typedef struct _OccSkeletonClass OccSkeletonClass;
-typedef struct _OccSkeletonPrivate OccSkeletonPrivate;
-
-struct _OccSkeleton
-{
- /*< private >*/
- GDBusInterfaceSkeleton parent_instance;
- OccSkeletonPrivate *priv;
-};
-
-struct _OccSkeletonClass
-{
- GDBusInterfaceSkeletonClass parent_class;
-};
-
-GType occ_skeleton_get_type (void) G_GNUC_CONST;
-
-Occ *occ_skeleton_new (void);
-
-
-/* ------------------------------------------------------------------------ */
/* Declarations for org.openbmc.Fan */
#define TYPE_FAN (fan_get_type ())
@@ -1602,6 +1408,9 @@
Control *object,
const gchar *arg_bus_name);
+ void (*started) (
+ Control *object);
+
};
GType control_get_type (void) G_GNUC_CONST;
@@ -1626,6 +1435,9 @@
Control *object,
const gchar *arg_state_name);
+void control_emit_started (
+ Control *object);
+
/* D-Bus method calls: */
@@ -3863,7 +3675,6 @@
GType object_get_type (void) G_GNUC_CONST;
-Occ *object_get_occ (Object *object);
Fan *object_get_fan (Object *object);
SensorValue *object_get_sensor_value (Object *object);
SensorThreshold *object_get_sensor_threshold (Object *object);
@@ -3882,7 +3693,6 @@
Button *object_get_button (Object *object);
Led *object_get_led (Object *object);
HostIpmi *object_get_host_ipmi (Object *object);
-Occ *object_peek_occ (Object *object);
Fan *object_peek_fan (Object *object);
SensorValue *object_peek_sensor_value (Object *object);
SensorThreshold *object_peek_sensor_threshold (Object *object);
@@ -3953,7 +3763,6 @@
GType object_skeleton_get_type (void) G_GNUC_CONST;
ObjectSkeleton *object_skeleton_new (const gchar *object_path);
-void object_skeleton_set_occ (ObjectSkeleton *object, Occ *interface_);
void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_);
void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_);
void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_);
diff --git a/objects/control_bmc_obj.c b/objects/control_bmc_obj.c
index 4355f63..caba185 100644
--- a/objects/control_bmc_obj.c
+++ b/objects/control_bmc_obj.c
@@ -108,7 +108,7 @@
reg_init();
#endif
control_complete_init(control,invocation);
- control_emit_goto_system_state(control,"STANDBY");
+ control_emit_goto_system_state(control,"BMC_STARTING");
return TRUE;
}
diff --git a/objects/control_host_obj.c b/objects/control_host_obj.c
index 9f6fb92..d051f88 100644
--- a/objects/control_host_obj.c
+++ b/objects/control_host_obj.c
@@ -91,7 +91,7 @@
gpio_close(&fsi_enable);
gpio_close(&cronus_sel);
- control_emit_goto_system_state(control,"BOOTING");
+ control_emit_goto_system_state(control,"HOST_BOOTING");
control_host_emit_booted(host);
return TRUE;
diff --git a/objects/flash_bios_obj.c b/objects/flash_bios_obj.c
index 928d11b..ebc71aa 100644
--- a/objects/flash_bios_obj.c
+++ b/objects/flash_bios_obj.c
@@ -24,10 +24,10 @@
const gchar* name = flash_get_flasher_name(flash);
const gchar* inst = flash_get_flasher_instance(flash);
const gchar* filename = flash_get_filename(flash);
-
status = execl(path, name, inst, filename, NULL);
+ return status;
}
- return status;
+ return 0;
}
static gboolean
@@ -53,9 +53,18 @@
gchar* name,
gpointer user_data)
{
- printf("Locking BIOS Flash: %s\n",name);
- shared_resource_set_lock(lock,true);
- shared_resource_set_name(lock,name);
+ gboolean locked = shared_resource_get_lock(lock);
+ if (locked)
+ {
+ const gchar* name = shared_resource_get_name(lock);
+ printf("ERROR: BIOS Flash is already locked: %s\n",name);
+ }
+ else
+ {
+ printf("Locking BIOS Flash: %s\n",name);
+ shared_resource_set_lock(lock,true);
+ shared_resource_set_name(lock,name);
+ }
shared_resource_complete_lock(lock,invocation);
return TRUE;
}
@@ -347,7 +356,7 @@
object,
NULL );
g_free(s);
- s = g_strdup_printf ("/org/openbmc/control/%s\0",cmd->argv[i]);
+ s = g_strdup_printf ("/org/openbmc/control/%s",cmd->argv[i]);
g_dbus_connection_signal_subscribe(connection,
NULL,
"org.openbmc.FlashControl",
diff --git a/objects/chassis_identify_obj.c b/objects/led_controller.c
similarity index 77%
rename from objects/chassis_identify_obj.c
rename to objects/led_controller.c
index 1206d17..b4cd04d 100644
--- a/objects/chassis_identify_obj.c
+++ b/objects/led_controller.c
@@ -4,12 +4,18 @@
#include "gpio.h"
/* ---------------------------------------------------------------------------------------------------- */
-static const gchar* dbus_object_path = "/org/openbmc/leds";
-static const gchar* dbus_name = "org.openbmc.leds.ChassisIdentify";
+static const gchar* dbus_object_path = "/org/openbmc/control/led";
+static const gchar* dbus_name = "org.openbmc.control.led";
static GDBusObjectManagerServer *manager = NULL;
-GPIO led_gpio = (GPIO){"IDENTIFY"};
+#define NUM_GPIO 2
+
+GPIO led_gpio[NUM_GPIO] = {
+ (GPIO){"IDENTIFY"},
+ (GPIO){"BMC_READY"}
+};
+
static gboolean
on_set_on (Led *led,
@@ -17,18 +23,19 @@
gpointer user_data)
{
printf("Turn on chassis identify led\n");
+ GPIO* mygpio = (GPIO*)user_data;
led_complete_set_on(led,invocation);
int rc = GPIO_OK;
do {
- rc = gpio_open(&led_gpio);
+ rc = gpio_open(mygpio);
if (rc != GPIO_OK) { break; }
- rc = gpio_write(&led_gpio,1);
+ rc = gpio_write(mygpio,1);
if (rc != GPIO_OK) { break; }
} while(0);
- gpio_close(&led_gpio);
+ gpio_close(mygpio);
if (rc != GPIO_OK)
{
- printf("ERROR ChassisIdentify: GPIO error %s (rc=%d)\n",led_gpio.name,rc);
+ printf("ERROR ledcontrol: GPIO error %s (rc=%d)\n",mygpio->name,rc);
}
return TRUE;
@@ -41,18 +48,19 @@
gpointer user_data)
{
g_print("Turn off chassis identify led\n");
+ GPIO* mygpio = (GPIO*)user_data;
led_complete_set_off(led,invocation);
int rc = GPIO_OK;
do {
- rc = gpio_open(&led_gpio);
+ rc = gpio_open(mygpio);
if (rc != GPIO_OK) { break; }
- rc = gpio_write(&led_gpio,0);
+ rc = gpio_write(mygpio,0);
if (rc != GPIO_OK) { break; }
} while(0);
- gpio_close(&led_gpio);
+ gpio_close(mygpio);
if (rc != GPIO_OK)
{
- printf("ERROR ChassisIdentify: GPIO error %s (rc=%d)\n",led_gpio.name,rc);
+ printf("ERROR ChassisIdentify: GPIO error %s (rc=%d)\n",mygpio->name,rc);
}
return TRUE;
}
@@ -73,10 +81,10 @@
manager = g_dbus_object_manager_server_new (dbus_object_path);
int i = 0;
- for (i=1;i<cmd->argc;i++)
+ for (i=0;i<NUM_GPIO;i++)
{
gchar *s;
- s = g_strdup_printf ("%s/%s",dbus_object_path,cmd->argv[i]);
+ s = g_strdup_printf ("%s/%s",dbus_object_path,led_gpio[i].name);
object = object_skeleton_new (s);
g_free (s);
@@ -88,22 +96,22 @@
g_signal_connect (led,
"handle-set-on",
G_CALLBACK (on_set_on),
- NULL); /* user_data */
+ &led_gpio[i]); /* user_data */
g_signal_connect (led,
"handle-set-off",
G_CALLBACK (on_set_off),
- NULL);
+ &led_gpio[i]);
led_set_color(led,0);
- led_set_function(led,"CHASSIS_IDENTIFY");
+ led_set_function(led,led_gpio[i].name);
+ gpio_init(connection,&led_gpio[i]);
/* Export the object (@manager takes its own reference to @object) */
g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
g_object_unref (object);
}
/* Export all objects */
g_dbus_object_manager_server_set_connection (manager, connection);
- gpio_init(connection,&led_gpio);
}
diff --git a/objects/pcie_slot_present_obj.c b/objects/pcie_slot_present_obj.c
index cceb637..f1f882b 100644
--- a/objects/pcie_slot_present_obj.c
+++ b/objects/pcie_slot_present_obj.c
@@ -2,6 +2,7 @@
#include "openbmc.h"
#include <stdio.h>
#include <stdbool.h>
+#include <string.h>
#include "gpio.h"
#define NUM_SLOTS 4
@@ -48,7 +49,7 @@
g_variant_get(v_result,"(sss)",&obj_info->bus_name,&obj_info->path,&obj_info->intf_name);
int rc=0;
- if (strcmp(obj_info->bus_name,"") == 0) {
+ if (strlen(obj_info->bus_name) == 0) {
rc = 1;
}
g_variant_unref(v_result);
@@ -78,7 +79,7 @@
return rc;
}
-void update_fru_obj(GDBusConnection* connection, object_info* obj_info, bool present)
+void update_fru_obj(GDBusConnection* connection, object_info* obj_info, const char* present)
{
GDBusProxy *proxy;
GError *error;
@@ -97,7 +98,7 @@
g_assert_no_error (error);
error = NULL;
- parm = g_variant_new("(b)",present);
+ parm = g_variant_new("(s)",present);
result = g_dbus_proxy_call_sync (proxy,
"setPresent",
@@ -142,15 +143,18 @@
{
object_info obj_info;
uint8_t present;
- bool b_present=false;
+ char* chr_present;
do {
rc = get_object(sys_proxy,&slots[i],&obj_info);
if (rc) { break; }
rc = get_presence(c,&slots[i],&present);
- if (present==1) { b_present=true; }
//if (rc) { break; }
// TODO: send correct state
- update_fru_obj(c,&obj_info,b_present);
+ if (present == 1) {
+ update_fru_obj(c,&obj_info,"PRESENT");
+ } else {
+ update_fru_obj(c,&obj_info,"NOT PRESENT");
+ }
} while(0);
}
diff --git a/objects/power_control_obj.c b/objects/power_control_obj.c
index a943b5e..bdb7c9a 100644
--- a/objects/power_control_obj.c
+++ b/objects/power_control_obj.c
@@ -64,16 +64,18 @@
if (gpio==0)
{
control_power_emit_power_lost(control_power);
- control_emit_goto_system_state(control,"POWERED_OFF");
+ control_emit_goto_system_state(control,"HOST_POWERED_OFF");
}
else
{
control_power_emit_power_good(control_power);
- control_emit_goto_system_state(control,"POWERED_ON");
+ control_emit_goto_system_state(control,"HOST_POWERED_ON");
}
}
} else {
printf("ERROR PowerControl: GPIO read error (gpio=%s,rc=%d)\n",pgood.name,rc);
+ //return false so poll won't get called anymore
+ return FALSE;
}
//pgood is not at desired state yet
if (gpio != control_power_get_state(control_power) &&
@@ -118,9 +120,9 @@
int error = 0;
do {
if (state == 1) {
- control_emit_goto_system_state(control,"POWERING_ON");
+ control_emit_goto_system_state(control,"HOST_POWERING_ON");
} else {
- control_emit_goto_system_state(control,"POWERING_OFF");
+ control_emit_goto_system_state(control,"HOST_POWERING_OFF");
}
error = gpio_open(&power_pin);
if (error != GPIO_OK) { break; }
diff --git a/objects/sensor_host_status_obj.c b/objects/sensor_host_status_obj.c
deleted file mode 100644
index d631200..0000000
--- a/objects/sensor_host_status_obj.c
+++ /dev/null
@@ -1,181 +0,0 @@
-#include "interfaces/openbmc_intf.h"
-#include "openbmc.h"
-
-#define BOOTED 100
-/* ---------------------------------------------------------------------------------------------------- */
-
-static const gchar* dbus_object_path = "/org/openbmc/sensors";
-static const gchar* dbus_name = "org.openbmc.sensors.HostStatus";
-static guint heartbeat = 0;
-
-static GDBusObjectManagerServer *manager = NULL;
-
-static gboolean
-on_init (SensorValue *sen,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- sensor_value_complete_init(sen,invocation);
- return TRUE;
-}
-
-static gboolean
-on_init_control (Control *control,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- control_complete_init(control,invocation);
- return TRUE;
-}
-static gboolean
-on_set_value (SensorValue *sen,
- GDBusMethodInvocation *invocation,
- guchar host_status,
- gpointer user_data)
-{
- SensorValue *v = object_get_sensor_value((Object*)user_data);
- SensorMatch *match = object_get_sensor_match((Object*)user_data);
- Control* control = object_get_control((Object*)user_data);
-
- GVariant *old_value = sensor_value_get_value(sen);
- GVariant *value = NEW_VARIANT_B(host_status);
- if (VARIANT_COMPARE(old_value,value) != 0)
- {
- sensor_value_set_value(sen, value);
- sensor_value_emit_changed(sen, value, "");
- if (host_status == BOOTED)
- {
- sensor_match_set_state(match,host_status);
- sensor_match_emit_sensor_match(match,host_status);
- control_emit_goto_system_state(control,"BOOTED");
- }
- }
- sensor_value_complete_set_value(sen,invocation);
- return TRUE;
-}
-
-static void
-on_bus_acquired (GDBusConnection *connection,
- const gchar *name,
- gpointer user_data)
-{
-// g_print ("Acquired a message bus connection: %s\n",name);
-
- cmdline *cmd = user_data;
- if (cmd->argc < 2)
- {
- g_print("No objects created. Put object name(s) on command line\n");
- return;
- }
- manager = g_dbus_object_manager_server_new (dbus_object_path);
- int i=0;
- for (i=1;i<cmd->argc;i++)
- {
- gchar *s;
- s = g_strdup_printf ("%s/%s",dbus_object_path,cmd->argv[i]);
- ObjectSkeleton *object = object_skeleton_new (s);
- g_free (s);
-
- SensorValue *sensor = sensor_value_skeleton_new ();
- object_skeleton_set_sensor_value (object, sensor);
- g_object_unref (sensor);
-
- SensorMatch *match = sensor_match_skeleton_new ();
- object_skeleton_set_sensor_match (object, match);
- g_object_unref (match);
-
- Control *control = control_skeleton_new ();
- object_skeleton_set_control (object, control);
- g_object_unref (control);
-
- //must init variant
- GVariant* v = NEW_VARIANT_B(0);
- sensor_value_set_value(sensor,v);
-
- // set units
- sensor_value_set_units(sensor,"");
- sensor_value_set_settable(sensor,TRUE);
- //must emit change so sensor manager sees initial value
- sensor_value_emit_changed(sensor,v,"");
-
- //signal handlers
- /*g_dbus_connection_signal_subscribe(connection,
- "org.openbmc.sensors.IpmiBt",
- "org.openbmc.sensors.IpmiBt",
- "SetSensor",
- "/org/openbmc/sensors/IpmiBt",
- NULL,
- G_DBUS_SIGNAL_FLAGS_NONE,
- (GDBusSignalCallback) on_set_ipmi,
- object,
- NULL );
- */
- //define method callbacks here
- g_signal_connect (sensor,
- "handle-init",
- G_CALLBACK (on_init),
- NULL); /* user_data */
-
- g_signal_connect (control,
- "handle-init",
- G_CALLBACK (on_init_control),
- NULL); /* user_data */
-
- g_signal_connect (sensor,
- "handle-set-value",
- G_CALLBACK (on_set_value),
- object); /* user_data */
-
-
- /* Export the object (@manager takes its own reference to @object) */
- g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
- g_object_unref (object);
- }
-
- /* Export all objects */
- g_dbus_object_manager_server_set_connection (manager, connection);
-}
-
-static void
-on_name_acquired (GDBusConnection *connection,
- const gchar *name,
- gpointer user_data)
-{
- //g_print ("Acquired the name %s\n", name);
-}
-
-static void
-on_name_lost (GDBusConnection *connection,
- const gchar *name,
- gpointer user_data)
-{
- //g_print ("Lost the name %s\n", name);
-}
-
-
-gint
-main (gint argc, gchar *argv[])
-{
- GMainLoop *loop;
- cmdline cmd;
- cmd.argc = argc;
- cmd.argv = argv;
- guint id;
- loop = g_main_loop_new (NULL, FALSE);
-
- id = g_bus_own_name (DBUS_TYPE,
- dbus_name,
- G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
- G_BUS_NAME_OWNER_FLAGS_REPLACE,
- on_bus_acquired,
- on_name_acquired,
- on_name_lost,
- &cmd,
- NULL);
-
- g_main_loop_run (loop);
-
- g_bus_unown_name (id);
- g_main_loop_unref (loop);
- return 0;
-}
diff --git a/xml/openbmc_intf.xml b/xml/openbmc_intf.xml
index 7d5094e..7711a09 100644
--- a/xml/openbmc_intf.xml
+++ b/xml/openbmc_intf.xml
@@ -1,12 +1,4 @@
<node>
- <interface name="org.openbmc.Occ">
- <method name="init"/>
- <method name="collect"/>
- <property name="state" type="s" access="readwrite"/>
- <property name="instance_name" type="s" access="read"/>
- <property name="poll_interval" type="i" access="readwrite"/>
- </interface>
-
<interface name="org.openbmc.Fan">
<method name="setCoolingZone">
<arg name="cooling_zone" type="i" direction="in"/>
@@ -101,6 +93,7 @@
<signal name="GotoSystemState">
<arg name="state_name" type="s"/>
</signal>
+ <signal name="Started"/>
</interface>
<interface name="org.openbmc.control.Bmc">
<method name="place_holder"/>