From patchwork Tue Jun 14 08:33:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Chiou X-Patchwork-Id: 9175203 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2006C60772 for ; Tue, 14 Jun 2016 08:34:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C2CF1FE7B for ; Tue, 14 Jun 2016 08:34:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00B0225EF7; Tue, 14 Jun 2016 08:34:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED2D227C8F for ; Tue, 14 Jun 2016 08:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751583AbcFNIeJ (ORCPT ); Tue, 14 Jun 2016 04:34:09 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34696 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751108AbcFNIeI (ORCPT ); Tue, 14 Jun 2016 04:34:08 -0400 Received: by mail-pf0-f194.google.com with SMTP id 66so10602267pfy.1; Tue, 14 Jun 2016 01:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=RjOnxoA9mYHg0BcD5CjZAXyJQxlGPyv1XRB+b4ND804=; b=xuxRlaBC2c4cueVwSp5StZGjiGqh1A6DUA7uACvQJ41lxoRWR3L5T67mtENwKaiTfv 8QRHbwATmLBy8q85UY/tqAnH03RB7SVvZtyfvSODq3HjTaz9opc+z3SE6gIqD22mKfkf rTnWncG/fBzdwdQg15JtSjByB/OfKQgrivKeabOk4GGPdofFwl8/XHN/xSWvD8blKwJz 4fAhukMA+eCuaSRhP8ceNj8gfIyvO2U2ldn3At3NGEOGVbx39g+D9+yZFIgzx93s1PCZ nhhpdN9WVkem9SWZVXo1o2PWJzs8OTJutki7v0EnnGOSrCWty2eJiMrdkLZnBGMaR51A FeGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=RjOnxoA9mYHg0BcD5CjZAXyJQxlGPyv1XRB+b4ND804=; b=ftJS66fQ3+M6radWemp2vVryI6EwDqFZUk8VN1IIdFFNFfXJJcUlPNe3vgpm/pPgso lbM9Fpv2jzfcUcQmWqsDhQ7SzSTe3xmW86Htv0O80o4WW6hY8jvfPjqL7MoNSyL8DKJD WD9hLZtztuLPlHAHo2ztap2xqF4s6vhpFRPb0vRTHkT9Z1mA7uHVrIaiw8c2pMMN0Nm0 TNJzUGASv8sl4zwpGbfo+HD7N7SPV55pqbpniw0P5iIXGhydroi/jyHAVhalPbNI4kRJ MtJNpBhq0b5p8V5AWphgRzLDBsNgAYHYk89oIdipQiLsN++HdXZW4Yb3wqNT/n2tkHAb c48A== X-Gm-Message-State: ALyK8tLRN2/AeLWv1wO0/4/nTuMN2zcDkBUy1dEk81QxvV20UgwbqcOac2UcZmcQfgI+cA== X-Received: by 10.98.50.135 with SMTP id y129mr2491258pfy.62.1465893247314; Tue, 14 Jun 2016 01:34:07 -0700 (PDT) Received: from charles-desktop.promise.com.tw (vpn.promise.com.tw. [61.222.81.253]) by smtp.gmail.com with ESMTPSA id g86sm43232538pfd.67.2016.06.14.01.34.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Jun 2016 01:34:06 -0700 (PDT) From: Charles Chiou To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linus.chen@tw.promise.com, grace.chang@tw.promise.com, victor.p@promise.com, eva.cheng@tw.promise.com, charles.chiou@tw.promise.com, julian.calaby@gmail.com Cc: Paul Subject: [v3 PATCH 2/2] scsi:stex.c Add S6 support Date: Tue, 14 Jun 2016 16:33:40 +0800 Message-Id: <1465893220-10968-1-git-send-email-ch1102chiou@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Charles 1.Add reboot notifier and register it in stex_probe for all supported device. 2.For all supported device in restart flow, we get a callback from notifier and set S6flag for stex_shutdown & stex_hba_stop to send restart command to FW. Signed-off-by: Charles Signed-off-by: Paul --- drivers/scsi/stex.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c index cad53b5..7b29a00 100644 --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -362,6 +363,12 @@ struct st_card_info { u16 sts_count; }; +int S6flag; +static int stex_halt(struct notifier_block *nb, ulong event, void *buf); +static struct notifier_block stex_notifier = { + stex_halt, NULL, 0 +}; + static int msi; module_param(msi, int, 0); MODULE_PARM_DESC(msi, "Enable Message Signaled Interrupts(0=off, 1=on)"); @@ -1655,6 +1662,9 @@ static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) pci_set_master(pdev); + S6flag = 0; + register_reboot_notifier(&stex_notifier); + host = scsi_host_alloc(&driver_template, sizeof(struct st_hba)); if (!host) { @@ -1929,15 +1939,20 @@ static void stex_remove(struct pci_dev *pdev) scsi_host_put(hba->host); pci_disable_device(pdev); + + unregister_reboot_notifier(&stex_notifier); } static void stex_shutdown(struct pci_dev *pdev) { struct st_hba *hba = pci_get_drvdata(pdev); - if (hba->supports_pm == 0) + if (hba->supports_pm == 0) { stex_hba_stop(hba, ST_IGNORED); - else + } else if (hba->supports_pm == 1 && S6flag) { + unregister_reboot_notifier(&stex_notifier); + stex_hba_stop(hba, ST_S6); + } else stex_hba_stop(hba, ST_S5); } @@ -1974,6 +1989,12 @@ static int stex_resume(struct pci_dev *pdev) stex_handshake(hba); return 0; } + +static int stex_halt(struct notifier_block *nb, unsigned long event, void *buf) +{ + S6flag = 1; + return NOTIFY_OK; +} MODULE_DEVICE_TABLE(pci, stex_pci_tbl); static struct pci_driver stex_pci_driver = {