Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Aug 2011 12:37:23 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r224821 - in stable/7/sys/dev/mpt: . mpilib
Message-ID:  <201108131237.p7DCbNmo015885@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Sat Aug 13 12:37:23 2011
New Revision: 224821
URL: http://svn.freebsd.org/changeset/base/224821

Log:
  MFC: r224494, r224761
  
  - Send the RELSIM_ADJUST_OPENINGS in response to a MPI_EVENT_QUEUE_FULL using
    the right SIM in case the HBA is RAID-capable but the target in question is
    not a hot spare or member of a RAID volume.
  - Report the loss and addition of SAS and SATA targets detected via PHY link
    status changes and signalled by MPI_EVENT_SAS_DEVICE_STATUS_CHANGE to cam(4)
    as lost devices and trigger rescans as appropriate. Without this it can take
    quite some time until a lost device actually is no longer tried to be used,
    if it ever stops. [1]
  - Handle MPI_EVENT_IR2, MPI_EVENT_LOG_ENTRY_ADDED, MPI_EVENT_SAS_DISCOVERY
    and MPI_EVENT_SAS_PHY_LINK_STATUS silently as these serve no additional
    purpose beyond adding cryptic entries to logs.
  - Add a warning for MPI_EVENT_SAS_DISCOVERY_ERROR events, which can help
    identifying broken disks. [2]
  
  Thanks to Hans-Joerg Sirtl for providing one of the HBAs these changes were
  developed with and RIP to the mainboard that didn't survive testing them.
  
  PR:		157534 [1]
  Submitted by:	Andrew Boyer [2]

Modified:
  stable/7/sys/dev/mpt/mpilib/mpi_ioc.h
  stable/7/sys/dev/mpt/mpt_cam.c
  stable/7/sys/dev/mpt/mpt_raid.c
  stable/7/sys/dev/mpt/mpt_raid.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/mpt/mpilib/mpi_ioc.h
==============================================================================
--- stable/7/sys/dev/mpt/mpilib/mpi_ioc.h	Sat Aug 13 12:37:22 2011	(r224820)
+++ stable/7/sys/dev/mpt/mpilib/mpi_ioc.h	Sat Aug 13 12:37:23 2011	(r224821)
@@ -33,7 +33,7 @@
  *          Title:  MPI IOC, Port, Event, FW Download, and FW Upload messages
  *  Creation Date:  August 11, 2000
  *
- *    mpi_ioc.h Version:  01.05.14
+ *    mpi_ioc.h Version:  01.05.16
  *
  *  Version History
  *  ---------------
@@ -140,6 +140,16 @@
  *                      added _MULTI_PORT_DOMAIN.
  *  05-24-07  01.05.14  Added Common Boot Block type to FWDownload Request.
  *                      Added Common Boot Block type to FWUpload Request.
+ *  08-07-07  01.05.15  Added MPI_EVENT_SAS_INIT_RC_REMOVED define.
+ *                      Added MPI_EVENT_IR2_RC_DUAL_PORT_ADDED and
+ *                      MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED for IR2 event data.
+ *                      Added SASAddress field to SAS Initiator Device Table
+ *                      Overflow event data structure.
+ *  03-28-08  01.05.16  Added two new ReasonCode values to SAS Device Status
+ *                      Change Event data to indicate completion of internally
+ *                      generated task management.
+ *                      Added MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE define.
+ *                      Added MPI_EVENT_SAS_INIT_RC_INACCESSIBLE define.
  *  --------------------------------------------------------------------------
  */
 
@@ -639,6 +649,8 @@ typedef struct _EVENT_DATA_SAS_DEVICE_ST
 #define MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL   (0x0B)
 #define MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL       (0x0C)
 #define MPI_EVENT_SAS_DEV_STAT_RC_ASYNC_NOTIFICATION        (0x0D)
+#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_INTERNAL_DEV_RESET   (0x0E)
+#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_TASK_ABORT_INTERNAL  (0x0F)
 
 
 /* SCSI Event data for Queue Full event */
@@ -735,6 +747,8 @@ typedef struct _MPI_EVENT_DATA_IR2
 #define MPI_EVENT_IR2_RC_PD_REMOVED                 (0x05)
 #define MPI_EVENT_IR2_RC_FOREIGN_CFG_DETECTED       (0x06)
 #define MPI_EVENT_IR2_RC_REBUILD_MEDIUM_ERROR       (0x07)
