From owner-p4-projects@FreeBSD.ORG Fri Jan 18 20:56:48 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0765F16A421; Fri, 18 Jan 2008 20:56:48 +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 C0A8B16A417 for ; Fri, 18 Jan 2008 20:56:47 +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 A4A4213C46A for ; Fri, 18 Jan 2008 20:56:47 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m0IKulEf075605 for ; Fri, 18 Jan 2008 20:56:47 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m0IKulWt075602 for perforce@freebsd.org; Fri, 18 Jan 2008 20:56:47 GMT (envelope-from scottl@freebsd.org) Date: Fri, 18 Jan 2008 20:56:47 GMT Message-Id: <200801182056.m0IKulWt075602@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 133593 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: Fri, 18 Jan 2008 20:56:48 -0000 http://perforce.freebsd.org/chv.cgi?CH=133593 Change 133593 by scottl@scottl-ix on 2008/01/18 20:55:47 Hook up xenbus to xenhub and have it handle front-end bus stuff. Affected files ... .. //depot/projects/xen31-xenbus/sys/xen/xenbus/xenbus_probe.c#4 edit Differences ... ==== //depot/projects/xen31-xenbus/sys/xen/xenbus/xenbus_probe.c#4 (text+ko) ==== @@ -980,13 +980,18 @@ static int xenhub_attach(device_t dev) { + struct xenbus_device *sc; int err = 0, dom0; DPRINTK(""); + sc = device_get_softc(dev); + LIST_INIT(&xenbus_device_frontend_list); LIST_INIT(&xenbus_device_backend_list); LIST_INIT(&xendrv_list); + LIST_INIT(&sc->children); + #if 0 if (xen_init() < 0) { DPRINTK("failed"); @@ -1047,33 +1052,35 @@ /* Initialize the interface to xenstore. */ err = xs_init(); if (err) { - log(LOG_WARNING, - "XENBUS: Error initializing xenstore comms: %i\n", err); + log(LOG_WARNING, + "XENBUS: Error initializing xenstore comms: %i\n", err); return err; } if (!dom0) { + device_t child; + xenstored_ready = 1; + + if (device_find_child(dev, "xenbus", 0) != NULL) + panic("xenhub: could not attach xen buses"); + + child = BUS_ADD_CHILD(dev, 0, "xenbus", -1); + if (child == NULL) + panic("xenhub: could not attach frontend bus"); + device_set_desc(child, "Xen 3.x FrontEnd Bus"); + device_set_ivars(child, &xenbus_frontend); + #if 0 - xenbus_dev = BUS_ADD_CHILD(parent, 0, "xenbus", 0); - if (xenbus_dev == NULL) - panic("xenbus: could not attach"); - xenbus_backend_dev = BUS_ADD_CHILD(parent, 0, "xb_be", 0); - if (xenbus_backend_dev == NULL) - panic("xenbus: could not attach"); + child = BUS_ADD_CHILD(dev, 0, "xenbus", -1); + if (child== NULL) + panic("xenhub: could not attach backend bus"); + device_set_desc(child, "Xen 3.x BackEnd Bus"); + device_set_ivars(child, &xenbus_backend); #endif - BUG_ON((xenstored_ready <= 0)); - - - /* Enumerate devices in xenstore. */ - xenbus_probe_devices(&xenbus_frontend); - register_xenbus_watch(&fe_watch); - xenbus_backend_probe_and_watch(); + bus_generic_attach(dev); - - /* Notify others that xenstore is up */ - EVENTHANDLER_INVOKE(xenstore_event); } return 0; @@ -1093,13 +1100,6 @@ return (0); } -static int -xenhub_add_child(device_t parent, device_t child) -{ - - return (0); -} - static device_method_t xenhub_methods[] = { /* Device interface */ DEVMETHOD(device_identify, xenhub_identify), @@ -1113,7 +1113,7 @@ /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_add_child, xenhub_add_child), + DEVMETHOD(bus_add_child, bus_generic_add_child), DEVMETHOD(bus_read_ivar, bus_generic_read_ivar), DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), #if 0 @@ -1166,6 +1166,11 @@ /* Enumerate device in xenstore */ xenbus_probe_devices(sc->xenbus); + register_xenbus_watch(&fe_watch); + xenbus_backend_probe_and_watch(); + + /* Notify others that xenstore is up */ + EVENTHANDLER_INVOKE(xenstore_event); return (0); }