From nobody Thu Jun 06 10:39:27 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw16S2kS6z5MfcY; Thu, 06 Jun 2024 10:39:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw16R6L2qz4jG1; Thu, 6 Jun 2024 10:39:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717670367; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1OCWiQ0tszKxRxoHMnGoAjJ5H34uauvPc5VvLB3B+Qc=; b=YZ7IvGEJ6uJ07vAs78LRAjDhRWO+ea71E3GFPY+oE6I9ql3XEWuOhHbdTI7NF/5EzhppkW ExLgLE2TMWVKjVJa6GPp9kbVpf6rxecXuvZ8RP8yeMgxHDJx/9d2MRhSxffKlnCEeGjJCm oYyB51UArpb4oixFO0TcZ2//oTv8TzUJ7C2zTrjOmcw5BpnmQbkqkXFfi0gkJYMuud4OGM gQpBJMlSx5sywNKYsE9mjq16si7KSmhXOUfiAQbeUGKe5BFbMaoKt3KlDkKNwMcrEUGfwL G6VD0IB0jXBro+BH7l2OPArlSL3MdZn3nyymedqj4qS8dc4hE5KiiFx+K3S0Dw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670367; a=rsa-sha256; cv=none; b=Mahb92iEpvVPYVBhTkShVfagO7lOsdk/qM7FYZG6ogluRfcsJFpluytY35krEo75yEjcWc 58iJ+cgxJtKZ9mZArYpo8gpnM5H34E8uva3pxd+C15NoBorZ7tH85dKUIFfIbfN3lI8Tw5 KrPhIAyQVyn2uel8wzEOAwDoTpbYokflziz8f0vM0qoCPgS2bpQ1FSfgIOSik03m5yrRh3 rtirBJemgY7cn1LORO7VvsLGqcj49u1YVxkEHlM0ggg1qaeQ5RSvm/INwz23ftAk3PyENj fuxGJdtTCNm3gKcPEgqj4Tu4S6rwu5/r/2/lJ3MXRSGrmf+TLKkDkN9YF/3wvA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717670367; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1OCWiQ0tszKxRxoHMnGoAjJ5H34uauvPc5VvLB3B+Qc=; b=X1GiQmfDTvb1Aeqz0Tz+8XYhkTOl+KCrpX1Pvi41/mwqEpoYt0uOEQHTBqGZTR9hCACnbE NMNoeR1szfWkP+hfQeWscNzKsq+B7ZHr9byHx7BmjRdJuFyPhvzuDXRgKog1g/K7JYrbAN XwcbMDExZEiL/MXz35fx4M6egWNSq+mGWx/83HKsN4CSkRU3BP1BQmQRBJBps9zjoAKuIK De39GPE9XWzoKTfEM8H7GYQr9x6AqqG7pKpt4Wp9oQAwxQ82mwqbhKV+axOYqdHFtxI1vv zR3ILjZxXDVs1fCy+qQN9Z0Dj8E9IPOwmw17LqCMIMs9rjgmrnhDxaBacXeV9w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw16R5NXszj6v; Thu, 6 Jun 2024 10:39:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AdRrZ089868; Thu, 6 Jun 2024 10:39:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456AdRhx089865; Thu, 6 Jun 2024 10:39:27 GMT (envelope-from git) Date: Thu, 6 Jun 2024 10:39:27 GMT Message-Id: <202406061039.456AdRhx089865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Sumit Saxena Subject: git: 3012fa8faef2 - main - mpi3mr: Adding FreeBSD OS Type to Fault/Reset Reason Code List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ssaxena X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3012fa8faef262c615672fc90319c777b4e3dffc Auto-Submitted: auto-generated The branch main has been updated by ssaxena: URL: https://cgit.FreeBSD.org/src/commit/?id=3012fa8faef262c615672fc90319c777b4e3dffc commit 3012fa8faef262c615672fc90319c777b4e3dffc Author: Chandrakanth patil AuthorDate: 2024-03-19 06:56:44 +0000 Commit: Sumit Saxena CommitDate: 2024-06-06 10:39:15 +0000 mpi3mr: Adding FreeBSD OS Type to Fault/Reset Reason Code The driver is modified to add FreeBSD OS type in the upper nibble of the fault/reset reason code for appropriate qualification of the reason code. Reviewed by: imp Approved by: imp Differential revision: https://reviews.freebsd.org/D44427 --- sys/dev/mpi3mr/mpi3mr.c | 29 +++++++++++++++++++---------- sys/dev/mpi3mr/mpi3mr.h | 7 +++++-- sys/dev/mpi3mr/mpi3mr_cam.c | 2 +- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c index 916829f4a38f..c592d5734d38 100644 --- a/sys/dev/mpi3mr/mpi3mr.c +++ b/sys/dev/mpi3mr/mpi3mr.c @@ -83,7 +83,7 @@ static void mpi3mr_port_enable_complete(struct mpi3mr_softc *sc, struct mpi3mr_drvr_cmd *drvrcmd); static void mpi3mr_flush_io(struct mpi3mr_softc *sc); static int mpi3mr_issue_reset(struct mpi3mr_softc *sc, U16 reset_type, - U32 reset_reason); + U16 reset_reason); static void mpi3mr_dev_rmhs_send_tm(struct mpi3mr_softc *sc, U16 handle, struct mpi3mr_drvr_cmd *cmdparam, U8 iou_rc); static void mpi3mr_dev_rmhs_complete_iou(struct mpi3mr_softc *sc, @@ -186,7 +186,7 @@ poll_for_command_completion(struct mpi3mr_softc *sc, * Return: None. */ static void -mpi3mr_trigger_snapdump(struct mpi3mr_softc *sc, U32 reason_code) +mpi3mr_trigger_snapdump(struct mpi3mr_softc *sc, U16 reason_code) { U32 host_diagnostic, timeout = MPI3_SYSIF_DIAG_SAVE_TIMEOUT * 10; @@ -221,7 +221,7 @@ mpi3mr_trigger_snapdump(struct mpi3mr_softc *sc, U32 reason_code) * * Return: None. */ -static void mpi3mr_check_rh_fault_ioc(struct mpi3mr_softc *sc, U32 reason_code) +static void mpi3mr_check_rh_fault_ioc(struct mpi3mr_softc *sc, U16 reason_code) { U32 ioc_status; @@ -1167,9 +1167,9 @@ static inline void mpi3mr_clear_resethistory(struct mpi3mr_softc *sc) * * Return: 0 on success, -1 on failure. */ -static int mpi3mr_mur_ioc(struct mpi3mr_softc *sc, U32 reset_reason) +static int mpi3mr_mur_ioc(struct mpi3mr_softc *sc, U16 reset_reason) { - U32 ioc_config, timeout, ioc_status; + U32 ioc_config, timeout, ioc_status, scratch_pad0; int retval = -1; mpi3mr_dprint(sc, MPI3MR_INFO, "Issuing Message Unit Reset(MUR)\n"); @@ -1178,7 +1178,12 @@ static int mpi3mr_mur_ioc(struct mpi3mr_softc *sc, U32 reset_reason) return retval; } mpi3mr_clear_resethistory(sc); - mpi3mr_regwrite(sc, MPI3_SYSIF_SCRATCHPAD0_OFFSET, reset_reason); + + scratch_pad0 = ((MPI3MR_RESET_REASON_OSTYPE_FREEBSD << + MPI3MR_RESET_REASON_OSTYPE_SHIFT) | + (sc->facts.ioc_num << + MPI3MR_RESET_REASON_IOCNUM_SHIFT) | reset_reason); + mpi3mr_regwrite(sc, MPI3_SYSIF_SCRATCHPAD0_OFFSET, scratch_pad0); ioc_config = mpi3mr_regread(sc, MPI3_SYSIF_IOC_CONFIG_OFFSET); ioc_config &= ~MPI3_SYSIF_IOC_CONFIG_ENABLE_IOC; mpi3mr_regwrite(sc, MPI3_SYSIF_IOC_CONFIG_OFFSET, ioc_config); @@ -5761,11 +5766,11 @@ static inline void mpi3mr_set_diagsave(struct mpi3mr_softc *sc) * Return: 0 on success, non-zero on failure. */ static int mpi3mr_issue_reset(struct mpi3mr_softc *sc, U16 reset_type, - U32 reset_reason) + U16 reset_reason) { int retval = -1; U8 unlock_retry_count = 0; - U32 host_diagnostic, ioc_status, ioc_config; + U32 host_diagnostic, ioc_status, ioc_config, scratch_pad0; U32 timeout = MPI3MR_RESET_ACK_TIMEOUT * 10; if ((reset_type != MPI3_SYSIF_HOST_DIAG_RESET_ACTION_SOFT_RESET) && @@ -5819,7 +5824,11 @@ static int mpi3mr_issue_reset(struct mpi3mr_softc *sc, U16 reset_type, unlock_retry_count, host_diagnostic); } while (!(host_diagnostic & MPI3_SYSIF_HOST_DIAG_DIAG_WRITE_ENABLE)); - mpi3mr_regwrite(sc, MPI3_SYSIF_SCRATCHPAD0_OFFSET, reset_reason); + scratch_pad0 = ((MPI3MR_RESET_REASON_OSTYPE_FREEBSD << + MPI3MR_RESET_REASON_OSTYPE_SHIFT) | + (sc->facts.ioc_num << + MPI3MR_RESET_REASON_IOCNUM_SHIFT) | reset_reason); + mpi3mr_regwrite(sc, MPI3_SYSIF_SCRATCHPAD0_OFFSET, scratch_pad0); mpi3mr_regwrite(sc, MPI3_SYSIF_HOST_DIAG_OFFSET, host_diagnostic | reset_type); if (reset_type == MPI3_SYSIF_HOST_DIAG_RESET_ACTION_SOFT_RESET) { @@ -5898,7 +5907,7 @@ inline void mpi3mr_cleanup_event_taskq(struct mpi3mr_softc *sc) * Return: 0 on success, non-zero on failure. */ int mpi3mr_soft_reset_handler(struct mpi3mr_softc *sc, - U32 reset_reason, bool snapdump) + U16 reset_reason, bool snapdump) { int retval = 0, i = 0; enum mpi3mr_iocstate ioc_state; diff --git a/sys/dev/mpi3mr/mpi3mr.h b/sys/dev/mpi3mr/mpi3mr.h index f8f562184aae..f61c5b377b46 100644 --- a/sys/dev/mpi3mr/mpi3mr.h +++ b/sys/dev/mpi3mr/mpi3mr.h @@ -141,6 +141,9 @@ #define MAX_MGMT_ADAPTERS 8 #define MPI3MR_WAIT_BEFORE_CTRL_RESET 5 +#define MPI3MR_RESET_REASON_OSTYPE_FREEBSD 0x4 +#define MPI3MR_RESET_REASON_OSTYPE_SHIFT 28 +#define MPI3MR_RESET_REASON_IOCNUM_SHIFT 20 struct mpi3mr_mgmt_info { uint16_t count; @@ -961,7 +964,7 @@ void mpi3mr_cleanup_event_taskq(struct mpi3mr_softc *sc); void mpi3mr_hexdump(void *buf, int sz, int format); int mpi3mr_soft_reset_handler(struct mpi3mr_softc *sc, - U32 reset_reason, bool snapdump); + U16 reset_reason, bool snapdump); void mpi3mrsas_release_simq_reinit(struct mpi3mr_cam_softc *cam_sc); void @@ -983,6 +986,6 @@ void mpi3mr_set_io_divert_for_all_vd_in_tg(struct mpi3mr_softc *sc, enum mpi3mr_iocstate mpi3mr_get_iocstate(struct mpi3mr_softc *sc); void mpi3mr_poll_pend_io_completions(struct mpi3mr_softc *sc); void int_to_lun(unsigned int lun, U8 *req_lun); -void trigger_reset_from_watchdog(struct mpi3mr_softc *sc, U8 reset_type, U32 reset_reason); +void trigger_reset_from_watchdog(struct mpi3mr_softc *sc, U8 reset_type, U16 reset_reason); void mpi3mr_alloc_ioctl_dma_memory(struct mpi3mr_softc *sc); #endif /*MPI3MR_H_INCLUDED*/ diff --git a/sys/dev/mpi3mr/mpi3mr_cam.c b/sys/dev/mpi3mr/mpi3mr_cam.c index 4843aa6ea721..da6342063e87 100644 --- a/sys/dev/mpi3mr/mpi3mr_cam.c +++ b/sys/dev/mpi3mr/mpi3mr_cam.c @@ -454,7 +454,7 @@ void mpi3mr_poll_pend_io_completions(struct mpi3mr_softc *sc) } void -trigger_reset_from_watchdog(struct mpi3mr_softc *sc, U8 reset_type, U32 reset_reason) +trigger_reset_from_watchdog(struct mpi3mr_softc *sc, U8 reset_type, U16 reset_reason) { if (sc->reset_in_progress) { mpi3mr_dprint(sc, MPI3MR_INFO, "Another reset is in progress, no need to trigger the reset\n");