From owner-p4-projects@FreeBSD.ORG Mon May 7 16:46:31 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 9FDB716A409; Mon, 7 May 2007 16:46:31 +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 3823716A403 for ; Mon, 7 May 2007 16:46:31 +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 24C3B13C45E for ; Mon, 7 May 2007 16:46:31 +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 l47GkVcO063509 for ; Mon, 7 May 2007 16:46:31 GMT (envelope-from bms@incunabulum.net) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l47GkUE5063506 for perforce@freebsd.org; Mon, 7 May 2007 16:46:30 GMT (envelope-from bms@incunabulum.net) Date: Mon, 7 May 2007 16:46:30 GMT Message-Id: <200705071646.l47GkUE5063506@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 119429 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: Mon, 07 May 2007 16:46:32 -0000 http://perforce.freebsd.org/chv.cgi?CH=119429 Change 119429 by bms@bms_anglepoise on 2007/05/07 16:46:01 style(9) Affected files ... .. //depot/projects/mips2/src/sys/mips/mips/nexus.c#5 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/mips/nexus.c#5 (text+ko) ==== @@ -12,7 +12,7 @@ * no representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. - * + * * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF @@ -70,19 +70,20 @@ static struct rman irq_rman; -static int nexus_probe(device_t); -static int nexus_attach(device_t); -static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t, int, const char *, int); -static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); -static int nexus_activate_resource(device_t, device_t, int, int, - struct resource *); -static int -nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, - driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep); -static int -nexus_teardown_intr(device_t, device_t, struct resource *, void *); +static int nexus_probe(device_t); +static int nexus_attach(device_t); +static int nexus_print_child(device_t, device_t); +static device_t nexus_add_child(device_t, int, const char *, int); +static struct resource * + nexus_alloc_resource(device_t, device_t, int, int *, u_long, + u_long, u_long, u_int); +static int nexus_activate_resource(device_t, device_t, int, int, + struct resource *); +static int nexus_setup_intr(device_t dev, device_t child, + struct resource *res, int flags, driver_filter_t *filt, + driver_intr_t *intr, void *arg, void **cookiep); +static int nexus_teardown_intr(device_t, device_t, struct resource *, + void *); static device_method_t nexus_methods[] = { /* Device interface */ @@ -108,17 +109,18 @@ static int nexus_probe(device_t dev) { - device_quiet(dev); /* suppress attach message for neatness */ - + + device_quiet(dev); /* suppress attach message for neatness */ + irq_rman.rm_start = 0; irq_rman.rm_end = 5; irq_rman.rm_type = RMAN_ARRAY; irq_rman.rm_descr = "Hardware IRQs"; - if (rman_init(&irq_rman) - || rman_manage_region(&irq_rman, 0, 5)) + if (rman_init(&irq_rman) != 0 || + rman_manage_region(&irq_rman, 0, 5) != 0) { panic("nexus_probe irq_rman"); + } - return (0); } @@ -130,18 +132,20 @@ register_t sr = intr_disable(); irq = rman_get_start(res); - if(irq > 5) - return(0); - - cpu_establish_hardintr(device_get_nameunit(child), filt, intr, arg, + if (irq > 5) + return (0); + + cpu_establish_hardintr(device_get_nameunit(child), filt, intr, arg, irq, flags, cookiep); intr_restore(sr); + return (0); } static int nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih) { + printf("Unimplemented %s at %s:%d\n", __func__, __FILE__, __LINE__); return (0); } @@ -149,24 +153,21 @@ static int nexus_attach(device_t dev) { - /* - * First, deal with the children we know about already - */ + bus_generic_probe(dev); bus_generic_attach(dev); - - return 0; + + return (0); } - static int nexus_print_child(device_t bus, device_t child) { int retval = 0; - + retval += bus_print_child_header(bus, child); retval += printf(" on motherboard\n"); /* XXX "motherboard", ick */ - + return (retval); } @@ -177,21 +178,19 @@ device_t child; struct nexus_device *ndev; - ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT|M_ZERO); if (!ndev) - return(0); + return (0); resource_list_init(&ndev->nx_resources); child = device_add_child_ordered(bus, order, name, unit); - + /* should we free this in nexus_child_detached? */ device_set_ivars(child, ndev); - - return(child); + + return (child); } - /* * Allocate a resource on behalf of child. NB: child is usually going to be a * child of one of our descendants, not a direct child of nexus0. @@ -209,32 +208,33 @@ case SYS_RES_IRQ: rm = &irq_rman; break; - + default: - return 0; + return (0); } rv = rman_reserve_resource(rm, start, end, count, flags, child); if (rv == 0) - return 0; + return (0); rman_set_rid(rv, *rid); - + if (needactivate) { if (bus_activate_resource(child, type, *rid, rv)) { rman_release_resource(rv); - return 0; + return (0); } } - - return rv; + + return (rv); } static int nexus_activate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) + struct resource *r) { + return (rman_activate_resource(r)); }