PERFORCE change 116907 for review
Scott Long
scottl at FreeBSD.org
Fri Mar 30 07:50:37 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=116907
Change 116907 by scottl at scottl-x64 on 2007/03/30 07:50:04
Keep from breaking the userland ABI by not including a callout
struct in the ccb_hdr. MPSAFE SIMs are now required to provide
storage for and initialize their own callouts. Non-MPSAFE SIMs
can continue to use the callout_handle that is already in the
ccb_hdr.
Affected files ...
.. //depot/projects/scottl-camlock/src/sys/cam/cam_ccb.h#14 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#54 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx.c#7 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx.h#6 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx_osm.c#14 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx.c#7 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx.h#4 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx_osm.c#12 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic_osm_lib.c#6 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic_osm_lib.h#7 edit
.. //depot/projects/scottl-camlock/src/sys/dev/mpt/mpt.h#18 edit
.. //depot/projects/scottl-camlock/src/sys/dev/mpt/mpt_cam.c#21 edit
.. //depot/projects/scottl-camlock/src/sys/dev/mpt/mpt_raid.c#12 edit
Differences ...
==== //depot/projects/scottl-camlock/src/sys/cam/cam_ccb.h#14 (text+ko) ====
@@ -275,13 +275,10 @@
u_int32_t timeout; /* Timeout value */
/*
- * CAM does not manage CCB timeouts itself, but provides convenient
- * storage for drivers to use for their own management of timeouts.
- * Drivers that are not yet MPSAFE should use the timeout_ch.
- * Drivers that are MPSAFE should use the callout.
+ * Deprecated, only for use by non-MPSAFE SIMs. All others must
+ * allocate and initialize their own callout storage.
*/
struct callout_handle timeout_ch;
- struct callout callout;
};
/* Get Device Information CCB */
==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#54 (text+ko) ====
@@ -5032,10 +5032,8 @@
union ccb *new_ccb;
new_ccb = malloc(sizeof(*new_ccb), M_CAMXPT, M_WAITOK);
- if (sim != NULL) {
+ if ((sim != NULL) && ((sim->flags & CAM_SIM_MPSAFE) == 0)) {
callout_handle_init(&new_ccb->ccb_h.timeout_ch);
- callout_init(&new_ccb->ccb_h.callout,
- (sim->flags & CAM_SIM_MPSAFE) ? 1 : 0);
}
return (new_ccb);
}
@@ -5046,9 +5044,9 @@
union ccb *new_ccb;
new_ccb = malloc(sizeof(*new_ccb), M_CAMXPT, M_NOWAIT);
- callout_handle_init(&new_ccb->ccb_h.timeout_ch);
- callout_init(&new_ccb->ccb_h.callout,
- (sim->flags & CAM_SIM_MPSAFE) ? 1 : 0);
+ if ((sim != NULL) && ((sim->flags & CAM_SIM_MPSAFE) == 0)) {
+ callout_handle_init(&new_ccb->ccb_h.timeout_ch);
+ }
return (new_ccb);
}
==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx.c#7 (text+ko) ====
@@ -6215,6 +6215,7 @@
next_scb->col_scb = ahd_find_scb_by_tag(ahd, col_tag);
if (next_scb->col_scb != NULL)
next_scb->col_scb->col_scb = next_scb;
+ aic_timer_init(&next_scb->io_timer);
ahd_free_scb(ahd, next_scb);
hscb++;
hscb_busaddr += sizeof(*hscb);
==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx.h#6 (text+ko) ====
@@ -639,6 +639,7 @@
u_int sg_count;/* How full ahd_dma_seg is */
#define AHD_MAX_LQ_CRC_ERRORS 5
u_int crc_retry_count;
+ aic_timer_t io_timer;
};
TAILQ_HEAD(scb_tailq, scb);
==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx_osm.c#14 (text+ko) ====
@@ -222,7 +222,7 @@
if ((scb->flags & SCB_TIMEDOUT) != 0)
LIST_REMOVE(scb, timedout_links);
- callout_stop(&ccb->ccb_h.callout);
+ callout_stop(&scb->io_timer);
if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) {
bus_dmasync_op_t op;
==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx.c#7 (text+ko) ====
@@ -4606,6 +4606,7 @@
#endif
next_scb->hscb = &scb_data->hscbs[scb_data->numscbs];
next_scb->hscb->tag = ahc->scb_data->numscbs;
+ aic_timer_init(&next_scb->io_timer);
SLIST_INSERT_HEAD(&ahc->scb_data->free_scbs,
next_scb, links.sle);
segs += AHC_NSEG;
==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx.h#4 (text+ko) ====
@@ -597,6 +597,7 @@
struct ahc_dma_seg *sg_list;
bus_addr_t sg_list_phys;
u_int sg_count;/* How full ahc_dma_seg is */
+ aic_timer_t io_timer;
};
struct scb_data {
==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx_osm.c#12 (text+ko) ====
@@ -339,7 +339,7 @@
ahc_run_untagged_queue(ahc, untagged_q);
}
- callout_stop(&ccb->ccb_h.callout);
+ callout_stop(&scb->io_timer);
if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) {
bus_dmasync_op_t op;
==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic_osm_lib.c#6 (text+ko) ====
@@ -57,7 +57,7 @@
union ccb *ccb;
ccb = list_scb->io_ctx;
- callout_stop(&ccb->ccb_h.callout);
+ callout_stop(&scb->io_timer);
}
}
}
==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic_osm_lib.h#7 (text+ko) ====
@@ -223,8 +223,7 @@
time = msec;
time *= hz;
time /= 1000;
- callout_reset(&scb->io_ctx->ccb_h.callout, time, aic_platform_timeout,
- scb);
+ callout_reset(&scb->io_timer, time, aic_platform_timeout, scb);
}
static __inline void
==== //depot/projects/scottl-camlock/src/sys/dev/mpt/mpt.h#18 (text+ko) ====
@@ -280,7 +280,7 @@
/****************************** Timer Facilities ******************************/
#if __FreeBSD_version > 500000
-#define mpt_callout_init(c) callout_init(c, /*mpsafe*/0);
+#define mpt_callout_init(c) callout_init(c, /*mpsafe*/1);
#else
#define mpt_callout_init(c) callout_init(c);
#endif
@@ -337,6 +337,7 @@
bus_addr_t sense_pbuf; /* Physical Address of sense data */
bus_dmamap_t dmap; /* DMA map for data buffers */
struct req_entry *chain; /* for SGE overallocations */
+ struct callout callout; /* Timeout for the request */
};
/**************************** MPI Target State Info ***************************/
@@ -814,12 +815,12 @@
#define CAMLOCK_2_MPTLOCK(mpt)
#define mpt_sleep(mpt, ident, priority, wmesg, timo) \
msleep(ident, &(mpt)->mpt_lock, priority, wmesg, timo)
-#define mpt_ccb_timeout(ccb, ticks, func, arg) \
- callout_reset(&(ccb)->ccb_h.callout, (ticks), (func), (arg));
-#define mpt_ccb_untimeout(ccb, func, arg) \
- callout_stop(&(ccb)->ccb_h.callout)
-#define mpt_ccb_timeout_init(ccb) \
- callout_init(&(ccb)->ccb_h.callout, 1)
+#define mpt_req_timeout(req, ticks, func, arg) \
+ callout_reset(&(req)->callout, (ticks), (func), (arg));
+#define mpt_req_untimeout(req, func, arg) \
+ callout_stop(&(req)->callout)
+#define mpt_req_timeout_init(req) \
+ callout_init(&(req)->callout, 1)
#else
==== //depot/projects/scottl-camlock/src/sys/dev/mpt/mpt_cam.c#21 (text+ko) ====
@@ -1325,10 +1325,10 @@
ccb->ccb_h.status |= CAM_SIM_QUEUED;
if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) {
- mpt_ccb_timeout(ccb, (ccb->ccb_h.timeout * hz) / 1000,
+ mpt_req_timeout(req, (ccb->ccb_h.timeout * hz) / 1000,
mpt_timeout, ccb);
} else {
- mpt_ccb_timeout_init(ccb);
+ mpt_req_timeout_init(req);
}
if (mpt->verbose > MPT_PRT_DEBUG) {
int nc = 0;
@@ -1726,10 +1726,10 @@
ccb->ccb_h.status |= CAM_SIM_QUEUED;
if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) {
- mpt_ccb_timeout(ccb, (ccb->ccb_h.timeout * hz) / 1000,
+ mpt_req_timeout(req, (ccb->ccb_h.timeout * hz) / 1000,
mpt_timeout, ccb);
} else {
- mpt_ccb_timeout_init(ccb);
+ mpt_req_timeout_init(req);
}
if (mpt->verbose > MPT_PRT_DEBUG) {
int nc = 0;
@@ -2103,6 +2103,7 @@
{
union ccb *ccb;
uint32_t pathid;
+ struct cam_sim *sim;
/*
* In general this means a device has been added to the loop.
*/
@@ -2111,16 +2112,17 @@
break;
}
if (mpt->phydisk_sim) {
- pathid = cam_sim_path(mpt->phydisk_sim);;
+ sim = mpt->phydisk_sim;
} else {
- pathid = cam_sim_path(mpt->sim);
+ sim = mpt->sim;
}
+ pathid = cam_sim_path(sim);
MPTLOCK_2_CAMLOCK(mpt);
/*
* Allocate a CCB, create a wildcard path for this bus,
* and schedule a rescan.
*/
- ccb = xpt_alloc_ccb_nowait();
+ ccb = xpt_alloc_ccb_nowait(sim);
if (ccb == NULL) {
mpt_prt(mpt, "unable to alloc CCB for rescan\n");
CAMLOCK_2_MPTLOCK(mpt);
@@ -2297,7 +2299,7 @@
}
tgt = scsi_req->TargetID;
- mpt_ccb_untimeout(ccb, mpt_timeout, ccb);
+ mpt_req_untimeout(req, mpt_timeout, ccb);
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) {
@@ -4618,7 +4620,7 @@
req->serno, tgt->resid);
if (ccb) {
ccb->ccb_h.status = CAM_SIM_QUEUED | CAM_REQ_INPROG;
- mpt_ccb_timeout(ccb, 60 * hz, mpt_timeout, ccb);
+ mpt_req_timeout(req, 60 * hz, mpt_timeout, ccb);
}
mpt_send_cmd(mpt, req);
}
@@ -5033,7 +5035,7 @@
}
tgt->ccb = NULL;
tgt->nxfers++;
- mpt_ccb_untimeout(ccb, mpt_timeout, ccb);
+ mpt_req_untimeout(req, mpt_timeout, ccb);
mpt_lprt(mpt, MPT_PRT_DEBUG,
"TARGET_ASSIST %p (req %p:%u) done tag 0x%x\n",
ccb, tgt->req, tgt->req->serno, ccb->csio.tag_id);
@@ -5098,7 +5100,7 @@
TGT_STATE_MOVING_DATA_AND_STATUS) {
tgt->nxfers++;
}
- mpt_ccb_untimeout(ccb, mpt_timeout, ccb);
+ mpt_req_untimeout(req, mpt_timeout, ccb);
if (ccb->ccb_h.flags & CAM_SEND_SENSE) {
ccb->ccb_h.status |= CAM_SENT_SENSE;
}
==== //depot/projects/scottl-camlock/src/sys/dev/mpt/mpt_raid.c#12 (text+ko) ====
@@ -756,7 +756,7 @@
if (rv != 0)
return (CAM_REQ_CMP_ERR);
- mpt_ccb_timeout(ccb, mpt_raid_quiesce_timeout, ccb, 5 * hz);
+ mpt_req_timeout(req, mpt_raid_quiesce_timeout, ccb, 5 * hz);
#if 0
if (rv == ETIMEDOUT) {
mpt_disk_prt(mpt, mpt_disk, "mpt_raid_quiesce_disk: "
More information about the p4-projects
mailing list