summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2015-01-25 22:29:23 +0000
committerscottl <scottl@FreeBSD.org>2015-01-25 22:29:23 +0000
commit588a6eb29f37c0081497dc155776215a84099f02 (patch)
treee6808c71781dffd0e4b712230e4afe34c08a0df5
parentfad3fbbf45006174f321fd2ba796cece12a8b6f3 (diff)
downloadFreeBSD-src-588a6eb29f37c0081497dc155776215a84099f02.zip
FreeBSD-src-588a6eb29f37c0081497dc155776215a84099f02.tar.gz
Fix the ioctl interface to properly support fetching the header of regular
and extended config pages. Obtained from: Netflix, Inc. MFC after: 3 days
-rw-r--r--sys/dev/mps/mps.c14
-rw-r--r--sys/dev/mps/mps_user.c4
2 files changed, 14 insertions, 4 deletions
diff --git a/sys/dev/mps/mps.c b/sys/dev/mps/mps.c
index 20c7f75..0957602 100644
--- a/sys/dev/mps/mps.c
+++ b/sys/dev/mps/mps.c
@@ -2621,9 +2621,12 @@ mps_read_config_page(struct mps_softc *sc, struct mps_config_params *params)
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, struct mps_command *cm)
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;
diff --git a/sys/dev/mps/mps_user.c b/sys/dev/mps/mps_user.c
index 16ec4e4..63f78b6 100644
--- a/sys/dev/mps/mps_user.c
+++ b/sys/dev/mps/mps_user.c
@@ -309,6 +309,10 @@ mps_user_read_extcfg_header(struct mps_softc *sc,
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
OpenPOWER on IntegriCloud