Date: Tue, 8 May 2007 20:54:40 GMT From: Bruce M Simpson <bms@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 119510 for review Message-ID: <200705082054.l48KseXv051643@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705082054.l48KseXv051643>