FreeBSD/sys/dev/bhnd/bhndb/bhndb.c
/**
 * Initialize child resource @p r with a virtual address, tag, and handle
 * copied from @p parent, adjusted to contain only the range defined by
 * @p offsize and @p size.
 * 
 * @param r The register to be initialized.
 * @param parent The parent bus resource that fully contains the subregion.
 * @param offset The subregion offset within @p parent.
 * @param size The subregion size.
 * @p r.
 */
Initialize child resource @p r with a virtual address, tag, and handle
copied from @p parent, adjusted to contain only the range defined by
@p offsize and @p size.

@param r The register to be initialized.
@param parent The parent bus resource that fully contains the subregion.
@param offset The subregion offset within @p parent.
@param size The subregion size.
@p r.
Initialize child resource @p r with a virtual address tag and handle copied from @p parent adjusted to contain only the range defined by @p offsize and @p size . @param r The register to be initialized . @param parent The parent bus resource that fully contains the subregion . @param offset The subregion offset within @p parent . @param size The subregion size . @p r .
static int
bhndb_init_child_resource(struct resource *r,
    struct resource *parent, bhnd_size_t offset, bhnd_size_t size)
{
	bus_space_handle_t	bh, child_bh;
	bus_space_tag_t		bt;
	uintptr_t		vaddr;
	int			error;
	vaddr = (uintptr_t) rman_get_virtual(parent);
	bt = rman_get_bustag(parent);
	bh = rman_get_bushandle(parent);
	vaddr += offset;
	error = bus_space_subregion(bt, bh, offset, size, &child_bh);
	if (error)
		return (error);
	rman_set_virtual(r, (void *) vaddr);
	rman_set_bustag(r, bt);
	rman_set_bushandle(r, child_bh);
	return (0);
}
static int bhndb_init_child_resource ( struct resource * r , struct resource * parent , bhnd_size_t offset , bhnd_size_t size ) { bus_space_handle_t bh , child_bh ; bus_space_tag_t bt ; uintptr_t vaddr ; int error ; vaddr = ( uintptr_t ) rman_get_virtual ( parent ) ; bt = rman_get_bustag ( parent ) ; bh = rman_get_bushandle ( parent ) ; vaddr += offset ; error = bus_space_subregion ( bt , bh , offset , size , & child_bh ) ; if ( error ) return ( error ) ; rman_set_virtual ( r , ( void * ) vaddr ) ; rman_set_bustag ( r , bt ) ; rman_set_bushandle ( r , child_bh ) ; return ( 0 ) ; }
Initialize child resource @p r with a virtual address, tag, and handle
 copied from @p parent, adjusted to contain only the range defined by
 @p offsize and @p size.
Initialize child resource @p r with a virtual address tag and handle copied from @p parent adjusted to contain only the range defined by @p offsize and @p size .
/* Fetch the parent resource's real bus values */ /* Configure child resource with window-adjusted real bus values */