From patchwork Thu Feb 5 08:43:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 436694 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id EB6FF140216 for ; Thu, 5 Feb 2015 19:43:33 +1100 (AEDT) Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by lists.ozlabs.org (Postfix) with ESMTP id D37031A0EEC for ; Thu, 5 Feb 2015 19:43:33 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e28smtp01.in.ibm.com (e28smtp01.in.ibm.com [122.248.162.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 19FCD1A0ED4 for ; Thu, 5 Feb 2015 19:43:28 +1100 (AEDT) Received: from /spool/local by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 5 Feb 2015 14:13:26 +0530 Received: from d28dlp02.in.ibm.com (9.184.220.127) by e28smtp01.in.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 5 Feb 2015 14:13:24 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id E1700394004E for ; Thu, 5 Feb 2015 14:13:23 +0530 (IST) Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay03.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t158hN9t6029710 for ; Thu, 5 Feb 2015 14:13:23 +0530 Received: from d28av05.in.ibm.com (localhost [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t158hNaG029038 for ; Thu, 5 Feb 2015 14:13:23 +0530 Received: from localhost.localdomain ([9.124.35.64]) by d28av05.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t158hNUc029030 for ; Thu, 5 Feb 2015 14:13:23 +0530 From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Thu, 05 Feb 2015 14:13:23 +0530 Message-ID: <20150205084323.12859.40309.stgit@localhost.localdomain> In-Reply-To: <20150205083611.12859.41225.stgit@localhost.localdomain> References: <20150205083611.12859.41225.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15020508-4790-0000-0000-00000680E42D Subject: [Skiboot] [PATCH 22/22] FSP/LEDS: Roll back exclusive bit in case FSP command queuing fails 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" Presently we update enclosure exclusive bit before making LED update SPCN passthrough command and not reverting if this command fails. So we endup having wrong state if SPCN passthrough command fails. This patch fixes above described issue. Signed-off-by: Vasant Hegde --- hw/fsp/fsp-leds.c | 40 ++++++++++++++++++++++------------------ hw/fsp/fsp-leds.h | 1 + 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c index 1353b78..10e8229 100644 --- a/hw/fsp/fsp-leds.c +++ b/hw/fsp/fsp-leds.c @@ -200,25 +200,11 @@ static inline void opal_led_update_complete(u64 async_token, u64 result) * occured with the recent SPCN command. Subsequent LED requests will * be served with these updates changed to the list. */ -static void update_led_list(char *loc_code, u32 led_state) +static void update_led_list(char *loc_code, u32 led_state, u32 excl_bit) { struct fsp_led_data *led = NULL, *encl_led = NULL, *encl_cec_led = NULL; bool is_encl_led = is_enclosure_led(loc_code); - if (is_encl_led) - goto enclosure; - - /* Descendant LED in CEC list */ - led = fsp_find_cec_led(loc_code); - if (!led) { - log_simple_error(&e_info(OPAL_RC_LED_LC), - PREFIX "Could not find descendent LED in CEC LC=%s\n", - loc_code); - return; - } - led->status = led_state; - -enclosure: /* Enclosure LED in CEC list */ encl_cec_led = fsp_find_encl_cec_led(loc_code); if (!encl_cec_led) { @@ -228,6 +214,21 @@ enclosure: return; } + /* Update state */ + if (is_encl_led) { + /* Enclosure exclusive bit */ + encl_cec_led->excl_bit = excl_bit; + } else { /* Descendant LED in CEC list */ + led = fsp_find_cec_led(loc_code); + if (!led) { + log_simple_error(&e_info(OPAL_RC_LED_LC), PREFIX + "Could not find descendent LED in \ + CEC LC=%s\n", loc_code); + return; + } + led->status = led_state; + } + /* Enclosure LED in ENCL list */ encl_led = fsp_find_encl_encl_led(loc_code); if (!encl_led) { @@ -303,7 +304,8 @@ static void fsp_spcn_set_led_completion(struct fsp_msg *msg) cmd |= FSP_STATUS_GENERIC_ERROR; /* Rollback the changes */ - update_led_list(spcn_cmd->loc_code, spcn_cmd->ckpt_status); + update_led_list(spcn_cmd->loc_code, + spcn_cmd->ckpt_status, spcn_cmd->ckpt_excl_bit); } /* FSP initiated SPCN command */ @@ -390,6 +392,7 @@ static int fsp_msg_set_led_state(struct led_set_cmd *spcn_cmd) * command eventually fails. */ spcn_cmd->ckpt_status = led->status; + spcn_cmd->ckpt_excl_bit = led->excl_bit; sled.state = led->status; /* Update the exclussive LED bits */ @@ -444,7 +447,7 @@ static int fsp_msg_set_led_state(struct led_set_cmd *spcn_cmd) * Update the local lists based on the attempted SPCN command to * set/reset an individual led (CEC or ENCL). */ - update_led_list(spcn_cmd->loc_code, sled.state); + update_led_list(spcn_cmd->loc_code, sled.state, led->excl_bit); msg->user_data = spcn_cmd; rc = fsp_queue_msg(msg, fsp_spcn_set_led_completion); @@ -453,7 +456,8 @@ static int fsp_msg_set_led_state(struct led_set_cmd *spcn_cmd) fsp_freemsg(msg); free_spcn_cmd(spcn_cmd); /* Revert LED state update */ - update_led_list(spcn_cmd->loc_code, spcn_cmd->ckpt_status); + update_led_list(spcn_cmd->loc_code, spcn_cmd->ckpt_status, + spcn_cmd->ckpt_excl_bit); } update_fail: diff --git a/hw/fsp/fsp-leds.h b/hw/fsp/fsp-leds.h index 8837104..a411636 100644 --- a/hw/fsp/fsp-leds.h +++ b/hw/fsp/fsp-leds.h @@ -120,6 +120,7 @@ struct led_set_cmd { u8 command; u8 state; u16 ckpt_status; /* Checkpointed status */ + u16 ckpt_excl_bit; /* Checkpointed exclusive status */ u64 async_token; /* OPAL async token */ enum spcn_cmd_src cmd_src; /* OPAL or FSP based */ struct list_node link;