Deleted Added
sdiff udiff text old ( 212991 ) new ( 214279 )
full compact
1/*-
2 * Implementation of the Common Access Method Transport (XPT) layer.
3 *
4 * Copyright (c) 1997, 1998, 1999 Justin T. Gibbs.
5 * Copyright (c) 1997, 1998, 1999 Kenneth D. Merry.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/cam/cam_xpt.c 214279 2010-10-24 16:31:57Z brucec $");
32
33#include <sys/param.h>
34#include <sys/bus.h>
35#include <sys/systm.h>
36#include <sys/types.h>
37#include <sys/malloc.h>
38#include <sys/kernel.h>
39#include <sys/time.h>
40#include <sys/conf.h>
41#include <sys/fcntl.h>
42#include <sys/interrupt.h>
43#include <sys/sbuf.h>
44#include <sys/taskqueue.h>
45
46#include <sys/lock.h>
47#include <sys/mutex.h>
48#include <sys/sysctl.h>
49#include <sys/kthread.h>

--- 97 unchanged lines hidden (view full) ---

147typedef int xpt_pdrvfunc_t (struct periph_driver **pdrv, void *arg);
148
149/* Transport layer configuration information */
150static struct xpt_softc xsoftc;
151
152TUNABLE_INT("kern.cam.boot_delay", &xsoftc.boot_delay);
153SYSCTL_INT(_kern_cam, OID_AUTO, boot_delay, CTLFLAG_RDTUN,
154 &xsoftc.boot_delay, 0, "Bus registration wait time");
155
156/* Queues for our software interrupt handler */
157typedef TAILQ_HEAD(cam_isrq, ccb_hdr) cam_isrq_t;
158typedef TAILQ_HEAD(cam_simq, cam_sim) cam_simq_t;
159static cam_simq_t cam_simq;
160static struct mtx cam_simq_lock;
161
162/* Pointers to software interrupt handlers */

--- 77 unchanged lines hidden (view full) ---

240static struct cam_eb*
241 xpt_find_bus(path_id_t path_id);
242static struct cam_et*
243 xpt_find_target(struct cam_eb *bus, target_id_t target_id);
244static struct cam_ed*
245 xpt_find_device(struct cam_et *target, lun_id_t lun_id);
246static void xpt_config(void *arg);
247static xpt_devicefunc_t xptpassannouncefunc;
248static void xptaction(struct cam_sim *sim, union ccb *work_ccb);
249static void xptpoll(struct cam_sim *sim);
250static void camisr(void *);
251static void camisr_runqueue(void *);
252static dev_match_ret xptbusmatch(struct dev_match_pattern *patterns,
253 u_int num_patterns, struct cam_eb *bus);
254static dev_match_ret xptdevicematch(struct dev_match_pattern *patterns,
255 u_int num_patterns,

--- 4271 unchanged lines hidden (view full) ---

4527 }
4528 } else
4529 cam_dpath = NULL;
4530#else /* !CAM_DEBUG_BUS */
4531 cam_dpath = NULL;
4532#endif /* CAM_DEBUG_BUS */
4533#endif /* CAMDEBUG */
4534
4535 periphdriver_init(1);
4536 xpt_hold_boot();
4537 callout_init(&xsoftc.boot_callout, 1);
4538 callout_reset(&xsoftc.boot_callout, hz * xsoftc.boot_delay / 1000,
4539 xpt_boot_delay, NULL);
4540 /* Fire up rescan thread. */
4541 if (kproc_create(xpt_scanner_thread, NULL, NULL, 0, 0, "xpt_thrd")) {
4542 printf("xpt_config: failed to create rescan thread.\n");

--- 65 unchanged lines hidden (view full) ---

4608 /* Release our hook so that the boot can continue. */
4609 config_intrhook_disestablish(xsoftc.xpt_config_hook);
4610 free(xsoftc.xpt_config_hook, M_CAMXPT);
4611 xsoftc.xpt_config_hook = NULL;
4612
4613 free(context, M_CAMXPT);
4614}
4615
4616cam_status
4617xpt_register_async(int event, ac_callback_t *cbfunc, void *cbarg,
4618 struct cam_path *path)
4619{
4620 struct ccb_setasync csa;
4621 cam_status status;
4622 int xptpath = 0;
4623

--- 218 unchanged lines hidden ---