From patchwork Tue Aug 11 09:36:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viswas.G@pmcs.com X-Patchwork-Id: 6990121 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CBEF79F358 for ; Tue, 11 Aug 2015 09:34:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E491020582 for ; Tue, 11 Aug 2015 09:34:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EDE1E205F7 for ; Tue, 11 Aug 2015 09:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933819AbbHKJeg (ORCPT ); Tue, 11 Aug 2015 05:34:36 -0400 Received: from bby1mta02.pmc-sierra.com ([216.241.235.117]:34967 "EHLO bby1mta02.pmc-sierra.bc.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933709AbbHKJef (ORCPT ); Tue, 11 Aug 2015 05:34:35 -0400 Received: from bby1mta02.pmc-sierra.bc.ca (localhost.pmc-sierra.bc.ca [127.0.0.1]) by localhost (Postfix) with SMTP id 369578E049C; Tue, 11 Aug 2015 02:34:35 -0700 (PDT) Received: from smtp.pmcs.com (bby1cas03.pmc-sierra.internal [216.241.227.144]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by bby1mta02.pmc-sierra.bc.ca (Postfix) with ESMTP id 247FF8E0489; Tue, 11 Aug 2015 02:34:35 -0700 (PDT) Received: from localhost (216.241.227.4) by bby1cas03.pmc-sierra.internal (216.241.227.144) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 11 Aug 2015 02:34:34 -0700 From: To: CC: Jack Wang , , Tomas Henzl , , , Hannes Reinecke Subject: [PATCH V2 2/8] pm80xx: Corrected device state changes in I_T_Nexus_Reset. Date: Tue, 11 Aug 2015 15:06:26 +0530 Message-ID: <1439285792-12030-3-git-send-email-Viswas.G@pmcs.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1439285792-12030-1-git-send-email-Viswas.G@pmcs.com> References: <1439285792-12030-1-git-send-email-Viswas.G@pmcs.com> MIME-Version: 1.0 X-Originating-IP: [216.241.227.4] DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pmcs.com; h=from:to:cc:subject:date:message-id:in-reply-to:references:mime-version:content-type; s=default; bh=d4oJKG+44xChaIuz8KoDexLuCcOcaRr8Y59WRM3uMuE=; b=KkQvGA5i0rCqLpzP6oFx2QTtKM7mDuUybtBEnL1sadz9ytwQwneZ3q3u9gUhSoHm5ehiqeIQ5mE1VzERFMtW6PqCpYoIj7Pge3tLuaoJWwvBZ5bmwt9nwLlVg5nQwxNoCAmjEClKsngGbrXJRP6TwPXdT9iGrdnuojp1X8gd+yw= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Viswas G In Nexus reset the device state request are not needed. Changes from V1: Device state change request has been removed as the firmware will handle it during internal cleanup. Also updated the proper return value in case of failures. Signed-off-by: Viswas G Reviewed-by: Suresh Thiagarajan Acked-by: Jack Wang Reviewed-by: Tomas Henzl --- drivers/scsi/pm8001/pm8001_sas.c | 18 +++++++++++++----- drivers/scsi/pm8001/pm8001_sas.h | 8 ++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index b93f289..48f4627 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -975,19 +975,27 @@ int pm8001_I_T_nexus_reset(struct domain_device *dev) phy = sas_get_local_phy(dev); if (dev_is_sata(dev)) { - DECLARE_COMPLETION_ONSTACK(completion_setstate); if (scsi_is_sas_phy_local(phy)) { rc = 0; goto out; } rc = sas_phy_reset(phy, 1); + if (rc) { + PM8001_EH_DBG(pm8001_ha, + pm8001_printk("phy reset failed for device %x\n" + "with rc %d\n", pm8001_dev->device_id, rc)); + rc = TMF_RESP_FUNC_FAILED; + goto out; + } msleep(2000); rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev , dev, 1, 0); - pm8001_dev->setds_completion = &completion_setstate; - rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha, - pm8001_dev, 0x01); - wait_for_completion(&completion_setstate); + if (rc) { + PM8001_EH_DBG(pm8001_ha, + pm8001_printk("task abort failed %x\n" + "with rc %d\n", pm8001_dev->device_id, rc)); + rc = TMF_RESP_FUNC_FAILED; + } } else { rc = sas_phy_reset(phy, 1); msleep(2000); diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h index 8dd8b78..c9736cc 100644 --- a/drivers/scsi/pm8001/pm8001_sas.h +++ b/drivers/scsi/pm8001/pm8001_sas.h @@ -569,6 +569,14 @@ struct pm8001_fw_image_header { #define NCQ_READ_LOG_FLAG 0x80000000 #define NCQ_ABORT_ALL_FLAG 0x40000000 #define NCQ_2ND_RLE_FLAG 0x20000000 + +/* Device states */ +#define DS_OPERATIONAL 0x01 +#define DS_PORT_IN_RESET 0x02 +#define DS_IN_RECOVERY 0x03 +#define DS_IN_ERROR 0x04 +#define DS_NON_OPERATIONAL 0x07 + /** * brief param structure for firmware flash update. */