Basic support for Firestone and Garrison systems

Firestone and Garrison are IBM branded OpenPOWER systems.
diff --git a/meta-ibm/meta-garrison/recipes-phosphor/skeleton/skeleton.bbappend b/meta-ibm/meta-garrison/recipes-phosphor/skeleton/skeleton.bbappend
new file mode 100644
index 0000000..f7f16da
--- /dev/null
+++ b/meta-ibm/meta-garrison/recipes-phosphor/skeleton/skeleton.bbappend
@@ -0,0 +1,4 @@
+FILESEXTRAPATHS_append := "${THISDIR}/${PN}:"
+SRC_URI += "file://garrison.patch"
+SRC_URI += "file://poweron.patch"
+SRC_URI += "file://occ-path.patch"
diff --git a/meta-ibm/meta-garrison/recipes-phosphor/skeleton/skeleton/garrison.patch b/meta-ibm/meta-garrison/recipes-phosphor/skeleton/skeleton/garrison.patch
new file mode 100644
index 0000000..23aabc5
--- /dev/null
+++ b/meta-ibm/meta-garrison/recipes-phosphor/skeleton/skeleton/garrison.patch
@@ -0,0 +1,11 @@
+--- a/skeleton.service	2015-10-28 07:47:55.337712001 -0500
++++ b/skeleton.service	2015-10-28 07:34:05.277712001 -0500
+@@ -2,7 +2,7 @@
+ Description=Temp placeholder for skeleton function
+ 
+ [Service]
+-ExecStart=/usr/sbin/system_manager.py Palmetto
++ExecStart=/usr/sbin/system_manager.py Garrison
+ 
+ [Install]
+ WantedBy=multi-user.target
diff --git a/meta-ibm/meta-garrison/recipes-phosphor/skeleton/skeleton/occ-path.patch b/meta-ibm/meta-garrison/recipes-phosphor/skeleton/skeleton/occ-path.patch
new file mode 100644
index 0000000..04304e4
--- /dev/null
+++ b/meta-ibm/meta-garrison/recipes-phosphor/skeleton/skeleton/occ-path.patch
@@ -0,0 +1,20 @@
+--- a/git/bin/sensor_manager2.py
++++ b/git/bin/sensor_manager2.py
+@@ -63,13 +63,13 @@ if __name__ == '__main__':
+ 	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"
++	sensor_obj = Sensors.OccStatusSensor(bus,obj_path,
++			"/sys/class/i2c-adapter/i2c-4/4-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"
++	sensor_obj = Sensors.OccStatusSensor(bus,obj_path,
++			"/sys/class/i2c-adapter/i2c-5/5-0050/online")
+ 	root_sensor.add(obj_path,sensor_obj)
+ 
+ 	obj_path = OBJ_PATH+"/host/BootCount"
diff --git a/meta-ibm/meta-garrison/recipes-phosphor/skeleton/skeleton/poweron.patch b/meta-ibm/meta-garrison/recipes-phosphor/skeleton/skeleton/poweron.patch
new file mode 100644
index 0000000..c50ce3d
--- /dev/null
+++ b/meta-ibm/meta-garrison/recipes-phosphor/skeleton/skeleton/poweron.patch
@@ -0,0 +1,113 @@
+--- a/git/objects/power_control_obj.c
++++ b/git/objects/power_control_obj.c
+@@ -17,11 +17,15 @@ static const gchar* instance_name = "power0";
+ static const gchar* dbus_name = "org.openbmc.control.Power";
+ 
+ //This object will use these GPIOs
+-GPIO power_pin    = (GPIO){ "POWER_PIN" };
+-GPIO pgood        = (GPIO){ "PGOOD" };
+-GPIO usb_reset    = (GPIO){ "USB_RESET" };
+-GPIO pcie_reset   = (GPIO){ "PCIE_RESET" };
+-
++GPIO power_pin = (GPIO){ "BMC_POWER_UP" };
++GPIO pgood = (GPIO){ "SYS_PWROK_BUFF" };
++GPIO bmc_wd_clear_pulse_n = (GPIO){ "BMC_WD_CLEAR_PULSE_N" };
++GPIO cm1_oe_r_n = (GPIO){ "CM1_OE_R_N" };
++GPIO bmc_cp0_reset_n = (GPIO){ "BMC_CP0_RESET_N" };
++GPIO bmc_cfam_reset_n_r = (GPIO){ "BMC_CFAM_RESET_N_R" };
++GPIO pcie_reset = (GPIO){ "PEX8718_DEVICES_RESET_N" };
++GPIO cp0_devices_reset_n = (GPIO){ "CP0_DEVICES_RESET_N" };
++GPIO cp1_devices_reset_n = (GPIO){ "CP1_DEVICES_RESET_N" };
+ 
+ static GDBusObjectManagerServer *manager = NULL;
+ 
+@@ -67,27 +71,36 @@ poll_pgood(gpointer user_data)
+ 			{
+ 				control_power_emit_power_lost(control_power);
+ 				control_emit_goto_system_state(control,"HOST_POWERED_OFF");
+-				rc = gpio_open(&pcie_reset);
+-				rc = gpio_write(&pcie_reset,0);
+-				gpio_close(&pcie_reset);
+-
+-				rc = gpio_open(&usb_reset);
+-				rc = gpio_write(&usb_reset,0);
+-				gpio_close(&usb_reset);
+-
+ 			}
+ 			else
+ 			{
+ 				control_power_emit_power_good(control_power);
+ 				control_emit_goto_system_state(control,"HOST_POWERED_ON");
+-				rc = gpio_open(&pcie_reset);
+-				rc = gpio_write(&pcie_reset,1);
+-				gpio_close(&pcie_reset);
+-
+-				rc = gpio_open(&usb_reset);
+-				rc = gpio_write(&usb_reset,1);
+-				gpio_close(&usb_reset);
+ 			}
++
++			gpio_open(&cm1_oe_r_n);
++			gpio_write(&cm1_oe_r_n, !gpio);
++			gpio_close(&cm1_oe_r_n);
++
++			gpio_open(&bmc_cp0_reset_n);
++			gpio_write(&bmc_cp0_reset_n, gpio);
++			gpio_close(&bmc_cp0_reset_n);
++
++			gpio_open(&bmc_cfam_reset_n_r);
++			gpio_write(&bmc_cfam_reset_n_r, gpio);
++			gpio_close(&bmc_cfam_reset_n_r);
++
++			gpio_open(&pcie_reset);
++			gpio_write(&pcie_reset, gpio);
++			gpio_close(&pcie_reset);
++
++			gpio_open(&cp0_devices_reset_n);
++			gpio_write(&cp0_devices_reset_n, gpio);
++			gpio_close(&cp0_devices_reset_n);
++
++			gpio_open(&cp1_devices_reset_n);
++			gpio_write(&cp1_devices_reset_n, gpio);
++			gpio_close(&cp1_devices_reset_n);
+ 		}
+ 	} else {
+ 		printf("ERROR PowerControl: GPIO read error (gpio=%s,rc=%d)\n",pgood.name,rc);
+@@ -138,11 +151,13 @@ on_set_power_state(ControlPower *pwr,
+ 			} else {
+ 				control_emit_goto_system_state(control,"HOST_POWERING_OFF");
+ 			}
++
+ 			error = gpio_open(&power_pin);
+ 			if(error != GPIO_OK) { break;	}
+-			error = gpio_write(&power_pin,!state);
++			error = gpio_write(&power_pin, state);
+ 			if(error != GPIO_OK) { break;	}
+ 			gpio_close(&power_pin);
++
+ 			control_power_set_state(pwr,state);
+ 		} while(0);
+ 		if(error != GPIO_OK)
+@@ -230,10 +245,21 @@ on_bus_acquired(GDBusConnection *connection,
+ 		if(rc != GPIO_OK) { break; }
+ 		rc = gpio_init(connection,&pgood);
+ 		if(rc != GPIO_OK) { break; }
++		rc = gpio_init(connection,&bmc_wd_clear_pulse_n);
++		if(rc != GPIO_OK) { break; }
++		rc = gpio_init(connection,&cm1_oe_r_n);
++		if(rc != GPIO_OK) { break; }
++		rc = gpio_init(connection,&bmc_cp0_reset_n);
++		if(rc != GPIO_OK) { break; }
++		rc = gpio_init(connection,&bmc_cfam_reset_n_r);
++		if(rc != GPIO_OK) { break; }
+ 		rc = gpio_init(connection,&pcie_reset);
+ 		if(rc != GPIO_OK) { break; }
+-		rc = gpio_init(connection,&usb_reset);
++		rc = gpio_init(connection,&cp0_devices_reset_n);
+ 		if(rc != GPIO_OK) { break; }
++		rc = gpio_init(connection,&cp1_devices_reset_n );
++		if(rc != GPIO_OK) { break; }
++
+ 
+ 		uint8_t gpio;
+ 		rc = gpio_open(&pgood);