mps_sas.c (224973) | mps_sas.c (225950) |
---|---|
1/*- 2 * Copyright (c) 2009 Yahoo! Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009 Yahoo! Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/mps/mps_sas.c 224973 2011-08-18 16:07:41Z ken $"); | 28__FBSDID("$FreeBSD: head/sys/dev/mps/mps_sas.c 225950 2011-10-03 20:32:55Z ken $"); |
29 30/* Communications core for LSI MPT2 */ 31 32#include <sys/types.h> 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/selinfo.h> --- 1448 unchanged lines hidden (view full) --- 1485} 1486 1487static void 1488mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm) 1489{ 1490 MPI2_SCSI_IO_REPLY *rep; 1491 union ccb *ccb; 1492 struct mpssas_softc *sassc; | 29 30/* Communications core for LSI MPT2 */ 31 32#include <sys/types.h> 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/selinfo.h> --- 1448 unchanged lines hidden (view full) --- 1485} 1486 1487static void 1488mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm) 1489{ 1490 MPI2_SCSI_IO_REPLY *rep; 1491 union ccb *ccb; 1492 struct mpssas_softc *sassc; |
1493 u_int sense_len; | |
1494 int dir = 0; 1495 1496 mps_dprint(sc, MPS_TRACE, "%s\n", __func__); 1497 1498 callout_stop(&cm->cm_callout); 1499 TAILQ_REMOVE(&sc->io_list, cm, cm_link); 1500 sc->io_cmds_active--; 1501 --- 159 unchanged lines hidden (view full) --- 1661 break; 1662 case MPI2_SCSI_STATUS_GOOD: 1663 default: 1664 break; 1665 } 1666 } 1667 1668 if (rep->SCSIState & MPI2_SCSI_STATE_AUTOSENSE_VALID) { | 1493 int dir = 0; 1494 1495 mps_dprint(sc, MPS_TRACE, "%s\n", __func__); 1496 1497 callout_stop(&cm->cm_callout); 1498 TAILQ_REMOVE(&sc->io_list, cm, cm_link); 1499 sc->io_cmds_active--; 1500 --- 159 unchanged lines hidden (view full) --- 1660 break; 1661 case MPI2_SCSI_STATUS_GOOD: 1662 default: 1663 break; 1664 } 1665 } 1666 1667 if (rep->SCSIState & MPI2_SCSI_STATE_AUTOSENSE_VALID) { |
1669 sense_len = MIN(rep->SenseCount, 1670 sizeof(struct scsi_sense_data)); 1671 if (sense_len < rep->SenseCount) 1672 ccb->csio.sense_resid = rep->SenseCount - sense_len; | 1668 int sense_len; 1669 1670 if (rep->SenseCount < ccb->csio.sense_len) 1671 ccb->csio.sense_resid = ccb->csio.sense_len - 1672 rep->SenseCount; 1673 else 1674 ccb->csio.sense_resid = 0; 1675 1676 sense_len = min(rep->SenseCount, ccb->csio.sense_len - 1677 ccb->csio.sense_resid); |
1673 bcopy(cm->cm_sense, &ccb->csio.sense_data, sense_len); 1674 ccb->ccb_h.status |= CAM_AUTOSNS_VALID; 1675 } 1676 1677 if (rep->SCSIState & MPI2_SCSI_STATE_AUTOSENSE_FAILED) 1678 ccb->ccb_h.status = CAM_AUTOSENSE_FAIL; 1679 1680 if (rep->SCSIState & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) --- 464 unchanged lines hidden --- | 1678 bcopy(cm->cm_sense, &ccb->csio.sense_data, sense_len); 1679 ccb->ccb_h.status |= CAM_AUTOSNS_VALID; 1680 } 1681 1682 if (rep->SCSIState & MPI2_SCSI_STATE_AUTOSENSE_FAILED) 1683 ccb->ccb_h.status = CAM_AUTOSENSE_FAIL; 1684 1685 if (rep->SCSIState & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) --- 464 unchanged lines hidden --- |