From 042808f74707d3ce89e89463d4a03f81df6fd45a Mon Sep 17 00:00:00 2001 From: Chandrakanth patil Date: Thu, 14 Mar 2024 22:44:53 +0530 Subject: [PATCH] mpi3mr: Controller state check before enabling PEL Reviewed by: imp Approved by: imp Differential revision: https://reviews.freebsd.org/D44422 --- sys/dev/mpi3mr/mpi3mr_app.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/dev/mpi3mr/mpi3mr_app.c b/sys/dev/mpi3mr/mpi3mr_app.c index 7bd92626901..60ef6765cb7 100644 --- a/sys/dev/mpi3mr/mpi3mr_app.c +++ b/sys/dev/mpi3mr/mpi3mr_app.c @@ -1641,6 +1641,18 @@ mpi3mr_pel_enable(struct mpi3mr_softc *sc, struct mpi3mr_ioctl_pel_enable pel_enable; mpi3mr_dprint(sc, MPI3MR_TRACE, "%s() line: %d\n", __func__, __LINE__); + if (sc->unrecoverable) { + device_printf(sc->mpi3mr_dev, "Issue IOCTL: controller is in unrecoverable state\n"); + return EFAULT; + } + if (sc->reset_in_progress) { + device_printf(sc->mpi3mr_dev, "Issue IOCTL: reset in progress\n"); + return EAGAIN; + } + if (sc->block_ioctls) { + device_printf(sc->mpi3mr_dev, "Issue IOCTL: IOCTLs are blocked\n"); + return EAGAIN; + } if ((data_out_sz != sizeof(pel_enable) || (pel_enable.pel_class > MPI3_PEL_CLASS_FAULT))) {