isp_sbus.c (316408) | isp_sbus.c (317360) |
---|---|
1/*- 2 * Copyright (c) 1997-2006 by Matthew Jacob 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 --- 15 unchanged lines hidden (view full) --- 24 * SUCH DAMAGE. 25 */ 26/* 27 * SBus specific probe and attach routines for Qlogic ISP SCSI adapters. 28 * FreeBSD Version. 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997-2006 by Matthew Jacob 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 --- 15 unchanged lines hidden (view full) --- 24 * SUCH DAMAGE. 25 */ 26/* 27 * SBus specific probe and attach routines for Qlogic ISP SCSI adapters. 28 * FreeBSD Version. 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: stable/11/sys/dev/isp/isp_sbus.c 316408 2017-04-02 10:58:55Z mav $"); | 32__FBSDID("$FreeBSD: stable/11/sys/dev/isp/isp_sbus.c 317360 2017-04-24 10:21:13Z mav $"); |
33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/linker.h> 37#include <sys/firmware.h> 38#include <sys/bus.h> 39#include <sys/kernel.h> 40#include <sys/module.h> --- 546 unchanged lines hidden (view full) --- 587 int error; 588} mush_t; 589 590#define MUSHERR_NOQENTRIES -2 591 592static void 593dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) 594{ | 33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/linker.h> 37#include <sys/firmware.h> 38#include <sys/bus.h> 39#include <sys/kernel.h> 40#include <sys/module.h> --- 546 unchanged lines hidden (view full) --- 587 int error; 588} mush_t; 589 590#define MUSHERR_NOQENTRIES -2 591 592static void 593dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) 594{ |
595 mush_t *mp; 596 ispsoftc_t *isp; 597 struct ccb_scsiio *csio; | 595 mush_t *mp = (mush_t *) arg; 596 ispsoftc_t *isp = mp->isp; 597 struct ccb_scsiio *csio = mp->cmd_token; |
598 isp_ddir_t ddir; | 598 isp_ddir_t ddir; |
599 ispreq_t *rq; | 599 int sdir; |
600 | 600 |
601 mp = (mush_t *) arg; | |
602 if (error) { 603 mp->error = error; 604 return; 605 } | 601 if (error) { 602 mp->error = error; 603 return; 604 } |
606 csio = mp->cmd_token; 607 isp = mp->isp; 608 rq = mp->rq; 609 if (nseg) { | 605 if (nseg == 0) { 606 ddir = ISP_NOXFR; 607 } else { |
610 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { | 608 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { |
611 bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); | |
612 ddir = ISP_FROM_DEVICE; | 609 ddir = ISP_FROM_DEVICE; |
613 } else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { 614 bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE); | 610 } else { |
615 ddir = ISP_TO_DEVICE; | 611 ddir = ISP_TO_DEVICE; |
612 } 613 if ((csio->ccb_h.func_code == XPT_CONT_TARGET_IO) ^ 614 ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)) { 615 sdir = BUS_DMASYNC_PREREAD; |
|
616 } else { | 616 } else { |
617 ddir = ISP_NOXFR; | 617 sdir = BUS_DMASYNC_PREWRITE; |
618 } | 618 } |
619 } else { 620 dm_segs = NULL; 621 nseg = 0; 622 ddir = ISP_NOXFR; | 619 bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, 620 sdir); |
623 } 624 | 621 } 622 |
625 if (isp_send_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, NULL) != CMD_QUEUED) { | 623 if (isp_send_cmd(isp, mp->rq, dm_segs, nseg, XS_XFRLEN(csio), 624 ddir, NULL) != CMD_QUEUED) { |
626 mp->error = MUSHERR_NOQENTRIES; 627 } 628} 629 630static int 631isp_sbus_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, void *ff) 632{ 633 mush_t mush, *mp; --- 67 unchanged lines hidden --- | 625 mp->error = MUSHERR_NOQENTRIES; 626 } 627} 628 629static int 630isp_sbus_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, void *ff) 631{ 632 mush_t mush, *mp; --- 67 unchanged lines hidden --- |