From patchwork Tue Dec 22 10:11:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kashyap Desai X-Patchwork-Id: 11986223 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20986C433E9 for ; Tue, 22 Dec 2020 10:13:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C57B52310D for ; Tue, 22 Dec 2020 10:13:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726296AbgLVKNo (ORCPT ); Tue, 22 Dec 2020 05:13:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726108AbgLVKNn (ORCPT ); Tue, 22 Dec 2020 05:13:43 -0500 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A7C5C0611C5 for ; Tue, 22 Dec 2020 02:12:44 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id x126so8191389pfc.7 for ; Tue, 22 Dec 2020 02:12:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2RONE9y+uxltJlujg/fWWZv12wPgedJ1DHm234rEqII=; b=UBuFCGYMrcsj26sNbY0Y4+vfyqc5F9jHEKywXFQchUxk960V06w1kjxw31SjUk/6Gl 2MGzhA/+S8fQSyu+1EuirtlUyKD1LlcbUz9Ru8/T6L7N8kPyEFwhrqHxOGRuKBVgpo6l QfB66hTjT6lZqzV1TQnSHvg49AFybCK3ixy68= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id :in-reply-to:references; bh=2RONE9y+uxltJlujg/fWWZv12wPgedJ1DHm234rEqII=; b=CJtZo37G5j5FMrI6dlAikX7retdM0hJLYIP7+uGXlNdp5RJA68yKwBzyg09RRjIsRY GvZAjSSc0BS9zL4m0RJC1pIzKm0omfOab7zknEpZl3GjIeZbK51orvyu23DwnMtMmlqg qyhKMJq/QHR4bku3K++G0a2cJZmV7SuWC2uCeI7/1Me0OFrFPhMzQqn6+uZ/Q6T1PTPF TwauGmXuZiBBQH6M1CCkA05Aw+vv+pZPZiI8vOPLqtQcl820MWeWsUZi+ifJ9yCjBXfF v+aylb0+fJC2r2mYNrUnpkx8bdFmd8rN4yY41hmHr7lSzW7XBpjGpEIqC8Svh+doDrvr A+NQ== X-Gm-Message-State: AOAM532Q7GyLMycnzKmJibf7D6dxHMjFNNtfO1gJ3IZalmLb73AY+ye+ 9mpTi24nTdAfhcTgCpu9eIOGd36s9fLmiOMBWbPyrLEad7wayTyorZkmDjdbkJQ636Tr7V245Eq B4iAnlPaTyO+4DSdXMactkugmEzS6LgwpDw8UKqMxOhTxP6pezyhGZLEtJSTfe+1/avqkaHcT+6 CpfzVcHQPd MIME-Version: 1.0 X-Google-Smtp-Source: ABdhPJw1xdUHQ3qwMZDfISTIzjtSwn8qmW6wDeb4CrbSqn1kvwjVnjAJMDlaM5b9L/W6NlkWgHRl+g== X-Received: by 2002:a62:1a47:0:b029:19b:c093:2766 with SMTP id a68-20020a621a470000b029019bc0932766mr19505720pfa.10.1608631963223; Tue, 22 Dec 2020 02:12:43 -0800 (PST) Received: from drv-bst-rhel8.static.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id p16sm19148624pju.47.2020.12.22.02.12.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Dec 2020 02:12:42 -0800 (PST) From: Kashyap Desai To: linux-scsi@vger.kernel.org Cc: jejb@linux.ibm.com, martin.petersen@oracle.com, steve.hagan@broadcom.com, peter.rivera@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com, Kashyap Desai , sathya.prakash@broadcom.com Subject: [PATCH 08/24] mpi3mr: add support of event handling part-3 Date: Tue, 22 Dec 2020 15:41:40 +0530 Message-Id: <20201222101156.98308-9-kashyap.desai@broadcom.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20201222101156.98308-1-kashyap.desai@broadcom.com> References: <20201222101156.98308-1-kashyap.desai@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Firmware can report various MPI Events. Support for certain Events (as listed below) are enabled in the driver and their processing in driver is covered in this patch. MPI3_EVENT_SAS_BROADCAST_PRIMITIVE MPI3_EVENT_CABLE_MGMT MPI3_EVENT_ENERGY_PACK_CHANGE Signed-off-by: Kashyap Desai Cc: sathya.prakash@broadcom.com Reviewed-by: Hannes Reinecke --- drivers/scsi/mpi3mr/mpi3mr_fw.c | 3 +++ drivers/scsi/mpi3mr/mpi3mr_os.c | 37 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c index c70c75fdac5c..de2de39c719e 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -2735,8 +2735,11 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc) mpi3mr_unmask_events(mrioc, MPI3_EVENT_SAS_TOPOLOGY_CHANGE_LIST); mpi3mr_unmask_events(mrioc, MPI3_EVENT_SAS_DISCOVERY); mpi3mr_unmask_events(mrioc, MPI3_EVENT_SAS_DEVICE_DISCOVERY_ERROR); + mpi3mr_unmask_events(mrioc, MPI3_EVENT_SAS_BROADCAST_PRIMITIVE); mpi3mr_unmask_events(mrioc, MPI3_EVENT_PCIE_TOPOLOGY_CHANGE_LIST); mpi3mr_unmask_events(mrioc, MPI3_EVENT_PCIE_ENUMERATION); + mpi3mr_unmask_events(mrioc, MPI3_EVENT_CABLE_MGMT); + mpi3mr_unmask_events(mrioc, MPI3_EVENT_ENERGY_PACK_CHANGE); retval = mpi3mr_issue_event_notification(mrioc); if (retval) { diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 5be25fbe0e5b..9999d4c9be05 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -1500,6 +1500,36 @@ static void mpi3mr_devstatuschg_evt_th(struct mpi3mr_ioc *mrioc, } +/** + * mpi3mr_energypackchg_evt_th - Energy pack change evt tophalf + * @mrioc: Adapter instance reference + * @event_reply: Event data + * + * Identifies the new shutdown timeout value and update. + * + * Return: Nothing + */ +static void mpi3mr_energypackchg_evt_th(struct mpi3mr_ioc *mrioc, + Mpi3EventNotificationReply_t *event_reply) +{ + Mpi3EventDataEnergyPackChange_t *evtdata = + (Mpi3EventDataEnergyPackChange_t *)event_reply->EventData; + u16 shutdown_timeout = le16_to_cpu(evtdata->ShutdownTimeout); + + if (shutdown_timeout <= 0) { + ioc_warn(mrioc, + "%s :Invalid Shutdown Timeout received = %d\n", + __func__, shutdown_timeout); + return; + } + + ioc_info(mrioc, + "%s :Previous Shutdown Timeout Value = %d New Shutdown Timeout Value = %d\n", + __func__, mrioc->facts.shutdown_timeout, shutdown_timeout); + mrioc->facts.shutdown_timeout = shutdown_timeout; +} + + /** * mpi3mr_os_handle_events - Firmware event handler * @mrioc: Adapter instance reference @@ -1563,9 +1593,16 @@ void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc, process_evt_bh = 1; break; } + case MPI3_EVENT_ENERGY_PACK_CHANGE: + { + mpi3mr_energypackchg_evt_th(mrioc, event_reply); + break; + } case MPI3_EVENT_ENCL_DEVICE_STATUS_CHANGE: case MPI3_EVENT_SAS_DISCOVERY: + case MPI3_EVENT_CABLE_MGMT: case MPI3_EVENT_SAS_DEVICE_DISCOVERY_ERROR: + case MPI3_EVENT_SAS_BROADCAST_PRIMITIVE: case MPI3_EVENT_PCIE_ENUMERATION: break; default: