FreeBSD/sys/dev/pci/pci_pci.c
/*
 * Attempt to allocate a resource from the existing resources assigned
 * to a window.
 */
Attempt to allocate a resource from the existing resources assigned
to a window.
Attempt to allocate a resource from the existing resources assigned to a window .
static struct resource *
pcib_suballoc_resource(struct pcib_softc *sc, struct pcib_window *w,
    device_t child, int type, int *rid, rman_res_t start, rman_res_t end,
    rman_res_t count, u_int flags)
{
	struct resource *res;
	if (!pcib_is_window_open(w))
		return (NULL);
	res = rman_reserve_resource(&w->rman, start, end, count,
	    flags & ~RF_ACTIVE, child);
	if (res == NULL)
		return (NULL);
	if (bootverbose)
		device_printf(sc->dev,
		    "allocated %s range (%#jx-%#jx) for rid %x of %s\n",
		    w->name, rman_get_start(res), rman_get_end(res), *rid,
		    pcib_child_name(child));
	rman_set_rid(res, *rid);
	if (flags & RF_ACTIVE) {
		if (bus_activate_resource(child, type, *rid, res) != 0) {
			rman_release_resource(res);
			return (NULL);
		}
	}
	return (res);
}
static struct resource * pcib_suballoc_resource ( struct pcib_softc * sc , struct pcib_window * w , device_t child , int type , int * rid , rman_res_t start , rman_res_t end , rman_res_t count , u_int flags ) { struct resource * res ; if ( ! pcib_is_window_open ( w ) ) return ( NULL ) ; res = rman_reserve_resource ( & w -> rman , start , end , count , flags & ~ RF_ACTIVE , child ) ; if ( res == NULL ) return ( NULL ) ; if ( bootverbose ) device_printf ( sc -> dev , " \n " , w -> name , rman_get_start ( res ) , rman_get_end ( res ) , * rid , pcib_child_name ( child ) ) ; rman_set_rid ( res , * rid ) ; if ( flags & RF_ACTIVE ) { if ( bus_activate_resource ( child , type , * rid , res ) != 0 ) { rman_release_resource ( res ) ; return ( NULL ) ; } } return ( res ) ; }
Attempt to allocate a resource from the existing resources assigned
 to a window.
Attempt to allocate a resource from the existing resources assigned to a window .
/*
	 * If the resource should be active, pass that request up the
	 * tree.  This assumes the parent drivers can handle
	 * activating sub-allocated resources.
	 */