diff mbox

[12/13] hw/prd: Handle BMC OCC reset requests through PRD

Message ID 1425028266.818528.566703157942.12.gpush@pablo
State Accepted
Headers show

Commit Message

Jeremy Kerr Feb. 27, 2015, 9:11 a.m. UTC
This change adds a SEL event handler (triggered through the SMS_ATN
facility), to call prd_occ_reset().

For multi-chip OpenPower machines, we'll need to lookup the proper
sensor IDs, once we have that information available in the device tree.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

---
 hw/ipmi/ipmi-sel.c |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
diff mbox

Patch

diff --git a/hw/ipmi/ipmi-sel.c b/hw/ipmi/ipmi-sel.c
index 2fbb45d..173b7be 100644
--- a/hw/ipmi/ipmi-sel.c
+++ b/hw/ipmi/ipmi-sel.c
@@ -36,6 +36,7 @@ 
 /* OEM SEL Commands */
 #define CMD_AMI_POWER		0x04
 #define CMD_AMI_PNOR_ACCESS	0x07
+#define CMD_AMI_OCC_RESET	0x0e
 
 #define SOFT_OFF	        0x00
 #define SOFT_REBOOT	        0x01
@@ -196,6 +197,29 @@  static void sel_power(uint8_t power)
 	}
 }
 
+static uint32_t occ_sensor_id_to_chip(uint8_t sensor, uint32_t *chip)
+{
+	/* todo: lookup sensor ID node in the DT, and map to a chip id */
+	(void)sensor;
+	*chip = 0;
+	return 0;
+}
+
+static void sel_occ_reset(uint8_t sensor)
+{
+	uint32_t chip;
+	int rc;
+
+	rc = occ_sensor_id_to_chip(sensor, &chip);
+	if (rc) {
+		prlog(PR_ERR, "IPMI: SEL message to reset an unknown OCC "
+				"(sensor ID 0x%02x)\n", sensor);
+		return;
+	}
+
+	prd_occ_reset(chip);
+}
+
 static void dump_sel(struct oem_sel *sel)
 {
 	const int level = PR_DEBUG;
@@ -243,6 +267,9 @@  void ipmi_parse_sel(struct ipmi_msg *msg)
 	case CMD_AMI_POWER:
 		sel_power(sel.data[0]);
 		break;
+	case CMD_AMI_OCC_RESET:
+		sel_occ_reset(sel.data[0]);
+		break;
 	case CMD_AMI_PNOR_ACCESS:
 		break;
 	default: