From patchwork Thu May 20 15:25:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kashyap Desai X-Patchwork-Id: 443726 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=-19.0 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, MIME_HEADER_CTYPE_ONLY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, 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 33C18C433B4 for ; Thu, 20 May 2021 15:22:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 103EC6121E for ; Thu, 20 May 2021 15:22:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231732AbhETPX2 (ORCPT ); Thu, 20 May 2021 11:23:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231960AbhETPXH (ORCPT ); Thu, 20 May 2021 11:23:07 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0598CC06138D for ; Thu, 20 May 2021 08:21:46 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id v14so9365157pgi.6 for ; Thu, 20 May 2021 08:21:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YUuRGHcO1wxLfm/HVE5CijEti3AD+gjuwv20qcA4IYY=; b=HvcuUagjMc00twe09R6ROKV26MHA9VkJ6w6kHQ92gOmfSh0IiyBu0Ws4z1M3X+b2qT bJM2KRjjW0JqFq0MSlEbaHaMhAs6ybK+Y2/vMfQYC9ZTxXGr6hJBCB2Nd8JqjWKSyxSz XQQ0EH8wKEjw2x0qFklVM7ZIxbiVZrFUQqV7U= 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:in-reply-to :references; bh=YUuRGHcO1wxLfm/HVE5CijEti3AD+gjuwv20qcA4IYY=; b=VHLtZFmMDM4X/GI/f8h1Vlnk8e49k195TtYwrejtjMeKiAotl9dBWtnT7BsnCH7fjo i/LAodnO9oQkR587B0IPISLexwSNVA95vxASZa3DWUbjvzeg8+it7O4DfecU+EY5cncD 5lgsoI0ngTJ0OmLnrigeCNzW/PlyhJC7vOC+E+bpToJPK5Lo9zKGV8msoE7GjI55XuL9 TKIHFFKJw6h9PNSfIWeFwmn7xPH8viUluW6C1qekTyUioSybU93J0KOOhx1YVFsmeOXC mD3GOxXj5JgCWGKVwtk0CyL3QMZcwJTAot+I+vCGB9bJuLSabv3jOM9pOp0pNwhGmaPN 2toQ== X-Gm-Message-State: AOAM530SG4mrdGg/GS+nZSDpe9brXMzsOtCM6lHwcbplsh+NJE+988kP NDqP4xongLF7yvxIOsvx8YmES/s2ZXv9VYau/TibdNqQN2Jmg+/K6/5lGbWgXWMSo5BqpoCoMUo P/T0O5AccFU/JZoArCH5PbXROe2YHtfWcC0pUY2aBvnbKz8TXl+nahEVHEq0USvLWyT7duZJxlG EtHPB42Q== X-Google-Smtp-Source: ABdhPJyYRM5alMRW0ZmaPxVFO1+nPzH44PAw4IDPh8lap5Z5eRYGh1ZCMc2R5Y+imP0hcsvsRAa3+g== X-Received: by 2002:a63:3686:: with SMTP id d128mr5004133pga.305.1621524105057; Thu, 20 May 2021 08:21:45 -0700 (PDT) Received: from drv-bst-rhel8.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id s8sm2250557pfe.112.2021.05.20.08.21.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 08:21:44 -0700 (PDT) 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 v6 08/24] mpi3mr: add support of event handling part-3 Date: Thu, 20 May 2021 20:55:29 +0530 Message-Id: <20210520152545.2710479-9-kashyap.desai@broadcom.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20210520152545.2710479-1-kashyap.desai@broadcom.com> References: <20210520152545.2710479-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 Reviewed-by: Hannes Reinecke Reviewed-by: Tomas Henzl Reviewed-by: Himanshu Madhani Cc: sathya.prakash@broadcom.com --- drivers/scsi/mpi3mr/mpi3mr_fw.c | 3 +++ drivers/scsi/mpi3mr/mpi3mr_os.c | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c index 6dd0869..7816e9e 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -2728,8 +2728,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 47f179d..97b6497 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -1484,6 +1484,35 @@ out: mpi3mr_tgtdev_put(tgtdev); } +/** + * 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, + struct mpi3_event_notification_reply *event_reply) +{ + struct mpi3_event_data_energy_pack_change *evtdata = + (struct mpi3_event_data_energy_pack_change *)event_reply->event_data; + u16 shutdown_timeout = le16_to_cpu(evtdata->shutdown_timeout); + + 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 @@ -1547,9 +1576,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: