From owner-p4-projects@FreeBSD.ORG Thu Oct 1 18:45:52 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 444C4106568B; Thu, 1 Oct 2009 18:45:52 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4D201065676 for ; Thu, 1 Oct 2009 18:45:51 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id D2D8B8FC15 for ; Thu, 1 Oct 2009 18:45:51 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n91IjpIx053435 for ; Thu, 1 Oct 2009 18:45:51 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n91IjpqV053433 for perforce@freebsd.org; Thu, 1 Oct 2009 18:45:51 GMT (envelope-from scottl@freebsd.org) Date: Thu, 1 Oct 2009 18:45:51 GMT Message-Id: <200910011845.n91IjpqV053433@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 169097 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, 01 Oct 2009 18:45:52 -0000 http://perforce.freebsd.org/chv.cgi?CH=169097 Change 169097 by scottl@scottl-y1 on 2009/10/01 18:45:12 Prototype work for moving the boot-time CAM scan from SI_SUB_CONF_INTR_HOOK to its own SYSINIT. Affected files ... .. //depot/projects/firewire/sys/cam/cam_xpt.c#2 edit .. //depot/projects/firewire/sys/sys/kernel.h#2 edit Differences ... ==== //depot/projects/firewire/sys/cam/cam_xpt.c#2 (text+ko) ==== @@ -107,8 +107,6 @@ TAILQ_HEAD(,cam_eb) xpt_busses; u_int bus_generation; - struct intr_config_hook *xpt_config_hook; - struct mtx xpt_topo_lock; struct mtx xpt_lock; }; @@ -910,35 +908,19 @@ xpt_free_path(path); mtx_unlock(&xsoftc.xpt_lock); - /* - * Register a callback for when interrupts are enabled. - */ - xsoftc.xpt_config_hook = - (struct intr_config_hook *)malloc(sizeof(struct intr_config_hook), - M_CAMXPT, M_NOWAIT | M_ZERO); - if (xsoftc.xpt_config_hook == NULL) { - printf("xpt_init: Cannot malloc config hook " - "- failing attach\n"); - return (ENOMEM); - } - - xsoftc.xpt_config_hook->ich_func = xpt_config; - if (config_intrhook_establish(xsoftc.xpt_config_hook) != 0) { - free (xsoftc.xpt_config_hook, M_CAMXPT); - printf("xpt_init: config_intrhook_establish failed " - "- failing attach\n"); - } - /* fire up rescan thread */ if (kproc_create(xpt_scanner_thread, NULL, NULL, 0, 0, "xpt_thrd")) { printf("xpt_init: failed to create rescan thread\n"); } /* Install our software interrupt handlers */ - swi_add(NULL, "cambio", camisr, NULL, SWI_CAMBIO, INTR_MPSAFE, &cambio_ih); + swi_add(NULL, "cambio", camisr, NULL, SWI_CAMBIO, INTR_MPSAFE, + &cambio_ih); return (0); } +SYSINIT(cam_config, SI_SUB_CONFIG_CAM, SI_ORDER_FIRST, xpt_config, NULL); + static cam_status xptregister(struct cam_periph *periph, void *arg) { @@ -4697,6 +4679,13 @@ } xpt_for_all_busses(xptconfigfunc, NULL); } + + mtx_lock(&xsoftc.xpt_lock); + while (msleep(xpt_config, &xsoftc.xpt_lock, PCONFIG, "camhk", + 30 * hz) == EWOULDBLOCK) { + printf("Warning\n"); + } + mtx_unlock(&xsoftc.xpt_lock); } /* @@ -4727,6 +4716,7 @@ struct periph_driver **p_drv; int i; + mtx_lock(&xsoftc.xpt_lock); if (busses_to_config == 0) { /* Register all the peripheral drivers */ /* XXX This will have to change when we have loadable modules */ @@ -4743,12 +4733,11 @@ xpt_for_all_devices(xptpassannouncefunc, NULL); /* Release our hook so that the boot can continue. */ - config_intrhook_disestablish(xsoftc.xpt_config_hook); - free(xsoftc.xpt_config_hook, M_CAMXPT); - xsoftc.xpt_config_hook = NULL; + wakeup(xpt_config); } free(context, M_CAMXPT); + mtx_unlock(&xsoftc.xpt_lock); } static void ==== //depot/projects/firewire/sys/sys/kernel.h#2 (text+ko) ==== @@ -154,6 +154,7 @@ SI_SUB_KPROF = 0x9000000, /* kernel profiling*/ SI_SUB_KICK_SCHEDULER = 0xa000000, /* start the timeout events*/ SI_SUB_INT_CONFIG_HOOKS = 0xa800000, /* Interrupts enabled config */ + SI_SUB_CONFIG_CAM = 0xa900000, /* Interrupts enabled config */ SI_SUB_ROOT_CONF = 0xb000000, /* Find root devices */ SI_SUB_DUMP_CONF = 0xb200000, /* Find dump devices */ SI_SUB_RAID = 0xb380000, /* Configure GEOM classes */