FreeBSD/sys/x86/isa/isa.c
/*
 * This implementation simply passes the request up to the parent
 * bus, which in our case is the special i386 nexus, substituting any
 * configured values if the caller defaulted.  We can get away with
 * this because there is no special mapping for ISA resources on an Intel
 * platform.  When porting this code to another architecture, it may be
 * necessary to interpose a mapping layer here.
 */
This implementation simply passes the request up to the parent
bus, which in our case is the special i386 nexus, substituting any
configured values if the caller defaulted.  We can get away with
this because there is no special mapping for ISA resources on an Intel
platform.  When porting this code to another architecture, it may be
necessary to interpose a mapping layer here.
This implementation simply passes the request up to the parent bus which in our case is the special i386 nexus substituting any configured values if the caller defaulted . We can get away with this because there is no special mapping for ISA resources on an Intel platform . When porting this code to another architecture it may be necessary to interpose a mapping layer here .
struct resource *
isa_alloc_resource(device_t bus, device_t child, int type, int *rid,
		   rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
{
	int passthrough = (device_get_parent(child) != bus);
	int isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
	struct isa_device* idev = DEVTOISA(child);
	struct resource_list *rl = &idev->id_resources;
	struct resource_list_entry *rle;
	if (!passthrough && !isdefault) {
		rle = resource_list_find(rl, type, *rid);
		if (!rle) {
			if (*rid < 0)
				return 0;
			switch (type) {
			case SYS_RES_IRQ:
				if (*rid >= ISA_NIRQ)
					return 0;
				break;
			case SYS_RES_DRQ:
				if (*rid >= ISA_NDRQ)
					return 0;
				break;
			case SYS_RES_MEMORY:
				if (*rid >= ISA_NMEM)
					return 0;
				break;
			case SYS_RES_IOPORT:
				if (*rid >= ISA_NPORT)
					return 0;
				break;
			default:
				return 0;
			}
			resource_list_add(rl, type, *rid, start, end, count);
		}
	}
	return resource_list_alloc(rl, bus, child, type, rid,
				   start, end, count, flags);
}
struct resource * isa_alloc_resource ( device_t bus , device_t child , int type , int * rid , rman_res_t start , rman_res_t end , rman_res_t count , u_int flags ) { int passthrough = ( device_get_parent ( child ) != bus ) ; int isdefault = RMAN_IS_DEFAULT_RANGE ( start , end ) ; struct isa_device * idev = DEVTOISA ( child ) ; struct resource_list * rl = & idev -> id_resources ; struct resource_list_entry * rle ; if ( ! passthrough && ! isdefault ) { rle = resource_list_find ( rl , type , * rid ) ; if ( ! rle ) { if ( * rid < 0 ) return 0 ; switch ( type ) { case SYS_RES_IRQ : if ( * rid >= ISA_NIRQ ) return 0 ; break ; case SYS_RES_DRQ : if ( * rid >= ISA_NDRQ ) return 0 ; break ; case SYS_RES_MEMORY : if ( * rid >= ISA_NMEM ) return 0 ; break ; case SYS_RES_IOPORT : if ( * rid >= ISA_NPORT ) return 0 ; break ; default : return 0 ; } resource_list_add ( rl , type , * rid , start , end , count ) ; } } return resource_list_alloc ( rl , bus , child , type , rid , start , end , count , flags ) ; }
This implementation simply passes the request up to the parent
 bus, which in our case is the special i386 nexus, substituting any
 configured values if the caller defaulted.
This implementation simply passes the request up to the parent bus which in our case is the special i386 nexus substituting any configured values if the caller defaulted .
/*
	 * Consider adding a resource definition.
	 */