FreeBSD/sys/dev/bhnd/bhndb/bhndb.c
/**
 * Slow path for bhndb_io_resource().
 *
 * Iterates over the existing allocated dynamic windows looking for a viable
 * in-use region; the first matching region is returned.
 */
Slow path for bhndb_io_resource().
Iterates over the existing allocated dynamic windows looking for a viable
in-use region; the first matching region is returned.
Slow path for bhndb_io_resource () . Iterates over the existing allocated dynamic windows looking for a viable in - use region ; the first matching region is returned .
static struct bhndb_dw_alloc *
bhndb_io_resource_slow(struct bhndb_softc *sc, bus_addr_t addr,
    bus_size_t size, bus_size_t *offset)
{
	struct bhndb_resources	*br;
	struct bhndb_dw_alloc	*dwa;
	BHNDB_LOCK_ASSERT(sc, MA_OWNED);
	br = sc->bus_res;
	for (size_t i = 0; i < br->dwa_count; i++) {
		const struct bhndb_regwin *win;
		dwa = &br->dw_alloc[i];
		win = dwa->win;
		KASSERT(win->win_type == BHNDB_REGWIN_T_DYN,
			("invalid register window type"));
		if (addr < dwa->target)
			continue;
		if (addr + size > dwa->target + win->win_size)
			continue;
		*offset = dwa->win->win_offset;
		*offset += addr - dwa->target;
		return (dwa);
	}
	return (NULL);
}
static struct bhndb_dw_alloc * bhndb_io_resource_slow ( struct bhndb_softc * sc , bus_addr_t addr , bus_size_t size , bus_size_t * offset ) { struct bhndb_resources * br ; struct bhndb_dw_alloc * dwa ; BHNDB_LOCK_ASSERT ( sc , MA_OWNED ) ; br = sc -> bus_res ; for ( size_t i = 0 ; i < br -> dwa_count ; i ++ ) { const struct bhndb_regwin * win ; dwa = & br -> dw_alloc [ i ] ; win = dwa -> win ; KASSERT ( win -> win_type == BHNDB_REGWIN_T_DYN , ( " " ) ) ; if ( addr < dwa -> target ) continue ; if ( addr + size > dwa -> target + win -> win_size ) continue ; * offset = dwa -> win -> win_offset ; * offset += addr - dwa -> target ; return ( dwa ) ; } return ( NULL ) ; }
Slow path for bhndb_io_resource().
Slow path for bhndb_io_resource () .
/* Search for an existing dynamic mapping of this address range.
	 * Static regions are not searched, as a statically mapped
	 * region would never be allocated as an indirect resource. */ /* Verify the range */ /* Found */ /* not found */