svn commit: r278240 - stable/10/sys/dev/mps

Scott Long scottl at FreeBSD.org
Thu Feb 5 09:29:58 UTC 2015


Author: scottl
Date: Thu Feb  5 09:29:57 2015
New Revision: 278240
URL: https://svnweb.freebsd.org/changeset/base/278240

Log:
  MFC 277717:
  
  Fix the ioctl interface to properly support fetching the header of regular
  and extended config pages.
  
  Obtained from:	Netflix, Inc.

Modified:
  stable/10/sys/dev/mps/mps.c
  stable/10/sys/dev/mps/mps_user.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mps/mps.c
==============================================================================
--- stable/10/sys/dev/mps/mps.c	Thu Feb  5 08:52:20 2015	(r278239)
+++ stable/10/sys/dev/mps/mps.c	Thu Feb  5 09:29:57 2015	(r278240)
@@ -2621,9 +2621,12 @@ mps_read_config_page(struct mps_softc *s
 
 	cm->cm_data = params->buffer;
 	cm->cm_length = params->length;
-	cm->cm_sge = &req->PageBufferSGE;
-	cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION);
-	cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE | MPS_CM_FLAGS_DATAIN;
+	if (cm->cm_data != NULL) {
+		cm->cm_sge = &req->PageBufferSGE;
+		cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION);
+		cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE | MPS_CM_FLAGS_DATAIN;
+	} else
+		cm->cm_sge = NULL;
 	cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
 
 	cm->cm_complete_data = params;
@@ -2680,9 +2683,12 @@ mps_config_complete(struct mps_softc *sc
 		goto done;
 	}
 	params->status = reply->IOCStatus;
-	if (params->hdr.Ext.ExtPageType != 0) {
+	if (params->hdr.Struct.PageType == MPI2_CONFIG_PAGETYPE_EXTENDED) {
 		params->hdr.Ext.ExtPageType = reply->ExtPageType;
 		params->hdr.Ext.ExtPageLength = reply->ExtPageLength;
+		params->hdr.Ext.PageType = reply->Header.PageType;
+		params->hdr.Ext.PageNumber = reply->Header.PageNumber;
+		params->hdr.Ext.PageVersion = reply->Header.PageVersion;
 	} else {
 		params->hdr.Struct.PageType = reply->Header.PageType;
 		params->hdr.Struct.PageNumber = reply->Header.PageNumber;

Modified: stable/10/sys/dev/mps/mps_user.c
==============================================================================
--- stable/10/sys/dev/mps/mps_user.c	Thu Feb  5 08:52:20 2015	(r278239)
+++ stable/10/sys/dev/mps/mps_user.c	Thu Feb  5 09:29:57 2015	(r278240)
@@ -309,6 +309,10 @@ mps_user_read_extcfg_header(struct mps_s
 	hdr->PageNumber = ext_page_req->header.PageNumber;
 	hdr->ExtPageType = ext_page_req->header.ExtPageType;
 	params.page_address = le32toh(ext_page_req->page_address);
+	params.buffer = NULL;
+	params.length = 0;
+	params.callback = NULL;
+
 	if ((error = mps_read_config_page(sc, &params)) != 0) {
 		/*
 		 * Leave the request. Without resetting the chip, it's


More information about the svn-src-all mailing list