+#define MPI_EVENT_IR2_RC_DUAL_PORT_ADDED            (0x08)
+#define MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED          (0x09)
 
 /* defines for logical disk states */
 #define MPI_LD_STATE_OPTIMAL                        (0x00)
@@ -894,6 +908,7 @@ typedef struct _EVENT_DATA_DISCOVERY_ERR
 #define MPI_EVENT_DSCVRY_ERR_DS_UNSUPPORTED_DEVICE          (0x00000800)
 #define MPI_EVENT_DSCVRY_ERR_DS_MAX_SATA_TARGETS            (0x00001000)
 #define MPI_EVENT_DSCVRY_ERR_DS_MULTI_PORT_DOMAIN           (0x00002000)
+#define MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE           (0x00004000)
 
 /* SAS SMP Error Event data */
 
@@ -929,6 +944,8 @@ typedef struct _EVENT_DATA_SAS_INIT_DEV_
 
 /* defines for the ReasonCode field of the SAS Initiator Device Status Change event */
 #define MPI_EVENT_SAS_INIT_RC_ADDED                 (0x01)
+#define MPI_EVENT_SAS_INIT_RC_REMOVED               (0x02)
+#define MPI_EVENT_SAS_INIT_RC_INACCESSIBLE          (0x03)
 
 /* SAS Initiator Device Table Overflow Event data */
 
@@ -937,6 +954,7 @@ typedef struct _EVENT_DATA_SAS_INIT_TABL
     U8                      MaxInit;                    /* 00h */
     U8                      CurrentInit;                /* 01h */
     U16                     Reserved1;                  /* 02h */
+    U64                     SASAddress;                 /* 04h */
 } EVENT_DATA_SAS_INIT_TABLE_OVERFLOW,
   MPI_POINTER PTR_EVENT_DATA_SAS_INIT_TABLE_OVERFLOW,
   MpiEventDataSasInitTableOverflow_t,

