summaryrefslogtreecommitdiffstats
path: root/sys/cam/cam_xpt.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-10-25 05:19:40 +0000
committerjhb <jhb@FreeBSD.org>2000-10-25 05:19:40 +0000
commitff18363a3e5e60f38c8f7a52c7e7f4ea1c8b797f (patch)
treed0f426694e386a2b666529e1e1ad06938c3d7e83 /sys/cam/cam_xpt.c
parent08451a100d3bc5d4373e28f7acd976df25f3f785 (diff)
downloadFreeBSD-src-ff18363a3e5e60f38c8f7a52c7e7f4ea1c8b797f.zip
FreeBSD-src-ff18363a3e5e60f38c8f7a52c7e7f4ea1c8b797f.tar.gz
- Overhaul the software interrupt code to use interrupt threads for each
type of software interrupt. Roughly, what used to be a bit in spending now maps to a swi thread. Each thread can have multiple handlers, just like a hardware interrupt thread. - Instead of using a bitmask of pending interrupts, we schedule the specific software interrupt thread to run, so spending, NSWI, and the shandlers array are no longer needed. We can now have an arbitrary number of software interrupt threads. When you register a software interrupt thread via sinthand_add(), you get back a struct intrhand that you pass to sched_swi() when you wish to schedule your swi thread to run. - Convert the name of 'struct intrec' to 'struct intrhand' as it is a bit more intuitive. Also, prefix all the members of struct intrhand with 'ih_'. - Make swi_net() a MI function since there is now no point in it being MD. Submitted by: cp
Diffstat (limited to 'sys/cam/cam_xpt.c')
-rw-r--r--sys/cam/cam_xpt.c46
1 files changed, 17 insertions, 29 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index b498d61..4dd19c4 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -605,6 +605,10 @@ u_int32_t cam_dflags;
u_int32_t cam_debug_delay;
#endif
+/* Pointers to software interrupt handlers */
+struct intrhand *camnet_ih;
+struct intrhand *cambio_ih;
+
#if defined(CAM_DEBUG_FLAGS) && !defined(CAMDEBUG)
#error "You must have options CAMDEBUG to use options CAM_DEBUG_FLAGS"
#endif
@@ -693,9 +697,7 @@ static xpt_devicefunc_t xptpassannouncefunc;
static void xpt_finishconfig(struct cam_periph *periph, union ccb *ccb);
static void xptaction(struct cam_sim *sim, union ccb *work_ccb);
static void xptpoll(struct cam_sim *sim);
-static swihand_t swi_camnet;
-static swihand_t swi_cambio;
-static void camisr(cam_isrq_t *queue);
+static void camisr(void *);
#if 0
static void xptstart(struct cam_periph *periph, union ccb *work_ccb);
static void xptasync(struct cam_periph *periph,
@@ -1363,8 +1365,10 @@ xpt_init(dummy)
}
/* Install our software interrupt handlers */
- register_swi(SWI_CAMNET, swi_camnet);
- register_swi(SWI_CAMBIO, swi_cambio);
+ camnet_ih = sinthand_add("camnet", NULL, camisr, &cam_netq,
+ SWI_CAMNET, 0);
+ cambio_ih = sinthand_add("cambio", NULL, camisr, &cam_bioq,
+ SWI_CAMBIO, 0);
}
static cam_status
@@ -3400,8 +3404,8 @@ xpt_polled_action(union ccb *start_ccb)
&& (--timeout > 0)) {
DELAY(1000);
(*(sim->sim_poll))(sim);
- swi_camnet();
- swi_cambio();
+ camisr(&cam_netq);
+ camisr(&cam_bioq);
}
dev->ccbq.devq_openings++;
@@ -3411,8 +3415,8 @@ xpt_polled_action(union ccb *start_ccb)
xpt_action(start_ccb);
while(--timeout > 0) {
(*(sim->sim_poll))(sim);
- swi_camnet();
- swi_cambio();
+ camisr(&cam_netq);
+ camisr(&cam_bioq);
if ((start_ccb->ccb_h.status & CAM_STATUS_MASK)
!= CAM_REQ_INPROG)
break;
@@ -4527,13 +4531,13 @@ xpt_done(union ccb *done_ccb)
TAILQ_INSERT_TAIL(&cam_bioq, &done_ccb->ccb_h,
sim_links.tqe);
done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX;
- setsoftcambio();
+ sched_swi(cambio_ih, SWI_NOSWITCH);
break;
case CAM_PERIPH_NET:
TAILQ_INSERT_TAIL(&cam_netq, &done_ccb->ccb_h,
sim_links.tqe);
done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX;
- setsoftcamnet();
+ sched_swi(camnet_ih, SWI_NOSWITCH);
break;
}
}
@@ -6240,26 +6244,10 @@ xptpoll(struct cam_sim *sim)
{
}
-/*
- * Should only be called by the machine interrupt dispatch routines,
- * so put these prototypes here instead of in the header.
- */
-
-static void
-swi_camnet(void)
-{
- camisr(&cam_netq);
-}
-
-static void
-swi_cambio(void)
-{
- camisr(&cam_bioq);
-}
-
static void
-camisr(cam_isrq_t *queue)
+camisr(void *V_queue)
{
+ cam_isrq_t *queue = V_queue;
int s;
struct ccb_hdr *ccb_h;
OpenPOWER on IntegriCloud