From patchwork Tue Jun 14 06:22:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Chiou X-Patchwork-Id: 9175043 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 3277060772 for ; Tue, 14 Jun 2016 06:23:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2354F2818B for ; Tue, 14 Jun 2016 06:23:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17D4628294; Tue, 14 Jun 2016 06:23:41 +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 9689A2818B for ; Tue, 14 Jun 2016 06:23:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751395AbcFNGXG (ORCPT ); Tue, 14 Jun 2016 02:23:06 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:34213 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751016AbcFNGXD (ORCPT ); Tue, 14 Jun 2016 02:23:03 -0400 Received: by mail-pa0-f65.google.com with SMTP id us13so740863pab.1; Mon, 13 Jun 2016 23:23:03 -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=Nf/weATaoBLmJRLQGJm/jQYcK5RmBu89otztUFpZf9g=; b=tZzvNZY6UMTUAX5OxLXcHENjDhe++kMU5a1CkEkwcBZhbLIjeV0gYo4+yrpFp9NmTw mMWQHd2SS9BE22F7/KZrSmGUwKFINweUBitrLHYu7eJAEbXtF2cWpQcxPpPz8I4//MZU ZzZwZeVAMndGPtyGn8Kggy3x4oLiTAEsIK3EeSKhbpLXXHjU196lc9CYq4IxH7Y/0Cme CeF5k/NVi1MQA4EZd6UvwIvK/cwHylKcQAoS720TQRoPjYAEY9Lffqf8/z3cwSrVrUiJ pEm+Y9C4d0XMobT2jtewGJeJPXOlTpi+9QP/SfZM5LWC0hPdnMGCwLcJCKNeHaGzASkE 6FrQ== 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=Nf/weATaoBLmJRLQGJm/jQYcK5RmBu89otztUFpZf9g=; b=NXErwFsHZj8GbL3Ltn0Mk+/MRtx8wlkCDdcGNFKZziQ+kuyZq0jn8FVCAuGri00sIv VSe/iMmD7VM8mGGHY/SZdaGd1mU6fecNu8BGclX09XbOfQr2JJiVbAg35AXRUhoUECaP 6mDeKSdnnQHEA8lC3zA7Zh97tsjPB9gnCVhAovavifjAsiF1673u81WvvPcL8QfUBof+ 17RAhUzTbrZWj4IMFv3E8oeHoW7uY4iBiA8hRs6InLUqiZ0vcpm+w6aZC7NIic7AlwbR EzTT2A3ggIGSeD1caUmNt+6FDo4/KknsQGixuCnQjEODO+NL2gvPOvHc9OAW/fuMNm2D BY7Q== X-Gm-Message-State: ALyK8tJsK6bJ/u9pwDms2s0Q88miRGzMAv056idHaefAinsrKhRA8HD4tZJGtbmhNPLCDQ== X-Received: by 10.66.4.106 with SMTP id j10mr25762699paj.111.1465885382916; Mon, 13 Jun 2016 23:23:02 -0700 (PDT) Received: from charles-desktop.promise.com.tw (vpn.promise.com.tw. [61.222.81.253]) by smtp.gmail.com with ESMTPSA id x67sm42100454pff.47.2016.06.13.23.23.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jun 2016 23:23:02 -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: [v2 PATCH 2/2] scsi:stex.c Add S6 support Date: Tue, 14 Jun 2016 14:22:32 +0800 Message-Id: <1465885352-8602-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 817e895..e1d70b1 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)"); @@ -1657,6 +1664,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) { @@ -1931,15 +1941,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); } @@ -1976,6 +1991,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 = {