Modified: stable/7/sys/dev/mpt/mpt_cam.c
==============================================================================
--- stable/7/sys/dev/mpt/mpt_cam.c	Sat Aug 13 12:37:22 2011	(r224820)
+++ stable/7/sys/dev/mpt/mpt_cam.c	Sat Aug 13 12:37:23 2011	(r224821)
@@ -2538,7 +2538,8 @@ mpt_cam_event(struct mpt_softc *mpt, req
 		pqf->CurrentDepth = le16toh(pqf->CurrentDepth);
 		mpt_prt(mpt, "QUEUE FULL EVENT: Bus 0x%02x Target 0x%02x Depth "
 		    "%d\n", pqf->Bus, pqf->TargetID, pqf->CurrentDepth);
-		if (mpt->phydisk_sim) {
+		if (mpt->phydisk_sim && mpt_is_raid_member(mpt,
+		    pqf->TargetID) != 0) {
 			sim = mpt->phydisk_sim;
 		} else {
 			sim = mpt->sim;
@@ -2570,9 +2571,85 @@ mpt_cam_event(struct mpt_softc *mpt, req
 		mpt_prt(mpt, "IR resync update %d completed\n",
 		    (data0 >> 16) & 0xff);
 		break;
+	case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE:
+	{
+		union ccb *ccb;
+		struct cam_sim *sim;
+		struct cam_path *tmppath;
+		PTR_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE psdsc;
+
+		psdsc = (PTR_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE)msg->Data;
+		if (mpt->phydisk_sim && mpt_is_raid_member(mpt,
+		    psdsc->TargetID) != 0)
+			sim = mpt->phydisk_sim;
+		else
+			sim = mpt->sim;
+		switch(psdsc->ReasonCode) {
+		case MPI_EVENT_SAS_DEV_STAT_RC_ADDED:
+			MPTLOCK_2_CAMLOCK(mpt);
+			ccb = xpt_alloc_ccb_nowait();
+			if (ccb == NULL) {
+				mpt_prt(mpt,
+				    "unable to alloc CCB for rescan\n");
+				CAMLOCK_2_MPTLOCK(mpt);
+				break;
+			}
+			if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
+			    cam_sim_path(sim), psdsc->TargetID,
+			    CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
+				CAMLOCK_2_MPTLOCK(mpt);
+				mpt_prt(mpt,
+				    "unable to create path for rescan\n");
+				xpt_free_ccb(ccb);
+				break;
+			}
+			xpt_rescan(ccb);
+			CAMLOCK_2_MPTLOCK(mpt);
+			break;
+		case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING:
+			MPTLOCK_2_CAMLOCK(mpt);
+			if (xpt_create_path(&tmppath, NULL, cam_sim_path(sim),
+			    psdsc->TargetID, CAM_LUN_WILDCARD) !=
+			    CAM_REQ_CMP) {
+				mpt_prt(mpt,
+				    "unable to create path for async event");
+				CAMLOCK_2_MPTLOCK(mpt);
+				break;
+			}
+			xpt_async(AC_LOST_DEVICE, tmppath, NULL);
+			xpt_free_path(tmppath);
+			CAMLOCK_2_MPTLOCK(mpt);
+			break;
+		case MPI_EVENT_SAS_DEV_STAT_RC_CMPL_INTERNAL_DEV_RESET:
+		case MPI_EVENT_SAS_DEV_STAT_RC_CMPL_TASK_ABORT_INTERNAL:
+		case MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET:
+			break;
+		default:
+			mpt_lprt(mpt, MPT_PRT_WARN,
+			    "SAS device status change: Bus: 0x%02x TargetID: "
+			    "0x%02x ReasonCode: 0x%02x\n", psdsc->Bus,
+			    psdsc->TargetID, psdsc->ReasonCode);
+			break;
+		}
+		break;
+	}
+	case MPI_EVENT_SAS_DISCOVERY_ERROR:
+	{
+		PTR_EVENT_DATA_DISCOVERY_ERROR pde;
+
+		pde = (PTR_EVENT_DATA_DISCOVERY_ERROR)msg->Data;
+		pde->DiscoveryStatus = le32toh(pde->DiscoveryStatus);
+		mpt_lprt(mpt, MPT_PRT_WARN,
+		    "SAS discovery error: Port: 0x%02x Status: 0x%08x\n",
+		    pde->Port, pde->DiscoveryStatus);
+		break;
+	}
 	case MPI_EVENT_EVENT_CHANGE:
 	case MPI_EVENT_INTEGRATED_RAID:
-	case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE:
+	case MPI_EVENT_IR2:
+	case MPI_EVENT_LOG_ENTRY_ADDED:
+	case MPI_EVENT_SAS_DISCOVERY:
+	case MPI_EVENT_SAS_PHY_LINK_STATUS:
 	case MPI_EVENT_SAS_SES:
 		break;
 	default:

Modified: stable/7/sys/dev/mpt/mpt_raid.c
==============================================================================
--- stable/7/sys/dev/mpt/mpt_raid.c	Sat Aug 13 12:37:22 2011	(r224820)
+++ stable/7/sys/dev/mpt/mpt_raid.c	Sat Aug 13 12:37:23 2011	(r224821)
@@ -828,6 +828,25 @@ mpt_map_physdisk(struct mpt_softc *mpt, 
 
 /* XXX Ignores that there may be multiple busses/IOCs involved. */
 int
+mpt_is_raid_member(struct mpt_softc *mpt, target_id_t tgt)
+{
+	struct mpt_raid_disk *mpt_disk;
+	int i;
+
+	if (mpt->ioc_page2 == NULL || mpt->ioc_page2->MaxPhysDisks == 0)
+		return (0);
+	for (i = 0; i < mpt->ioc_page2->MaxPhysDisks; i++) {
+		mpt_disk = &mpt->raid_disks[i];
+		if ((mpt_disk->flags & MPT_RDF_ACTIVE) != 0 &&
+		    mpt_disk->config_page.PhysDiskID == tgt)
+			return (1);
+	}
+	return (0);
+	
+}
+
+/* XXX Ignores that there may be multiple busses/IOCs involved. */
+int
 mpt_is_raid_volume(struct mpt_softc *mpt, target_id_t tgt)
 {
 	CONFIG_PAGE_IOC_2_RAID_VOL *ioc_vol;

Modified: stable/7/sys/dev/mpt/mpt_raid.h
==============================================================================
--- stable/7/sys/dev/mpt/mpt_raid.h	Sat Aug 13 12:37:22 2011	(r224820)
+++ stable/7/sys/dev/mpt/mpt_raid.h	Sat Aug 13 12:37:23 2011	(r224821)
@@ -54,6 +54,7 @@ typedef enum {
 } mpt_raid_mwce_t;
 
 cam_status mpt_map_physdisk(struct mpt_softc *, union ccb *, target_id_t *);
+int mpt_is_raid_member(struct mpt_softc *, target_id_t);
 int mpt_is_raid_volume(struct mpt_softc *, target_id_t);
 #if	0
 cam_status



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201108131237.p7DCbNmo015885>