From owner-p4-projects@FreeBSD.ORG Thu May 18 04:12:56 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4CCF416A402; Thu, 18 May 2006 04:12:56 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EC31416A400 for ; Thu, 18 May 2006 04:12:55 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id AF86E43D45 for ; Thu, 18 May 2006 04:12:55 +0000 (GMT) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k4I4CWo0005958 for ; Thu, 18 May 2006 04:12:32 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k4I4CWPM005955 for perforce@freebsd.org; Thu, 18 May 2006 04:12:32 GMT (envelope-from scottl@freebsd.org) Date: Thu, 18 May 2006 04:12:32 GMT Message-Id: <200605180412.k4I4CWPM005955@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to scottl@freebsd.org using -f From: Scott Long To: Perforce Change Reviews Cc: Subject: PERFORCE change 97387 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 May 2006 04:12:56 -0000 http://perforce.freebsd.org/chv.cgi?CH=97387 Change 97387 by scottl@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);