summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>1998-10-07 03:32:57 +0000
committergibbs <gibbs@FreeBSD.org>1998-10-07 03:32:57 +0000
commitd925bde25d267b98712f34599b3a506e67ea366d (patch)
tree303eb20c48799e67a76d8cb037a1885b9091b296
parent848e5bffcd8e6d2e46b6562db0350f0c4cf04d93 (diff)
downloadFreeBSD-src-d925bde25d267b98712f34599b3a506e67ea366d.zip
FreeBSD-src-d925bde25d267b98712f34599b3a506e67ea366d.tar.gz
Don't set the active flag on a transaction resource until it has been
queued. Perform dma segment setup outside of splcam protection as this can take some time and the protection is not necessary. Inline a function. Clean up some whitespace.
-rw-r--r--sys/dev/advansys/advansys.c46
-rw-r--r--sys/dev/advansys/advlib.c28
2 files changed, 37 insertions, 37 deletions
diff --git a/sys/dev/advansys/advansys.c b/sys/dev/advansys/advansys.c
index d8bb1f4..8cba0c8 100644
--- a/sys/dev/advansys/advansys.c
+++ b/sys/dev/advansys/advansys.c
@@ -32,7 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: advansys.c,v 1.1 1998/09/15 07:03:33 gibbs Exp $
+ * $Id: advansys.c,v 1.2 1998/09/20 05:04:05 gibbs Exp $
*/
/*
* Ported from:
@@ -159,8 +159,6 @@ adv_action(struct cam_sim *sim, union ccb *ccb)
ccb_h = &ccb->ccb_h;
csio = &ccb->csio;
cinfo = adv_get_ccb_info(adv);
- cinfo->state |= ACCB_ACTIVE;
-
if (cinfo == NULL)
panic("XXX Handle CCB info error!!!");
@@ -479,25 +477,6 @@ adv_execute_ccb(void *arg, bus_dma_segment_t *dm_segs,
scsiq.q2.tag_code = 0;
scsiq.q2.vm_id = 0;
- s = splcam();
-
- /*
- * Last time we need to check if this SCB needs to
- * be aborted.
- */
- if (ccb_h->status != CAM_REQ_INPROG) {
- if (nsegments != 0) {
- bus_dmamap_unload(adv->buffer_dmat, cinfo->dmamap);
- }
- if ((cinfo->state & ACCB_RELEASE_SIMQ) != 0) {
- ccb_h->status |= CAM_RELEASE_SIMQ;
- }
- adv_free_ccb_info(adv, cinfo);
- xpt_done((union ccb *)csio);
- splx(s);
- return;
- }
-
if (nsegments != 0) {
bus_dmasync_op_t op;
@@ -525,6 +504,25 @@ adv_execute_ccb(void *arg, bus_dma_segment_t *dm_segs,
scsiq.sg_head = NULL;
}
+ s = splcam();
+
+ /*
+ * Last time we need to check if this SCB needs to
+ * be aborted.
+ */
+ if (ccb_h->status != CAM_REQ_INPROG) {
+ if (nsegments != 0) {
+ bus_dmamap_unload(adv->buffer_dmat, cinfo->dmamap);
+ }
+ if ((cinfo->state & ACCB_RELEASE_SIMQ) != 0) {
+ ccb_h->status |= CAM_RELEASE_SIMQ;
+ }
+ adv_free_ccb_info(adv, cinfo);
+ xpt_done((union ccb *)csio);
+ splx(s);
+ return;
+ }
+
if (adv_execute_scsi_queue(adv, &scsiq, csio->dxfer_len) != 0) {
/* Temporary resource shortage */
if (nsegments != 0) {
@@ -542,6 +540,7 @@ adv_execute_ccb(void *arg, bus_dma_segment_t *dm_segs,
splx(s);
return;
}
+ cinfo->state |= ACCB_ACTIVE;
ccb_h->status |= CAM_SIM_QUEUED;
LIST_INSERT_HEAD(&adv->pending_ccbs, ccb_h, sim_links.le);
/* Schedule our timeout */
@@ -1021,8 +1020,7 @@ adv_run_doneq(struct adv_softc *adv)
scsiq.d3.scsi_stat, scsiq.q_no);
doneq_head = done_qno;
- done_qno = adv_read_lram_8(adv, done_qaddr
- + ADV_SCSIQ_B_FWD);
+ done_qno = adv_read_lram_8(adv, done_qaddr + ADV_SCSIQ_B_FWD);
}
adv_write_lram_16(adv, ADVV_DONE_Q_TAIL_W, doneq_head);
}
diff --git a/sys/dev/advansys/advlib.c b/sys/dev/advansys/advlib.c
index d20eddf..3a7f611 100644
--- a/sys/dev/advansys/advlib.c
+++ b/sys/dev/advansys/advlib.c
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: advlib.c,v 1.5 1998/09/15 07:03:33 gibbs Exp $
+ * $Id: advlib.c,v 1.6 1998/09/20 05:04:05 gibbs Exp $
*/
/*
* Ported from:
@@ -241,7 +241,20 @@ static u_int8_t adv_get_chip_scsi_ctrl(struct adv_softc *adv);
#endif
/* Queue handling and execution */
-static int adv_sgcount_to_qcount(int sgcount);
+static __inline int
+ adv_sgcount_to_qcount(int sgcount);
+
+static __inline int
+adv_sgcount_to_qcount(int sgcount)
+{
+ int n_sg_list_qs;
+
+ n_sg_list_qs = ((sgcount - 1) / ADV_SG_LIST_PER_Q);
+ if (((sgcount - 1) % ADV_SG_LIST_PER_Q) != 0)
+ n_sg_list_qs++;
+ return (n_sg_list_qs + 1);
+}
+
static void adv_get_q_info(struct adv_softc *adv, u_int16_t s_addr,
u_int16_t *inbuf, int words);
static u_int adv_get_num_free_queues(struct adv_softc *adv, u_int8_t n_qs);
@@ -1584,17 +1597,6 @@ adv_get_chip_scsi_ctrl(struct adv_softc *adv)
}
#endif
-static int
-adv_sgcount_to_qcount(int sgcount)
-{
- int n_sg_list_qs;
-
- n_sg_list_qs = ((sgcount - 1) / ADV_SG_LIST_PER_Q);
- if (((sgcount - 1) % ADV_SG_LIST_PER_Q) != 0)
- n_sg_list_qs++;
- return (n_sg_list_qs + 1);
-}
-
/*
* XXX Looks like more padding issues in this routine as well.
* There has to be a way to turn this into an insw.
OpenPOWER on IntegriCloud