PERFORCE change 97387 for review
Scott Long
scottl at FreeBSD.org
Thu May 18 04:12:56 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=97387
Change 97387 by scottl at scottl-x64 on 2006/05/18 04:11:33
Put more global stuff under the xpt_softc, do some other minor
rearrangement.
Affected files ...
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#31 edit
Differences ...
==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#31 (text+ko) ====
@@ -237,16 +237,18 @@
} xpt_flags;
struct xpt_softc {
- xpt_flags flags;
- u_int32_t generation;
+ xpt_flags flags;
+ u_int32_t xpt_generation;
/* number of high powered commands that can go through right now */
- int num_highpower;
- STAILQ_HEAD(highpowerlist, ccb_hdr) highpowerq;
+ STAILQ_HEAD(highpowerlist, ccb_hdr) highpowerq;
+ int num_highpower;
/* Registered busses */
- TAILQ_HEAD(,cam_eb) xpt_busses;
- u_int bus_generation;
+ TAILQ_HEAD(,cam_eb) xpt_busses;
+ u_int bus_generation;
+
+ struct intr_config_hook *xpt_config_hook;
};
static const char quantum[] = "QUANTUM";
@@ -641,6 +643,9 @@
static cam_isrq_t cam_bioq;
static struct mtx cam_bioq_lock;
+/* Pointers to software interrupt handlers */
+static void *cambio_ih;
+
struct cam_periph *xpt_periph;
static periph_init_t xpt_periph_init;
@@ -676,7 +681,6 @@
.d_name = "xpt",
};
-static struct intr_config_hook *xpt_config_hook;
static void dead_sim_action(struct cam_sim *sim, union ccb *ccb);
static void dead_sim_poll(struct cam_sim *sim);
@@ -698,9 +702,6 @@
u_int32_t cam_debug_delay;
#endif
-/* Pointers to software interrupt handlers */
-static void *cambio_ih;
-
#if defined(CAM_DEBUG_FLAGS) && !defined(CAMDEBUG)
#error "You must have options CAMDEBUG to use options CAM_DEBUG_FLAGS"
#endif
@@ -1213,7 +1214,7 @@
/* Keep the list from changing while we traverse it */
s = splcam();
ptstartover:
- cur_generation = xsoftc.generation;
+ cur_generation = xsoftc.xpt_generation;
/* first find our driver in the list of drivers */
for (p_drv = periph_drivers; *p_drv != NULL; p_drv++)
@@ -1246,7 +1247,7 @@
splx(s);
s = splcam();
splbreaknum = 100;
- if (cur_generation != xsoftc.generation)
+ if (cur_generation != xsoftc.xpt_generation)
goto ptstartover;
}
}
@@ -1410,26 +1411,24 @@
}
cam_periph_alloc(xptregister, NULL, NULL, NULL, "xpt", CAM_PERIPH_BIO,
- path, NULL, 0, NULL);
+ path, NULL, 0, xpt_sim);
xpt_free_path(path);
- xpt_sim->softc = xpt_periph;
-
/*
* Register a callback for when interrupts are enabled.
*/
- xpt_config_hook =
+ xsoftc.xpt_config_hook =
(struct intr_config_hook *)malloc(sizeof(struct intr_config_hook),
M_TEMP, M_NOWAIT | M_ZERO);
- if (xpt_config_hook == NULL) {
+ if (xsoftc.xpt_config_hook == NULL) {
printf("xpt_init: Cannot malloc config hook "
"- failing attach\n");
return;
}
- xpt_config_hook->ich_func = xpt_config;
- if (config_intrhook_establish(xpt_config_hook) != 0) {
- free (xpt_config_hook, M_TEMP);
+ xsoftc.xpt_config_hook->ich_func = xpt_config;
+ if (config_intrhook_establish(xsoftc.xpt_config_hook) != 0) {
+ free (xsoftc.xpt_config_hook, M_TEMP);
printf("xpt_init: config_intrhook_establish failed "
"- failing attach\n");
}
@@ -1441,15 +1440,17 @@
static cam_status
xptregister(struct cam_periph *periph, void *arg)
{
+ struct cam_sim *xpt_sim;
+
if (periph == NULL) {
printf("xptregister: periph was NULL!!\n");
return(CAM_REQ_CMP_ERR);
}
+ xpt_sim = (struct cam_sim *)arg;
+ xpt_sim->softc = periph;
periph->softc = NULL;
- xpt_periph = periph;
-
return(CAM_REQ_CMP);
}
@@ -1487,7 +1488,7 @@
splx(s);
}
- xsoftc.generation++;
+ xsoftc.xpt_generation++;
return (status);
}
@@ -1518,7 +1519,7 @@
splx(s);
}
- xsoftc.generation++;
+ xsoftc.xpt_generation++;
}
@@ -7029,9 +7030,9 @@
xpt_for_all_devices(xptpassannouncefunc, NULL);
/* Release our hook so that the boot can continue. */
- config_intrhook_disestablish(xpt_config_hook);
- free(xpt_config_hook, M_TEMP);
- xpt_config_hook = NULL;
+ config_intrhook_disestablish(xsoftc.xpt_config_hook);
+ free(xsoftc.xpt_config_hook, M_TEMP);
+ xsoftc.xpt_config_hook = NULL;
}
if (done_ccb != NULL)
xpt_free_ccb(done_ccb);
More information about the p4-projects
mailing list