FreeBSD/sys/dev/bhnd/bhndb/bhndb_subr.c
/**
 * Add a bus region entry to @p r for the given base @p addr and @p size.
 * 
 * @param br The resource state to which the bus region entry will be added.
 * @param addr The base address of this region.
 * @param size The size of this region.
 * @param priority The resource priority to be assigned to allocations
 * made within this bus region.
 * @param static_regwin If available, a static register window mapping this
 * bus region entry. If not available, NULL.
 * 
 * @retval 0 success
 * @retval non-zero if adding the bus region fails.
 */
Add a bus region entry to @p r for the given base @p addr and @p size.

@param br The resource state to which the bus region entry will be added.
@param addr The base address of this region.
@param size The size of this region.
@param priority The resource priority to be assigned to allocations
made within this bus region.
@param static_regwin If available, a static register window mapping this
bus region entry. If not available, NULL.

@retval 0 success
@retval non-zero if adding the bus region fails.
Add a bus region entry to @p r for the given base @p addr and @p size . @param br The resource state to which the bus region entry will be added . @param addr The base address of this region . @param size The size of this region . @param priority The resource priority to be assigned to allocations made within this bus region . @param static_regwin If available a static register window mapping this bus region entry . If not available NULL . @retval 0 success @retval non - zero if adding the bus region fails .
int
bhndb_add_resource_region(struct bhndb_resources *br, bhnd_addr_t addr,
    bhnd_size_t size, bhndb_priority_t priority,
    const struct bhndb_regwin *static_regwin)
{
	struct bhndb_region	*reg;
	reg = malloc(sizeof(*reg), M_BHND, M_NOWAIT);
	if (reg == NULL)
		return (ENOMEM);
	*reg = (struct bhndb_region) {
		.addr = addr,
		.size = size,
		.priority = priority,
		.static_regwin = static_regwin
	};
	STAILQ_INSERT_HEAD(&br->bus_regions, reg, link);
	return (0);
}
int bhndb_add_resource_region ( struct bhndb_resources * br , bhnd_addr_t addr , bhnd_size_t size , bhndb_priority_t priority , const struct bhndb_regwin * static_regwin ) { struct bhndb_region * reg ; reg = malloc ( sizeof ( * reg ) , M_BHND , M_NOWAIT ) ; if ( reg == NULL ) return ( ENOMEM ) ; * reg = ( struct bhndb_region ) { . addr = addr , . size = size , . priority = priority , . static_regwin = static_regwin } ; STAILQ_INSERT_HEAD ( & br -> bus_regions , reg , link ) ; return ( 0 ) ; }
Add a bus region entry to @p r for the given base @p addr and @p size.
Add a bus region entry to @p r for the given base @p addr and @p size .
/* Insert in the bus resource list */