aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/aic7xxx
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2013-02-12 16:57:20 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2013-02-12 16:57:20 +0000
commitdd0b4fb6d50631c140e800bdfac48d02e7e4c875 (patch)
treee550f2c754f1edf951a8b93963ebcfc4fa0d20ce /sys/dev/aic7xxx
parent44c169253de5caec5de2a397c522ad3e359f86e6 (diff)
Notes
Diffstat (limited to 'sys/dev/aic7xxx')
-rw-r--r--sys/dev/aic7xxx/aic79xx_osm.c71
-rw-r--r--sys/dev/aic7xxx/aic7xxx_osm.c74
2 files changed, 29 insertions, 116 deletions
diff --git a/sys/dev/aic7xxx/aic79xx_osm.c b/sys/dev/aic7xxx/aic79xx_osm.c
index 3f7b8185831a3..6ef0f9250cdc6 100644
--- a/sys/dev/aic7xxx/aic79xx_osm.c
+++ b/sys/dev/aic7xxx/aic79xx_osm.c
@@ -1071,6 +1071,7 @@ ahd_setup_data(struct ahd_softc *ahd, struct cam_sim *sim,
{
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, struct cam_sim *sim,
}
}
- /* 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;
}
}
diff --git a/sys/dev/aic7xxx/aic7xxx_osm.c b/sys/dev/aic7xxx/aic7xxx_osm.c
index 281b00ec9e532..a51177c97899a 100644
--- a/sys/dev/aic7xxx/aic7xxx_osm.c
+++ b/sys/dev/aic7xxx/aic7xxx_osm.c
@@ -1138,6 +1138,7 @@ ahc_setup_data(struct ahc_softc *ahc, struct cam_sim *sim,
{
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, struct cam_sim *sim,
}
}
- /* 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;
}
}