changeset 11693:0a223da9570a

6926075 hotplug operations on LCC cause lost of expanders 6925344 driver should validate SAS address before reporting into target map
author David Hollister <David.Hollister@Sun.COM>
date Thu, 18 Feb 2010 13:49:11 -0700
parents 8795ed2df6db
children c35b670c8a4f
files usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_attach.c usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_scsa.c usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_subr.c
diffstat 3 files changed, 23 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_attach.c	Thu Feb 18 12:52:39 2010 -0700
+++ b/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_attach.c	Thu Feb 18 13:49:11 2010 -0700
@@ -263,8 +263,7 @@
 
 	pwp = ddi_get_soft_state(pmcs_softc_state, hba_inst);
 	if (pwp == NULL) {
-		pmcs_prt(pwp, PMCS_PRT_DEBUG, NULL, NULL,
-		    "%s: iport%d attach invoked with NULL parent (HBA) node)",
+		cmn_err(CE_WARN, "%s: No HBA softstate for instance %d",
 		    __func__, inst);
 		return (DDI_FAILURE);
 	}
--- a/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_scsa.c	Thu Feb 18 12:52:39 2010 -0700
+++ b/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_scsa.c	Thu Feb 18 13:49:11 2010 -0700
@@ -3154,6 +3154,7 @@
 	}
 
 	tgt = ddi_soft_state_bystr_get(iport->tgt_sstate, unit_address);
+	ASSERT(tgt != NULL);
 	STAILQ_INIT(&tgt->wq);
 	STAILQ_INIT(&tgt->aq);
 	STAILQ_INIT(&tgt->sq);
--- a/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_subr.c	Thu Feb 18 12:52:39 2010 -0700
+++ b/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_subr.c	Thu Feb 18 13:49:11 2010 -0700
@@ -2830,6 +2830,16 @@
 			goto next_phy;
 		}
 
+		/*
+		 * Validate the PHY's SAS address
+		 */
+		if (((lphyp->sas_address[0] & 0xf0) >> 4) != NAA_IEEE_REG) {
+			pmcs_prt(pwp, PMCS_PRT_ERR, lphyp, NULL,
+			    "PHY 0x%p (%s) has invalid SAS address; "
+			    "will not enumerate", (void *)lphyp, lphyp->path);
+			goto next_phy;
+		}
+
 		wwn = pmcs_barray2wwn(lphyp->sas_address);
 		ua = scsi_wwn_to_wwnstr(wwn, 1, NULL);
 
@@ -4189,6 +4199,9 @@
 		case PMCOUT_STATUS_IO_XFER_OPEN_RETRY_TIMEOUT:
 			DFM(nag, "Open Retry Timeout");
 			/* FALLTHROUGH */
+		case PMCOUT_STATUS_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY:
+			DFM(nag, "HW Resource Busy");
+			/* FALLTHROUGH */
 		case PMCOUT_STATUS_SMP_RESP_CONNECTION_ERROR:
 			DFM(nag, "Response Connection Error");
 			pmcs_prt(pwp, PMCS_PRT_DEBUG, pptr, NULL,
@@ -4425,6 +4438,9 @@
 		case PMCOUT_STATUS_IO_XFER_OPEN_RETRY_TIMEOUT:
 			DFM(nag, "Open Retry Timeout");
 			/* FALLTHROUGH */
+		case PMCOUT_STATUS_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY:
+			DFM(nag, "HW Resource Busy");
+			/* FALLTHROUGH */
 		case PMCOUT_STATUS_SMP_RESP_CONNECTION_ERROR:
 			DFM(nag, "Response Connection Error");
 			pmcs_prt(pwp, PMCS_PRT_DEBUG, pptr, NULL,
@@ -4577,7 +4593,7 @@
 		 * use that for the SAS Address for this device.
 		 */
 		if (expander->tolerates_sas2 && pptr->dtype == SATA &&
-		    (roff[SAS_ATTACHED_NAME_OFFSET] >> 8) == 0x5) {
+		    (roff[SAS_ATTACHED_NAME_OFFSET] >> 8) == NAA_IEEE_REG) {
 			(void) memcpy(pptr->sas_address,
 			    &roff[SAS_ATTACHED_NAME_OFFSET], 8);
 		} else {
@@ -5521,6 +5537,8 @@
 		return ("DEVICE STATE NON-OPERATIONAL");
 	case PMCOUT_STATUS_IO_DS_IN_RECOVERY:
 		return ("DEVICE STATE IN RECOVERY");
+	case PMCOUT_STATUS_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY:
+		return ("OPEN CNX ERR HW RESOURCE BUSY");
 	default:
 		return (NULL);
 	}
@@ -5879,8 +5897,8 @@
 		break;
 	default:
 		pmcs_prt(pwp, PMCS_PRT_INFO, NULL, NULL,
-		    "FIS: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x",
-		    fis[0], fis[1], fis[2], fis[3], fis[4], fis[5], fis[6]);
+		    "FIS: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x",
+		    fis[0], fis[1], fis[2], fis[3], fis[4]);
 		break;
 	}
 }