From patchwork Fri Feb 17 02:52:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Chiou X-Patchwork-Id: 9578655 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 92E4B6049F for ; Fri, 17 Feb 2017 02:53:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 867752861F for ; Fri, 17 Feb 2017 02:53:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A3A628687; Fri, 17 Feb 2017 02:53:01 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 346252861F for ; Fri, 17 Feb 2017 02:53:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755286AbdBQCws (ORCPT ); Thu, 16 Feb 2017 21:52:48 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33001 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755265AbdBQCwr (ORCPT ); Thu, 16 Feb 2017 21:52:47 -0500 Received: by mail-pg0-f66.google.com with SMTP id 5so3573833pgj.0; Thu, 16 Feb 2017 18:52:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=V6wKVa+N2QENAjoQJP7NtAjjYK+b5b6GfQs9D09lTac=; b=N/w7hgNnAFfRtD85jgbHDRz8QM0gmn46ahJIYSC9r3T2t1jRyy2u9vQRqoGKVJbmmC edRpAkTwRTQ/RuPhe9X9TZKuZQ7WyFjlebyxxpvfPgUu0iW1fS2qDfWwdetXa7GngUJF eEjXFUGMPaBWhuywWMJ/UrfTgF1XsjNO5elN08UfbRCuYIZJ/t8fONYg1mG9VRsQebdp IFUFI5xpOI5wjxVtzxnDKIdZ4K1/VTKM2Y2PRtUZdL3VeyIrhnreVPb6gBZNTmE2Cv1g 04PRhrhC4bhNo2R0SOk6+DXnBQoGgy+hn19zu6F9ht6k7Mv1fXO40OyUEpxrH8LUm1NZ dnlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=V6wKVa+N2QENAjoQJP7NtAjjYK+b5b6GfQs9D09lTac=; b=N2swFEYBULTvCuWF5QlvJtvH7zjl0zgZ3CSFurlFcZca8awHcxSCx58g/lRlcwlCQD xB2UjjRlQvCPqXbAx4M4t1sgg53Iah0jPF6B3GPYyTW7jB2JpVcqQNf5efCOOUZsoBC2 LIh/q3BIQeQhEzzfiBSUTNHsNYupWlil1PPbhHckx7rJB2WSEpwmzy1/9eEQxcZ8Ff3o hzJyv8+rhgSGj2ucSpKQKlAIktk1VqBAlB7Y32hupOf0X79oHI3F4i4ZfUgrb/Gs5/C7 nflCKd51m60wQ7JQF5HSmUtiawcpJTBzXD++lInNIwXjh8fROhpEYLnoTbffPqSWInf5 I/mg== X-Gm-Message-State: AMke39mX0Uo7UI/6x1QBki+3MwFsu3i3z/n9eR+yrjHqRPcJQxHy+516RU1FGL+BaXXZkQ== X-Received: by 10.99.66.3 with SMTP id p3mr7106778pga.214.1487299966674; Thu, 16 Feb 2017 18:52:46 -0800 (PST) Received: from charles-desktop.promise.com.tw (vpn.promise.com.tw. [61.222.81.253]) by smtp.gmail.com with ESMTPSA id w76sm15898081pfd.74.2017.02.16.18.52.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Feb 2017 18:52:46 -0800 (PST) From: Charles Chiou To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linus.chen@tw.promise.com, grace.chang@tw.promise.com, eva.cheng@tw.promise.com, charles.chiou@tw.promise.com, paul.lyu@tw.promise.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] Add S6 support Date: Fri, 17 Feb 2017 10:52:38 +0800 Message-Id: <1487299958-4792-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.Chiou Signed-off-by: Paul.Lyu --- 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 e177dfe..0751561 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)"); @@ -1673,6 +1680,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) { @@ -1947,15 +1957,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); } @@ -1992,6 +2007,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 = {