FreeBSD/sys/sparc64/pci/apb.c
/*
 * We have to trap resource allocation requests and ensure that the bridge
 * is set up to, or capable of handling them.
 */
We have to trap resource allocation requests and ensure that the bridge
is set up to, or capable of handling them.
We have to trap resource allocation requests and ensure that the bridge is set up to or capable of handling them .
static struct resource *
apb_alloc_resource(device_t dev, device_t child, int type, int *rid,
    rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
{
	struct apb_softc *sc;
	sc = device_get_softc(dev);
	if (RMAN_IS_DEFAULT_RANGE(start, end)) {
		device_printf(dev, "can't decode default resource id %d for "
		    "%s, bypassing\n", *rid, device_get_nameunit(child));
		goto passup;
	}
	switch (type) {
	case SYS_RES_IOPORT:
		if (!apb_checkrange(sc->sc_iomap, APB_IO_SCALE, start, end)) {
			device_printf(dev, "device %s requested unsupported "
			    "I/O range 0x%jx-0x%jx\n",
			    device_get_nameunit(child), start, end);
			return (NULL);
		}
		if (bootverbose)
			device_printf(sc->sc_bsc.ops_pcib_sc.dev, "device "
			    "%s requested decoded I/O range 0x%jx-0x%jx\n",
			    device_get_nameunit(child), start, end);
		break;
	case SYS_RES_MEMORY:
		if (!apb_checkrange(sc->sc_memmap, APB_MEM_SCALE, start,
		    end)) {
			device_printf(dev, "device %s requested unsupported "
			    "memory range 0x%jx-0x%jx\n",
			    device_get_nameunit(child), start, end);
			return (NULL);
		}
		if (bootverbose)
			device_printf(sc->sc_bsc.ops_pcib_sc.dev, "device "
			    "%s requested decoded memory range 0x%jx-0x%jx\n",
			    device_get_nameunit(child), start, end);
		break;
	}
 passup:
	return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
	    count, flags));
}
static struct resource * apb_alloc_resource ( device_t dev , device_t child , int type , int * rid , rman_res_t start , rman_res_t end , rman_res_t count , u_int flags ) { struct apb_softc * sc ; sc = device_get_softc ( dev ) ; if ( RMAN_IS_DEFAULT_RANGE ( start , end ) ) { device_printf ( dev , " " " \n " , * rid , device_get_nameunit ( child ) ) ; goto passup ; } switch ( type ) { case SYS_RES_IOPORT : if ( ! apb_checkrange ( sc -> sc_iomap , APB_IO_SCALE , start , end ) ) { device_printf ( dev , " " " \n " , device_get_nameunit ( child ) , start , end ) ; return ( NULL ) ; } if ( bootverbose ) device_printf ( sc -> sc_bsc . ops_pcib_sc . dev , " " " \n " , device_get_nameunit ( child ) , start , end ) ; break ; case SYS_RES_MEMORY : if ( ! apb_checkrange ( sc -> sc_memmap , APB_MEM_SCALE , start , end ) ) { device_printf ( dev , " " " \n " , device_get_nameunit ( child ) , start , end ) ; return ( NULL ) ; } if ( bootverbose ) device_printf ( sc -> sc_bsc . ops_pcib_sc . dev , " " " \n " , device_get_nameunit ( child ) , start , end ) ; break ; } passup : return ( bus_generic_alloc_resource ( dev , child , type , rid , start , end , count , flags ) ) ; }
We have to trap resource allocation requests and ensure that the bridge
 is set up to, or capable of handling them.
We have to trap resource allocation requests and ensure that the bridge is set up to or capable of handling them .
/*
	 * If this is a "default" allocation against this rid, we can't work
	 * out where it's coming from (we should actually never see these) so
	 * we just have to punt.
	 */ /*
	 * Fail the allocation for this range if it's not supported.
	 * XXX we should probably just fix up the bridge decode and
	 * soldier on.
	 */ /*
	 * Bridge is OK decoding this resource, so pass it up.
	 */