FreeBSD/sys/dev/bhnd/siba/siba.c
/**
 * Register all address space mappings for @p di.
 *
 * @param dev The siba bus device.
 * @param di The device info instance on which to register all address
 * space entries.
 * @param r A resource mapping the enumeration table block for @p di.
 */
Register all address space mappings for @p di.
@param dev The siba bus device.
@param di The device info instance on which to register all address
space entries.
@param r A resource mapping the enumeration table block for @p di.
Register all address space mappings for @p di . @param dev The siba bus device . @param di The device info instance on which to register all address space entries . @param r A resource mapping the enumeration table block for @p di .
static int
siba_register_addrspaces(device_t dev, struct siba_devinfo *di,
    struct resource *r)
{
	struct siba_core_id	*cid;
	uint32_t		 addr;
	uint32_t		 size;
	int			 error;
	cid = &di->core_id;
	for (uint8_t i = 0; i < di->core_id.num_addrspace; i++) {
		uint32_t	adm;
		u_int		adm_offset;
		uint32_t	bus_reserved;
		adm_offset = siba_admatch_offset(i);
		if (adm_offset == 0) {
		    device_printf(dev, "addrspace %hhu is unsupported", i);
		    return (ENODEV);
		}
		adm = bus_read_4(r, adm_offset);
		if ((error = siba_parse_admatch(adm, &addr, &size))) {
			device_printf(dev, "failed to decode address "
			    " match register value 0x%x\n", adm);
			return (error);
		}
		bus_reserved = 0;
		if (i == SIBA_CORE_ADDRSPACE)
			bus_reserved = cid->num_cfg_blocks * SIBA_CFG_SIZE;
		error = siba_append_dinfo_region(di, i, addr, size,
		    bus_reserved);
		if (error)
			return (error);
	}
	return (0);
}
static int siba_register_addrspaces ( device_t dev , struct siba_devinfo * di , struct resource * r ) { struct siba_core_id * cid ; uint32_t addr ; uint32_t size ; int error ; cid = & di -> core_id ; for ( uint8_t i = 0 ; i < di -> core_id . num_addrspace ; i ++ ) { uint32_t adm ; u_int adm_offset ; uint32_t bus_reserved ; adm_offset = siba_admatch_offset ( i ) ; if ( adm_offset == 0 ) { device_printf ( dev , " " , i ) ; return ( ENODEV ) ; } adm = bus_read_4 ( r , adm_offset ) ; if ( ( error = siba_parse_admatch ( adm , & addr , & size ) ) ) { device_printf ( dev , " " " \n " , adm ) ; return ( error ) ; } bus_reserved = 0 ; if ( i == SIBA_CORE_ADDRSPACE ) bus_reserved = cid -> num_cfg_blocks * SIBA_CFG_SIZE ; error = siba_append_dinfo_region ( di , i , addr , size , bus_reserved ) ; if ( error ) return ( error ) ; } return ( 0 ) ; }
Register all address space mappings for @p di.
Register all address space mappings for @p di .
/* Register the device address space entries */ /* Determine the register offset */ /* Fetch the address match register value */ /* Parse the value */ /* If this is the device's core/enumeration addrespace,
		 * reserve the Sonics configuration register blocks for the
		 * use of our bus. */ /* Append the region info */