From owner-p4-projects@FreeBSD.ORG Tue May 8 20:54:41 2007 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 35F8B16A407; Tue, 8 May 2007 20:54:41 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 04F7A16A403 for ; Tue, 8 May 2007 20:54:41 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id EB05213C455 for ; Tue, 8 May 2007 20:54:40 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l48Kse2Y051646 for ; Tue, 8 May 2007 20:54:40 GMT (envelope-from bms@incunabulum.net) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l48KseXv051643 for perforce@freebsd.org; Tue, 8 May 2007 20:54:40 GMT (envelope-from bms@incunabulum.net) Date: Tue, 8 May 2007 20:54:40 GMT Message-Id: <200705082054.l48KseXv051643@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bms@incunabulum.net using -f From: Bruce M Simpson To: Perforce Change Reviews Cc: Subject: PERFORCE change 119510 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: Tue, 08 May 2007 20:54:41 -0000 http://perforce.freebsd.org/chv.cgi?CH=119510 Change 119510 by bms@bms_anglepoise on 2007/05/08 20:54:18 Add release/deactivate primitives. siba needs to be able to remap itself once it discovers how big its bus space is during probe. Affected files ... .. //depot/projects/mips2/src/sys/mips/mips/nexus.c#9 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/mips/nexus.c#9 (text+ko) ==== @@ -71,6 +71,20 @@ static struct rman irq_rman; static struct rman mem_rman; +#ifdef notyet +/* + * XXX: TODO: Implement bus space barrier functions. + * Currently tag and handle are set when memory resources + * are activated. + */ +struct bus_space_tag nexus_bustag = { + NULL, /* cookie */ + NULL, /* parent bus tag */ + NEXUS_BUS_SPACE, /* type */ + nexus_bus_barrier, /* bus_space_barrier */ +}; +#endif + static struct resource * nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -78,6 +92,8 @@ struct resource *); static device_t nexus_add_child(device_t, int, const char *, int); static int nexus_attach(device_t); +static int nexus_deactivate_resource(device_t, device_t, int, int, + struct resource *); static void nexus_delete_resource(device_t, device_t, int, int); static struct resource_list * nexus_get_reslist(device_t, device_t); @@ -87,6 +103,8 @@ static int nexus_print_child(device_t, device_t); static int nexus_print_all_resources(device_t dev); static int nexus_probe(device_t); +static int nexus_release_resource(device_t, device_t, int, int, + struct resource *); static int nexus_set_resource(device_t, device_t, int, int, u_long, u_long); static int nexus_setup_intr(device_t dev, device_t child, @@ -104,11 +122,13 @@ DEVMETHOD(bus_add_child, nexus_add_child), DEVMETHOD(bus_activate_resource,nexus_activate_resource), DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), + DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), DEVMETHOD(bus_delete_resource, nexus_delete_resource), DEVMETHOD(bus_get_resource, nexus_get_resource), DEVMETHOD(bus_get_resource_list, nexus_get_reslist), DEVMETHOD(bus_hinted_child, nexus_hinted_child), DEVMETHOD(bus_print_child, nexus_print_child), + DEVMETHOD(bus_release_resource, nexus_release_resource), DEVMETHOD(bus_set_resource, nexus_set_resource), DEVMETHOD(bus_setup_intr, nexus_setup_intr), DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), @@ -123,16 +143,12 @@ }; static devclass_t nexus_devclass; -extern int rman_debug; /* XXX XXX */ - static int nexus_probe(device_t dev) { device_set_desc(dev, "MIPS32 root nexus"); - rman_debug = 1; /* XXX XXX */ - irq_rman.rm_start = 0; irq_rman.rm_end = NUM_MIPS_IRQS - 1; irq_rman.rm_type = RMAN_ARRAY; @@ -335,12 +351,6 @@ } rman_set_rid(rv, *rid); -#if 0 - if (type == SYS_RES_MEMORY) { - rman_set_bustag(rv, &nexus_bustag); - rman_set_bushandle(rv, rman_get_start(rv)); - } -#endif if (needactivate) { if (bus_activate_resource(child, type, *rid, rv)) { @@ -426,7 +436,32 @@ struct nexus_device *ndev = DEVTONX(child); struct resource_list *rl = &ndev->nx_resources; + printf("%s: entry\n", __func__); + resource_list_delete(rl, type, rid); } +static int +nexus_release_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + printf("%s: entry\n", __func__); + + if (rman_get_flags(r) & RF_ACTIVE) { + int error = bus_deactivate_resource(child, type, rid, r); + if (error) + return error; + } + + return (rman_release_resource(r)); +} + +static int +nexus_deactivate_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + + return (rman_deactivate_resource(r)); +} + DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0);