From patchwork Fri Feb 27 09:11:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Kerr X-Patchwork-Id: 444218 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6AFE61400DD for ; Fri, 27 Feb 2015 20:11:52 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 498071A00FD for ; Fri, 27 Feb 2015 20:11:52 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id E41751A006F for ; Fri, 27 Feb 2015 20:11:12 +1100 (AEDT) Received: by ozlabs.org (Postfix, from userid 1023) id C5DA214011D; Fri, 27 Feb 2015 20:11:12 +1100 (AEDT) MIME-Version: 1.0 Message-Id: <1425028266.818528.566703157942.12.gpush@pablo> In-Reply-To: <1425028266.816963.907799920643.0.gpush@pablo> To: skiboot@lists.ozlabs.org From: Jeremy Kerr Date: Fri, 27 Feb 2015 17:11:06 +0800 Subject: [Skiboot] [PATCH 12/13] hw/prd: Handle BMC OCC reset requests through PRD X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- hw/ipmi/ipmi-sel.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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: