From owner-p4-projects@FreeBSD.ORG Fri Jul 15 18:09:19 2011 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4482D1065673; Fri, 15 Jul 2011 18:09:19 +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 0659E106566C for ; Fri, 15 Jul 2011 18:09:19 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id CF59B8FC08 for ; Fri, 15 Jul 2011 18:09:18 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id p6FI9IA3092629 for ; Fri, 15 Jul 2011 18:09:18 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id p6FI9Ima092626 for perforce@freebsd.org; Fri, 15 Jul 2011 18:09:18 GMT (envelope-from jhb@freebsd.org) Date: Fri, 15 Jul 2011 18:09:18 GMT Message-Id: <201107151809.p6FI9Ima092626@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 196206 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2011 18:09:19 -0000 http://p4web.freebsd.org/@@196206?ac=10 Change 196206 by jhb@jhb_jhbbsd on 2011/07/15 18:08:28 Add an adjust resource method to the ia64 nexus. I think this is all that ia64 needs to support NEW_PCIB. Affected files ... .. //depot/projects/pci/sys/ia64/ia64/nexus.c#4 edit Differences ... ==== //depot/projects/pci/sys/ia64/ia64/nexus.c#4 (text+ko) ==== @@ -86,6 +86,8 @@ int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); +static int nexus_adjust_resource(device_t, device_t, int, struct resource *, + u_long, u_long); static int nexus_activate_resource(device_t, device_t, int, int, struct resource *); static int nexus_deactivate_resource(device_t, device_t, int, int, @@ -122,6 +124,7 @@ DEVMETHOD(bus_print_child, nexus_print_child), DEVMETHOD(bus_add_child, nexus_add_child), DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), + DEVMETHOD(bus_adjust_resource, nexus_adjust_resource), DEVMETHOD(bus_release_resource, nexus_release_resource), DEVMETHOD(bus_activate_resource, nexus_activate_resource), DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), @@ -238,6 +241,20 @@ return(child); } +static struct rman * +nexus_rman(int type) +{ + switch (type) { + case SYS_RES_IRQ: + return (&irq_rman); + case SYS_RES_IOPORT: + return (&port_rman); + case SYS_RES_MEMORY: + return (&mem_rman); + default: + return (NULL); + } +} /* * Allocate a resource on behalf of child. NB: child is usually going to be a @@ -271,24 +288,10 @@ } flags &= ~RF_ACTIVE; + rm = nexus_rman(type); + if (rm == NULL) + return (NULL); - switch (type) { - case SYS_RES_IRQ: - rm = &irq_rman; - break; - - case SYS_RES_IOPORT: - rm = &port_rman; - break; - - case SYS_RES_MEMORY: - rm = &mem_rman; - break; - - default: - return 0; - } - rv = rman_reserve_resource(rm, start, end, count, flags, child); if (rv == 0) return 0; @@ -305,6 +308,20 @@ } static int +nexus_adjust_resource(device_t bus, device_t child, int type, + struct resource *r, u_long start, u_long end) +{ + struct rman *rm; + + rm = nexus_rman(type); + if (rm == NULL) + return (ENXIO); + if (!rman_is_region_manager(r, rm)) + return (EINVAL); + return (rman_adjust_resource(r, start, end)); +} + +static int nexus_activate_resource(device_t bus, device_t child, int type, int rid, struct resource *r) {