Date: Wed, 5 Dec 2012 02:47:06 +0000 (UTC) From: Jeff Roberson <jeff@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r243874 - in projects/physbio/sys: conf dev/advansys dev/aha dev/ahb dev/ahci dev/aic7xxx dev/arcmsr dev/ata dev/buslogic dev/ciss dev/dpt dev/firewire dev/hpt27xx dev/hptiop dev/hptmv ... Message-ID: <201212050247.qB52l6Zk041305@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jeff Date: Wed Dec 5 02:47:06 2012 New Revision: 243874 URL: http://svnweb.freebsd.org/changeset/base/243874 Log: - Implement the MI bus_dmamap_load_ccb() to load cam control blocks into physical segment lists. - Convert most cam drivers to use bus_dmamap_load_ccb() Sponsored by: EMC / Isilon Storage Division Added: projects/physbio/sys/kern/subr_busdma.c Modified: projects/physbio/sys/conf/files projects/physbio/sys/dev/advansys/advansys.c projects/physbio/sys/dev/advansys/adwcam.c projects/physbio/sys/dev/aha/aha.c projects/physbio/sys/dev/ahb/ahb.c projects/physbio/sys/dev/ahci/ahci.c projects/physbio/sys/dev/aic7xxx/aic79xx_osm.c projects/physbio/sys/dev/aic7xxx/aic7xxx_osm.c projects/physbio/sys/dev/arcmsr/arcmsr.c projects/physbio/sys/dev/ata/ata-dma.c projects/physbio/sys/dev/buslogic/bt.c projects/physbio/sys/dev/ciss/ciss.c projects/physbio/sys/dev/ciss/cissvar.h projects/physbio/sys/dev/dpt/dpt_scsi.c projects/physbio/sys/dev/firewire/sbp.c projects/physbio/sys/dev/hpt27xx/osm_bsd.c projects/physbio/sys/dev/hptiop/hptiop.c projects/physbio/sys/dev/hptmv/entry.c projects/physbio/sys/dev/hptrr/hptrr_osm_bsd.c projects/physbio/sys/dev/iir/iir.c projects/physbio/sys/dev/isci/isci_io_request.c projects/physbio/sys/dev/isp/isp_pci.c projects/physbio/sys/dev/isp/isp_sbus.c projects/physbio/sys/dev/mfi/mfi.c projects/physbio/sys/dev/mfi/mfi_cam.c projects/physbio/sys/dev/mfi/mfivar.h projects/physbio/sys/dev/mly/mly.c projects/physbio/sys/dev/mly/mlyvar.h projects/physbio/sys/dev/mps/mps.c projects/physbio/sys/dev/mps/mps_sas.c projects/physbio/sys/dev/mps/mpsvar.h projects/physbio/sys/dev/mpt/mpt_cam.c projects/physbio/sys/dev/mvs/mvs.c projects/physbio/sys/dev/siis/siis.c projects/physbio/sys/dev/sym/sym_hipd.c projects/physbio/sys/dev/trm/trm.c projects/physbio/sys/dev/twa/tw_osl.h projects/physbio/sys/dev/twa/tw_osl_cam.c projects/physbio/sys/dev/twa/tw_osl_freebsd.c projects/physbio/sys/dev/tws/tws.h projects/physbio/sys/dev/tws/tws_cam.c projects/physbio/sys/powerpc/ps3/ps3cdrom.c projects/physbio/sys/sys/bus_dma.h Modified: projects/physbio/sys/conf/files ============================================================================== --- projects/physbio/sys/conf/files Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/conf/files Wed Dec 5 02:47:06 2012 (r243874) @@ -2671,6 +2671,7 @@ kern/subr_acl_posix1e.c optional ufs_ac kern/subr_autoconf.c standard kern/subr_blist.c standard kern/subr_bus.c standard +kern/subr_busdma.c standard kern/subr_bufring.c standard kern/subr_clock.c standard kern/subr_devstat.c standard Modified: projects/physbio/sys/dev/advansys/advansys.c ============================================================================== --- projects/physbio/sys/dev/advansys/advansys.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/advansys/advansys.c Wed Dec 5 02:47:06 2012 (r243874) @@ -207,6 +207,7 @@ adv_action(struct cam_sim *sim, union cc struct ccb_hdr *ccb_h; struct ccb_scsiio *csio; struct adv_ccb_info *cinfo; + int error; ccb_h = &ccb->ccb_h; csio = &ccb->csio; @@ -217,58 +218,17 @@ adv_action(struct cam_sim *sim, union cc ccb_h->ccb_cinfo_ptr = cinfo; cinfo->ccb = ccb; - /* Only use S/G if there is a transfer */ - if ((ccb_h->flags & CAM_DIR_MASK) != CAM_DIR_NONE) { - if ((ccb_h->flags & CAM_SCATTER_VALID) == 0) { - /* - * We've been given a pointer - * to a single buffer - */ - if ((ccb_h->flags & CAM_DATA_PHYS) == 0) { - int error; - - error = - bus_dmamap_load(adv->buffer_dmat, - cinfo->dmamap, - csio->data_ptr, - csio->dxfer_len, - adv_execute_ccb, - csio, /*flags*/0); - if (error == EINPROGRESS) { - /* - * So as to maintain ordering, - * freeze the controller queue - * until our mapping is - * returned. - */ - adv_set_state(adv, - ADV_BUSDMA_BLOCK); - } - } else { - struct bus_dma_segment seg; - - /* Pointer to physical buffer */ - seg.ds_addr = - (bus_addr_t)csio->data_ptr; - seg.ds_len = csio->dxfer_len; - adv_execute_ccb(csio, &seg, 1, 0); - } - } else { - struct bus_dma_segment *segs; - if ((ccb_h->flags & CAM_DATA_PHYS) != 0) - panic("adv_setup_data - Physical " - "segment pointers unsupported"); - - if ((ccb_h->flags & CAM_SG_LIST_PHYS) == 0) - panic("adv_setup_data - Virtual " - "segment addresses unsupported"); - - /* Just use the segments provided */ - segs = (struct bus_dma_segment *)csio->data_ptr; - adv_execute_ccb(ccb, segs, csio->sglist_cnt, 0); - } - } else { - adv_execute_ccb(ccb, NULL, 0, 0); + error = bus_dmamap_load_ccb(adv->buffer_dmat, + cinfo->dmamap, + ccb, + adv_execute_ccb, + csio, /*flags*/0); + if (error == EINPROGRESS) { + /* + * So as to maintain ordering, freeze the controller + * queue until our mapping is returned. + */ + adv_set_state(adv, ADV_BUSDMA_BLOCK); } break; } Modified: projects/physbio/sys/dev/advansys/adwcam.c ============================================================================== --- projects/physbio/sys/dev/advansys/adwcam.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/advansys/adwcam.c Wed Dec 5 02:47:06 2012 (r243874) @@ -353,6 +353,7 @@ adw_action(struct cam_sim *sim, union cc struct ccb_scsiio *csio; struct ccb_hdr *ccbh; struct acb *acb; + int error; csio = &ccb->csio; ccbh = &ccb->ccb_h; @@ -427,66 +428,18 @@ adw_action(struct cam_sim *sim, union cc acb->queue.cdb, csio->cdb_len); } - /* - * If we have any data to send with this command, - * map it into bus space. - */ - if ((ccbh->flags & CAM_DIR_MASK) != CAM_DIR_NONE) { - if ((ccbh->flags & CAM_SCATTER_VALID) == 0) { - /* - * We've been given a pointer - * to a single buffer. - */ - if ((ccbh->flags & CAM_DATA_PHYS) == 0) { - int error; - - error = - bus_dmamap_load(adw->buffer_dmat, - acb->dmamap, - csio->data_ptr, - csio->dxfer_len, - adwexecuteacb, - acb, /*flags*/0); - if (error == EINPROGRESS) { - /* - * So as to maintain ordering, - * freeze the controller queue - * until our mapping is - * returned. - */ - xpt_freeze_simq(sim, 1); - acb->state |= CAM_RELEASE_SIMQ; - } - } else { - struct bus_dma_segment seg; - - /* Pointer to physical buffer */ - seg.ds_addr = - (bus_addr_t)csio->data_ptr; - seg.ds_len = csio->dxfer_len; - adwexecuteacb(acb, &seg, 1, 0); - } - } else { - struct bus_dma_segment *segs; - - if ((ccbh->flags & CAM_DATA_PHYS) != 0) - panic("adw_action - Physical " - "segment pointers " - "unsupported"); - - if ((ccbh->flags&CAM_SG_LIST_PHYS)==0) - panic("adw_action - Virtual " - "segment addresses " - "unsupported"); - - /* Just use the segments provided */ - segs = (struct bus_dma_segment *)csio->data_ptr; - adwexecuteacb(acb, segs, csio->sglist_cnt, - (csio->sglist_cnt < ADW_SGSIZE) - ? 0 : EFBIG); - } - } else { - adwexecuteacb(acb, NULL, 0, 0); + error = bus_dmamap_load_ccb(adw->buffer_dmat, + acb->dmamap, + ccb, + adwexecuteacb, + acb, /*flags*/0); + if (error == EINPROGRESS) { + /* + * So as to maintain ordering, freeze the controller + * queue until our mapping is returned. + */ + xpt_freeze_simq(sim, 1); + acb->state |= CAM_RELEASE_SIMQ; } break; } Modified: projects/physbio/sys/dev/aha/aha.c ============================================================================== --- projects/physbio/sys/dev/aha/aha.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/aha/aha.c Wed Dec 5 02:47:06 2012 (r243874) @@ -778,6 +778,7 @@ ahaaction(struct cam_sim *sim, union ccb if (ccb->ccb_h.func_code == XPT_SCSI_IO) { struct ccb_scsiio *csio; struct ccb_hdr *ccbh; + int error; csio = &ccb->csio; ccbh = &csio->ccb_h; @@ -811,67 +812,22 @@ ahaaction(struct cam_sim *sim, union ccb * If we have any data to send with this command, * map it into bus space. */ - /* Only use S/G if there is a transfer */ - if ((ccbh->flags & CAM_DIR_MASK) != CAM_DIR_NONE) { - if ((ccbh->flags & CAM_SCATTER_VALID) == 0) { - /* - * We've been given a pointer - * to a single buffer. - */ - if ((ccbh->flags & CAM_DATA_PHYS)==0) { - int error; - - error = bus_dmamap_load( - aha->buffer_dmat, - accb->dmamap, - csio->data_ptr, - csio->dxfer_len, - ahaexecuteccb, - accb, - /*flags*/0); - if (error == EINPROGRESS) { - /* - * So as to maintain - * ordering, freeze the - * controller queue - * until our mapping is - * returned. - */ - xpt_freeze_simq(aha->sim, - 1); - csio->ccb_h.status |= - CAM_RELEASE_SIMQ; - } - } else { - struct bus_dma_segment seg; - - /* Pointer to physical buffer */ - seg.ds_addr = - (bus_addr_t)csio->data_ptr; - seg.ds_len = csio->dxfer_len; - ahaexecuteccb(accb, &seg, 1, 0); - } - } else { - struct bus_dma_segment *segs; - if ((ccbh->flags & CAM_DATA_PHYS) != 0) - panic("ahaaction - Physical " - "segment pointers " - "unsupported"); - - if ((ccbh->flags&CAM_SG_LIST_PHYS)==0) - panic("ahaaction - Virtual " - "segment addresses " - "unsupported"); - - /* Just use the segments provided */ - segs = (struct bus_dma_segment *) - csio->data_ptr; - ahaexecuteccb(accb, segs, - csio->sglist_cnt, 0); - } - } else { - ahaexecuteccb(accb, NULL, 0, 0); + error = bus_dmamap_load_ccb( + aha->buffer_dmat, + accb->dmamap, + ccb, + ahaexecuteccb, + accb, + /*flags*/0); + if (error == EINPROGRESS) { + /* + * So as to maintain ordering, freeze the + * controller queue until our mapping is + * returned. + */ + xpt_freeze_simq(aha->sim, 1); + csio->ccb_h.status |= CAM_RELEASE_SIMQ; } } else { hccb->opcode = INITIATOR_BUS_DEV_RESET; Modified: projects/physbio/sys/dev/ahb/ahb.c ============================================================================== --- projects/physbio/sys/dev/ahb/ahb.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/ahb/ahb.c Wed Dec 5 02:47:06 2012 (r243874) @@ -1056,65 +1056,19 @@ ahbaction(struct cam_sim *sim, union ccb hecb->cdb, hecb->cdb_len); } - /* - * If we have any data to send with this command, - * map it into bus space. - */ - if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { - if ((ccb->ccb_h.flags & CAM_SCATTER_VALID) == 0) { - /* - * We've been given a pointer - * to a single buffer. - */ - if ((ccb->ccb_h.flags & CAM_DATA_PHYS)==0) { - int error; - - error = bus_dmamap_load( - ahb->buffer_dmat, - ecb->dmamap, - ccb->csio.data_ptr, - ccb->csio.dxfer_len, - ahbexecuteecb, - ecb, /*flags*/0); - if (error == EINPROGRESS) { - /* - * So as to maintain ordering, - * freeze the controller queue - * until our mapping is - * returned. - */ - xpt_freeze_simq(ahb->sim, 1); - ccb->ccb_h.status |= - CAM_RELEASE_SIMQ; - } - } else { - struct bus_dma_segment seg; - - /* Pointer to physical buffer */ - seg.ds_addr = - (bus_addr_t)ccb->csio.data_ptr; - seg.ds_len = ccb->csio.dxfer_len; - ahbexecuteecb(ecb, &seg, 1, 0); - } - } else { - struct bus_dma_segment *segs; - - if ((ccb->ccb_h.flags & CAM_DATA_PHYS) != 0) - panic("ahbaction - Physical segment " - "pointers unsupported"); - - if ((ccb->ccb_h.flags & CAM_SG_LIST_PHYS) == 0) - panic("btaction - Virtual segment " - "addresses unsupported"); - - /* Just use the segments provided */ - segs = (struct bus_dma_segment *) - ccb->csio.data_ptr; - ahbexecuteecb(ecb, segs, ccb->csio.sglist_cnt, - 0); - } - } else { - ahbexecuteecb(ecb, NULL, 0, 0); + error = bus_dmamap_load_ccb( + ahb->buffer_dmat, + ecb->dmamap, + ccb, + ahbexecuteecb, + ecb, /*flags*/0); + if (error == EINPROGRESS) { + /* + * So as to maintain ordering, freeze the controller + * queue until our mapping is returned. + */ + xpt_freeze_simq(ahb->sim, 1); + ccb->ccb_h.status |= CAM_RELEASE_SIMQ; } break; } Modified: projects/physbio/sys/dev/ahci/ahci.c ============================================================================== --- projects/physbio/sys/dev/ahci/ahci.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/ahci/ahci.c Wed Dec 5 02:47:06 2012 (r243874) @@ -1667,23 +1667,8 @@ ahci_begin_transaction(device_t dev, uni (ccb->ataio.cmd.flags & (CAM_ATAIO_CONTROL | CAM_ATAIO_NEEDRESULT))) ch->aslots |= (1 << slot->slot); slot->dma.nsegs = 0; - /* If request moves data, setup and load SG list */ - if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { - void *buf; - bus_size_t size; - - slot->state = AHCI_SLOT_LOADING; - if (ccb->ccb_h.func_code == XPT_ATA_IO) { - buf = ccb->ataio.data_ptr; - size = ccb->ataio.dxfer_len; - } else { - buf = ccb->csio.data_ptr; - size = ccb->csio.dxfer_len; - } - bus_dmamap_load(ch->dma.data_tag, slot->dma.data_map, - buf, size, ahci_dmasetprd, slot, 0); - } else - ahci_execute_transaction(slot); + bus_dmamap_load_ccb(ch->dma.data_tag, slot->dma.data_map, ccb, + ahci_dmasetprd, slot, 0); } /* Locked by busdma engine. */ Modified: projects/physbio/sys/dev/aic7xxx/aic79xx_osm.c ============================================================================== --- projects/physbio/sys/dev/aic7xxx/aic79xx_osm.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/aic7xxx/aic79xx_osm.c Wed Dec 5 02:47:06 2012 (r243874) @@ -1071,6 +1071,7 @@ ahd_setup_data(struct ahd_softc *ahd, st { struct hardware_scb *hscb; struct ccb_hdr *ccb_h; + int error; hscb = scb->hscb; ccb_h = &csio->ccb_h; @@ -1120,64 +1121,18 @@ ahd_setup_data(struct ahd_softc *ahd, st } } - /* Only use S/G if there is a transfer */ - if ((ccb_h->flags & CAM_DIR_MASK) != CAM_DIR_NONE) { - if ((ccb_h->flags & CAM_SCATTER_VALID) == 0) { - /* We've been given a pointer to a single buffer */ - if ((ccb_h->flags & CAM_DATA_PHYS) == 0) { - int s; - int error; - - s = splsoftvm(); - error = bus_dmamap_load(ahd->buffer_dmat, - scb->dmamap, - csio->data_ptr, - csio->dxfer_len, - ahd_execute_scb, - scb, /*flags*/0); - if (error == EINPROGRESS) { - /* - * So as to maintain ordering, - * freeze the controller queue - * until our mapping is - * returned. - */ - xpt_freeze_simq(sim, - /*count*/1); - scb->io_ctx->ccb_h.status |= - CAM_RELEASE_SIMQ; - } - splx(s); - } else { - struct bus_dma_segment seg; - - /* Pointer to physical buffer */ - if (csio->dxfer_len > AHD_MAXTRANSFER_SIZE) - panic("ahd_setup_data - Transfer size " - "larger than can device max"); - - seg.ds_addr = - (bus_addr_t)(vm_offset_t)csio->data_ptr; - seg.ds_len = csio->dxfer_len; - ahd_execute_scb(scb, &seg, 1, 0); - } - } else { - struct bus_dma_segment *segs; - - if ((ccb_h->flags & CAM_DATA_PHYS) != 0) - panic("ahd_setup_data - Physical segment " - "pointers unsupported"); - - if ((ccb_h->flags & CAM_SG_LIST_PHYS) == 0) - panic("ahd_setup_data - Virtual segment " - "addresses unsupported"); - - /* Just use the segments provided */ - segs = (struct bus_dma_segment *)csio->data_ptr; - ahd_execute_scb(scb, segs, csio->sglist_cnt, 0); - } - } else { - ahd_execute_scb(scb, NULL, 0, 0); + error = bus_dmamap_load_ccb(ahd->buffer_dmat, + scb->dmamap, + (union ccb *)csio, + ahd_execute_scb, + scb, /*flags*/0); + if (error == EINPROGRESS) { + /* + * So as to maintain ordering, freeze the controller queue + * until our mapping is returned. + */ + xpt_freeze_simq(sim, /*count*/1); + scb->io_ctx->ccb_h.status |= CAM_RELEASE_SIMQ; } } Modified: projects/physbio/sys/dev/aic7xxx/aic7xxx_osm.c ============================================================================== --- projects/physbio/sys/dev/aic7xxx/aic7xxx_osm.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/aic7xxx/aic7xxx_osm.c Wed Dec 5 02:47:06 2012 (r243874) @@ -1138,6 +1138,7 @@ ahc_setup_data(struct ahc_softc *ahc, st { struct hardware_scb *hscb; struct ccb_hdr *ccb_h; + int error; hscb = scb->hscb; ccb_h = &csio->ccb_h; @@ -1179,64 +1180,21 @@ ahc_setup_data(struct ahc_softc *ahc, st } } - /* Only use S/G if there is a transfer */ - if ((ccb_h->flags & CAM_DIR_MASK) != CAM_DIR_NONE) { - if ((ccb_h->flags & CAM_SCATTER_VALID) == 0) { - /* We've been given a pointer to a single buffer */ - if ((ccb_h->flags & CAM_DATA_PHYS) == 0) { - int s; - int error; - - s = splsoftvm(); - error = bus_dmamap_load(ahc->buffer_dmat, - scb->dmamap, - csio->data_ptr, - csio->dxfer_len, - ahc_execute_scb, - scb, /*flags*/0); - if (error == EINPROGRESS) { - /* - * So as to maintain ordering, - * freeze the controller queue - * until our mapping is - * returned. - */ - xpt_freeze_simq(sim, - /*count*/1); - scb->io_ctx->ccb_h.status |= - CAM_RELEASE_SIMQ; - } - splx(s); - } else { - struct bus_dma_segment seg; - - /* Pointer to physical buffer */ - if (csio->dxfer_len > AHC_MAXTRANSFER_SIZE) - panic("ahc_setup_data - Transfer size " - "larger than can device max"); - - seg.ds_addr = - (bus_addr_t)(vm_offset_t)csio->data_ptr; - seg.ds_len = csio->dxfer_len; - ahc_execute_scb(scb, &seg, 1, 0); - } - } else { - struct bus_dma_segment *segs; - - if ((ccb_h->flags & CAM_DATA_PHYS) != 0) - panic("ahc_setup_data - Physical segment " - "pointers unsupported"); - - if ((ccb_h->flags & CAM_SG_LIST_PHYS) == 0) - panic("ahc_setup_data - Virtual segment " - "addresses unsupported"); - - /* Just use the segments provided */ - segs = (struct bus_dma_segment *)csio->data_ptr; - ahc_execute_scb(scb, segs, csio->sglist_cnt, 0); - } - } else { - ahc_execute_scb(scb, NULL, 0, 0); + error = bus_dmamap_load_ccb(ahc->buffer_dmat, + scb->dmamap, + (union ccb *)csio, + ahc_execute_scb, + scb, + 0); + if (error == EINPROGRESS) { + /* + * So as to maintain ordering, + * freeze the controller queue + * until our mapping is + * returned. + */ + xpt_freeze_simq(sim, /*count*/1); + scb->io_ctx->ccb_h.status |= CAM_RELEASE_SIMQ; } } Modified: projects/physbio/sys/dev/arcmsr/arcmsr.c ============================================================================== --- projects/physbio/sys/dev/arcmsr/arcmsr.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/arcmsr/arcmsr.c Wed Dec 5 02:47:06 2012 (r243874) @@ -2099,6 +2099,7 @@ static int arcmsr_iop_message_xfer(struc (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[7] << 8 | (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[8]; /* 4 bytes: Areca io control code */ + /* XXX Does not handle alternate data formats. */ if((pccb->ccb_h.flags & CAM_SCATTER_VALID) == 0) { buffer = pccb->csio.data_ptr; transfer_len = pccb->csio.dxfer_len; @@ -2489,6 +2490,7 @@ static void arcmsr_action(struct cam_sim case XPT_SCSI_IO: { struct CommandControlBlock *srb; int target=pccb->ccb_h.target_id; + int error; if(target == 16) { /* virtual device for iop message transfer */ @@ -2503,52 +2505,13 @@ static void arcmsr_action(struct cam_sim pccb->ccb_h.arcmsr_ccbsrb_ptr=srb; pccb->ccb_h.arcmsr_ccbacb_ptr=acb; srb->pccb=pccb; - if((pccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { - if(!(pccb->ccb_h.flags & CAM_SCATTER_VALID)) { - /* Single buffer */ - if(!(pccb->ccb_h.flags & CAM_DATA_PHYS)) { - /* Buffer is virtual */ - u_int32_t error, s; - - s=splsoftvm(); - error = bus_dmamap_load(acb->dm_segs_dmat - , srb->dm_segs_dmamap - , pccb->csio.data_ptr - , pccb->csio.dxfer_len - , arcmsr_execute_srb, srb, /*flags*/0); - if(error == EINPROGRESS) { - xpt_freeze_simq(acb->psim, 1); - pccb->ccb_h.status |= CAM_RELEASE_SIMQ; - } - splx(s); - } - else { /* Buffer is physical */ -#ifdef PAE - panic("arcmsr: CAM_DATA_PHYS not supported"); -#else - struct bus_dma_segment seg; - - seg.ds_addr = (bus_addr_t)pccb->csio.data_ptr; - seg.ds_len = pccb->csio.dxfer_len; - arcmsr_execute_srb(srb, &seg, 1, 0); -#endif - } - } else { - /* Scatter/gather list */ - struct bus_dma_segment *segs; - - if((pccb->ccb_h.flags & CAM_SG_LIST_PHYS) == 0 - || (pccb->ccb_h.flags & CAM_DATA_PHYS) != 0) { - pccb->ccb_h.status |= CAM_PROVIDE_FAIL; - xpt_done(pccb); - free(srb, M_DEVBUF); - return; - } - segs=(struct bus_dma_segment *)pccb->csio.data_ptr; - arcmsr_execute_srb(srb, segs, pccb->csio.sglist_cnt, 0); - } - } else { - arcmsr_execute_srb(srb, NULL, 0, 0); + error = bus_dmamap_load_ccb(acb->dm_segs_dmat + , srb->dm_segs_dmamap + , pccb + , arcmsr_execute_srb, srb, /*flags*/0); + if(error == EINPROGRESS) { + xpt_freeze_simq(acb->psim, 1); + pccb->ccb_h.status |= CAM_RELEASE_SIMQ; } break; } Modified: projects/physbio/sys/dev/ata/ata-dma.c ============================================================================== --- projects/physbio/sys/dev/ata/ata-dma.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/ata/ata-dma.c Wed Dec 5 02:47:06 2012 (r243874) @@ -304,10 +304,15 @@ ata_dmaload(struct ata_request *request, else dspa.dmatab = request->dma->sg; - if ((error = bus_dmamap_load(request->dma->data_tag, request->dma->data_map, - request->data, request->bytecount, - ch->dma.setprd, &dspa, BUS_DMA_NOWAIT)) || - (error = dspa.error)) { + if (request->ccb) + error = bus_dmamap_load_ccb(request->dma->data_tag, + request->dma->data_map, request->ccb, + ch->dma.setprd, &dspa, BUS_DMA_NOWAIT); + else + error = bus_dmamap_load(request->dma->data_tag, request->dma->data_map, + request->data, request->bytecount, + ch->dma.setprd, &dspa, BUS_DMA_NOWAIT); + if (error || (error = dspa.error)) { device_printf(request->parent, "FAILURE - load data\n"); goto error; } Modified: projects/physbio/sys/dev/buslogic/bt.c ============================================================================== --- projects/physbio/sys/dev/buslogic/bt.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/buslogic/bt.c Wed Dec 5 02:47:06 2012 (r243874) @@ -1158,6 +1158,7 @@ btaction(struct cam_sim *sim, union ccb if (ccb->ccb_h.func_code == XPT_SCSI_IO) { struct ccb_scsiio *csio; struct ccb_hdr *ccbh; + int error; csio = &ccb->csio; ccbh = &csio->ccb_h; @@ -1205,67 +1206,21 @@ btaction(struct cam_sim *sim, union ccb * If we have any data to send with this command, * map it into bus space. */ - /* Only use S/G if there is a transfer */ - if ((ccbh->flags & CAM_DIR_MASK) != CAM_DIR_NONE) { - if ((ccbh->flags & CAM_SCATTER_VALID) == 0) { - /* - * We've been given a pointer - * to a single buffer. - */ - if ((ccbh->flags & CAM_DATA_PHYS)==0) { - int error; - - error = bus_dmamap_load( - bt->buffer_dmat, - bccb->dmamap, - csio->data_ptr, - csio->dxfer_len, - btexecuteccb, - bccb, - /*flags*/0); - if (error == EINPROGRESS) { - /* - * So as to maintain - * ordering, freeze the - * controller queue - * until our mapping is - * returned. - */ - xpt_freeze_simq(bt->sim, - 1); - csio->ccb_h.status |= - CAM_RELEASE_SIMQ; - } - } else { - struct bus_dma_segment seg; - - /* Pointer to physical buffer */ - seg.ds_addr = - (bus_addr_t)csio->data_ptr; - seg.ds_len = csio->dxfer_len; - btexecuteccb(bccb, &seg, 1, 0); - } - } else { - struct bus_dma_segment *segs; - - if ((ccbh->flags & CAM_DATA_PHYS) != 0) - panic("btaction - Physical " - "segment pointers " - "unsupported"); - - if ((ccbh->flags&CAM_SG_LIST_PHYS)==0) - panic("btaction - Virtual " - "segment addresses " - "unsupported"); - - /* Just use the segments provided */ - segs = (struct bus_dma_segment *) - csio->data_ptr; - btexecuteccb(bccb, segs, - csio->sglist_cnt, 0); - } - } else { - btexecuteccb(bccb, NULL, 0, 0); + error = bus_dmamap_load_ccb( + bt->buffer_dmat, + bccb->dmamap, + ccb, + btexecuteccb, + bccb, + /*flags*/0); + if (error == EINPROGRESS) { + /* + * So as to maintain ordering, freeze the + * controller queue until our mapping is + * returned. + */ + xpt_freeze_simq(bt->sim, 1); + csio->ccb_h.status |= CAM_RELEASE_SIMQ; } } else { hccb->opcode = INITIATOR_BUS_DEV_RESET; Modified: projects/physbio/sys/dev/ciss/ciss.c ============================================================================== --- projects/physbio/sys/dev/ciss/ciss.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/ciss/ciss.c Wed Dec 5 02:47:06 2012 (r243874) @@ -2676,9 +2676,14 @@ ciss_map_request(struct ciss_request *cr BUS_DMASYNC_PREWRITE); if (cr->cr_data != NULL) { - error = bus_dmamap_load(sc->ciss_buffer_dmat, cr->cr_datamap, - cr->cr_data, cr->cr_length, - ciss_request_map_helper, cr, 0); + if (cr->cr_flags & CISS_REQ_CCB) + error = bus_dmamap_load_ccb(sc->ciss_buffer_dmat, + cr->cr_datamap, cr->cr_data, + ciss_request_map_helper, cr, 0); + else + error = bus_dmamap_load(sc->ciss_buffer_dmat, cr->cr_datamap, + cr->cr_data, cr->cr_length, + ciss_request_map_helper, cr, 0); if (error != 0) return (error); } else { @@ -3082,7 +3087,7 @@ ciss_cam_action_io(struct cam_sim *sim, * Build the command. */ cc = cr->cr_cc; - cr->cr_data = csio->data_ptr; + cr->cr_data = csio; cr->cr_length = csio->dxfer_len; cr->cr_complete = ciss_cam_complete; cr->cr_private = csio; @@ -3109,6 +3114,7 @@ ciss_cam_action_io(struct cam_sim *sim, cr->cr_flags = 0; cc->cdb.direction = CISS_CDB_DIRECTION_NONE; } + cr->cr_flags |= CISS_REQ_CCB; cc->cdb.timeout = (csio->ccb_h.timeout / 1000) + 1; if (csio->ccb_h.flags & CAM_CDB_POINTER) { bcopy(csio->cdb_io.cdb_ptr, &cc->cdb.cdb[0], csio->cdb_len); Modified: projects/physbio/sys/dev/ciss/cissvar.h ============================================================================== --- projects/physbio/sys/dev/ciss/cissvar.h Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/ciss/cissvar.h Wed Dec 5 02:47:06 2012 (r243874) @@ -113,6 +113,7 @@ struct ciss_request #define CISS_REQ_DATAOUT (1<<3) /* data host->adapter */ #define CISS_REQ_DATAIN (1<<4) /* data adapter->host */ #define CISS_REQ_BUSY (1<<5) /* controller has req */ +#define CISS_REQ_CCB (1<<6) /* data is ccb */ void (* cr_complete)(struct ciss_request *); void *cr_private; Modified: projects/physbio/sys/dev/dpt/dpt_scsi.c ============================================================================== --- projects/physbio/sys/dev/dpt/dpt_scsi.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/dpt/dpt_scsi.c Wed Dec 5 02:47:06 2012 (r243874) @@ -910,56 +910,22 @@ dpt_action(struct cam_sim *sim, union cc */ /* Only use S/G if there is a transfer */ if ((ccbh->flags & CAM_DIR_MASK) != CAM_DIR_NONE) { - if ((ccbh->flags & CAM_SCATTER_VALID) == 0) { + int error; + + error = bus_dmamap_load_ccb(dpt->buffer_dmat, + dccb->dmamap, + ccb, + dptexecuteccb, + dccb, /*flags*/0); + if (error == EINPROGRESS) { /* - * We've been given a pointer - * to a single buffer. + * So as to maintain ordering, + * freeze the controller queue + * until our mapping is + * returned. */ - if ((ccbh->flags & CAM_DATA_PHYS) == 0) { - int error; - - error = - bus_dmamap_load(dpt->buffer_dmat, - dccb->dmamap, - csio->data_ptr, - csio->dxfer_len, - dptexecuteccb, - dccb, /*flags*/0); - if (error == EINPROGRESS) { - /* - * So as to maintain ordering, - * freeze the controller queue - * until our mapping is - * returned. - */ - xpt_freeze_simq(sim, 1); - dccb->state |= CAM_RELEASE_SIMQ; - } - } else { - struct bus_dma_segment seg; - - /* Pointer to physical buffer */ - seg.ds_addr = - (bus_addr_t)csio->data_ptr; - seg.ds_len = csio->dxfer_len; - dptexecuteccb(dccb, &seg, 1, 0); - } - } else { - struct bus_dma_segment *segs; - - if ((ccbh->flags & CAM_DATA_PHYS) != 0) - panic("dpt_action - Physical " - "segment pointers " - "unsupported"); - - if ((ccbh->flags&CAM_SG_LIST_PHYS)==0) - panic("dpt_action - Virtual " - "segment addresses " - "unsupported"); - - /* Just use the segments provided */ - segs = (struct bus_dma_segment *)csio->data_ptr; - dptexecuteccb(dccb, segs, csio->sglist_cnt, 0); + xpt_freeze_simq(sim, 1); + dccb->state |= CAM_RELEASE_SIMQ; } } else { /* Modified: projects/physbio/sys/dev/firewire/sbp.c ============================================================================== --- projects/physbio/sys/dev/firewire/sbp.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/firewire/sbp.c Wed Dec 5 02:47:06 2012 (r243874) @@ -2496,10 +2496,9 @@ printf("ORB %08x %08x %08x %08x\n", ntoh int s, error; s = splsoftvm(); - error = bus_dmamap_load(/*dma tag*/sbp->dmat, + error = bus_dmamap_load_ccb(/*dma tag*/sbp->dmat, /*dma map*/ocb->dmamap, - ccb->csio.data_ptr, - ccb->csio.dxfer_len, + ccb, sbp_execute_ocb, ocb, /*flags*/0); Modified: projects/physbio/sys/dev/hpt27xx/osm_bsd.c ============================================================================== --- projects/physbio/sys/dev/hpt27xx/osm_bsd.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/hpt27xx/osm_bsd.c Wed Dec 5 02:47:06 2012 (r243874) @@ -660,6 +660,7 @@ static void hpt_scsi_io(PVBUS_EXT vbus_e case 0x2f: case 0x8f: /* VERIFY_16 */ { + int error; pCmd = ldm_alloc_cmds(vbus, vd->cmds_per_request); if(!pCmd){ KdPrint(("Failed to allocate command!")); @@ -716,42 +717,20 @@ static void hpt_scsi_io(PVBUS_EXT vbus_e pCmd->target = vd; pCmd->done = os_cmddone; pCmd->buildsgl = os_buildsgl; - pCmd->psg = ext->psg; - - if (ccb->ccb_h.flags & CAM_SCATTER_VALID) { - int idx; - bus_dma_segment_t *sgList = (bus_dma_segment_t *)ccb->csio.data_ptr; - - if (ccb->ccb_h.flags & CAM_SG_LIST_PHYS) - pCmd->flags.physical_sg = 1; - - for (idx = 0; idx < ccb->csio.sglist_cnt; idx++) { - pCmd->psg[idx].addr.bus = sgList[idx].ds_addr; - pCmd->psg[idx].size = sgList[idx].ds_len; - pCmd->psg[idx].eot = (idx==ccb->csio.sglist_cnt-1)? 1 : 0; - } - - ccb->ccb_h.timeout_ch = timeout(hpt_timeout, pCmd, HPT_OSM_TIMEOUT); - ldm_queue_cmd(pCmd); - } - else { - int error; - pCmd->flags.physical_sg = 1; - error = bus_dmamap_load(vbus_ext->io_dmat, - ext->dma_map, - ccb->csio.data_ptr, ccb->csio.dxfer_len, - hpt_io_dmamap_callback, pCmd, + pCmd->flags.physical_sg = 1; + error = bus_dmamap_load_ccb(vbus_ext->io_dmat, + ext->dma_map, ccb, + hpt_io_dmamap_callback, pCmd, BUS_DMA_WAITOK ); - KdPrint(("bus_dmamap_load return %d", error)); - if (error && error!=EINPROGRESS) { - os_printk("bus_dmamap_load error %d", error); - cmdext_put(ext); - ldm_free_cmds(pCmd); - ccb->ccb_h.status = CAM_REQ_CMP_ERR; - xpt_done(ccb); - } + KdPrint(("bus_dmamap_load return %d", error)); + if (error && error!=EINPROGRESS) { + os_printk("bus_dmamap_load error %d", error); + cmdext_put(ext); + ldm_free_cmds(pCmd); + ccb->ccb_h.status = CAM_REQ_CMP_ERR; + xpt_done(ccb); } return; } Modified: projects/physbio/sys/dev/hptiop/hptiop.c ============================================================================== --- projects/physbio/sys/dev/hptiop/hptiop.c Wed Dec 5 02:06:30 2012 (r243873) +++ projects/physbio/sys/dev/hptiop/hptiop.c Wed Dec 5 02:47:06 2012 (r243874) @@ -2358,6 +2358,7 @@ static void hptiop_action(struct cam_sim { struct hpt_iop_hba * hba = (struct hpt_iop_hba *)cam_sim_softc(sim); struct hpt_iop_srb * srb; + int error; switch (ccb->ccb_h.func_code) { @@ -2380,52 +2381,22 @@ static void hptiop_action(struct cam_sim } srb->ccb = ccb; - - if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE) - hptiop_post_scsi_command(srb, NULL, 0, 0); - else if ((ccb->ccb_h.flags & CAM_SCATTER_VALID) == 0) { - if ((ccb->ccb_h.flags & CAM_DATA_PHYS) == 0) { - int error; - - error = bus_dmamap_load(hba->io_dmat, - srb->dma_map, - ccb->csio.data_ptr, - ccb->csio.dxfer_len, - hptiop_post_scsi_command, - srb, 0); - - if (error && error != EINPROGRESS) { - device_printf(hba->pcidev, - "%d bus_dmamap_load error %d", - hba->pciunit, error); - xpt_freeze_simq(hba->sim, 1); - ccb->ccb_h.status = CAM_REQ_CMP_ERR; -invalid: - hptiop_free_srb(hba, srb); - xpt_done(ccb); - goto scsi_done; - } - } - else { - device_printf(hba->pcidev, - "CAM_DATA_PHYS not supported"); - ccb->ccb_h.status = CAM_REQ_CMP_ERR; - goto invalid; - } - } - else { - struct bus_dma_segment *segs; - *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212050247.qB52l6Zk041305>