diff options
author | mav <mav@FreeBSD.org> | 2012-08-01 17:31:31 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2012-08-01 17:31:31 +0000 |
commit | d35997f97e5bca6ac7e1dffebc4f7bc0bf4a168e (patch) | |
tree | 79e17377a681fc12123cfa9b9acf9d7ba8fdaf18 /sys/dev/mps/mps_user.c | |
parent | 58f7ae85c74dabb278901c6e1c4afae9578733f2 (diff) | |
download | FreeBSD-src-d35997f97e5bca6ac7e1dffebc4f7bc0bf4a168e.zip FreeBSD-src-d35997f97e5bca6ac7e1dffebc4f7bc0bf4a168e.tar.gz |
Several fixes to allow firmware/BIOS flash access from user-level:
- remove special handling of zero length transfers in mpi_pre_fw_upload();
- add missing MPS_CM_FLAGS_DATAIN flag in mpi_pre_fw_upload();
- move mps_user_setup_request() call into proper place;
- increase user command timeout from 30 to 60 seconds;
- avoid NULL dereference panic in case of firmware crash.
Set max DMA segment size to 24bit, as MPI SGE supports it.
Use mps_add_dmaseg() to add empty SGE instead of custom code.
Tune endianness safety.
Reviewed by: Desai, Kashyap <Kashyap.Desai@lsi.com>
Sponsored by: iXsystems, Inc.
Diffstat (limited to 'sys/dev/mps/mps_user.c')
-rw-r--r-- | sys/dev/mps/mps_user.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/sys/dev/mps/mps_user.c b/sys/dev/mps/mps_user.c index 98dc511..ee03573 100644 --- a/sys/dev/mps/mps_user.c +++ b/sys/dev/mps/mps_user.c @@ -534,11 +534,6 @@ mpi_pre_fw_upload(struct mps_command *cm, struct mps_usr_command *cmd) return (EINVAL); mpi_init_sge(cm, req, &req->SGL); - if (cmd->len == 0) { - /* Perhaps just asking what the size of the fw is? */ - return (0); - } - bzero(&tc, sizeof tc); /* @@ -554,6 +549,8 @@ mpi_pre_fw_upload(struct mps_command *cm, struct mps_usr_command *cmd) tc.ImageOffset = 0; tc.ImageSize = cmd->len; + cm->cm_flags |= MPS_CM_FLAGS_DATAIN; + return (mps_push_sge(cm, &tc, sizeof tc, 0)); } @@ -692,13 +689,6 @@ mps_user_command(struct mps_softc *sc, struct mps_usr_command *cmd) mps_dprint(sc, MPS_INFO, "mps_user_command: Function %02X " "MsgFlags %02X\n", hdr->Function, hdr->MsgFlags ); - err = mps_user_setup_request(cm, cmd); - if (err != 0) { - mps_printf(sc, "mps_user_command: unsupported function 0x%X\n", - hdr->Function ); - goto RetFreeUnlocked; - } - if (cmd->len > 0) { buf = malloc(cmd->len, M_MPSUSER, M_WAITOK|M_ZERO); if(!buf) { @@ -716,8 +706,15 @@ mps_user_command(struct mps_softc *sc, struct mps_usr_command *cmd) cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; + err = mps_user_setup_request(cm, cmd); + if (err != 0) { + mps_printf(sc, "mps_user_command: unsupported function 0x%X\n", + hdr->Function ); + goto RetFreeUnlocked; + } + mps_lock(sc); - err = mps_wait_command(sc, cm, 30); + err = mps_wait_command(sc, cm, 60); if (err) { mps_printf(sc, "%s: invalid request: error %d\n", @@ -726,7 +723,10 @@ mps_user_command(struct mps_softc *sc, struct mps_usr_command *cmd) } rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; - sz = rpl->MsgLength * 4; + if (rpl != NULL) + sz = rpl->MsgLength * 4; + else + sz = 0; if (sz > cmd->rpl_len) { mps_printf(sc, |