FreeBSD/sys/kern/subr_bus.c
/**
 * @brief Add or modify a resource entry.
 *
 * If an existing entry exists with the same type and rid, it will be
 * modified using the given values of @p start, @p end and @p
 * count. If no entry exists, a new one will be created using the
 * given values.  The resource list entry that matches is then returned.
 *
 * @param rl		the resource list to edit
 * @param type		the resource entry type (e.g. SYS_RES_MEMORY)
 * @param rid		the resource identifier
 * @param start		the start address of the resource
 * @param end		the end address of the resource
 * @param count		XXX end-start+1
 */
@brief Add or modify a resource entry.
If an existing entry exists with the same type and rid, it will be
modified using the given values of @p start, @p end and @p
count. If no entry exists, a new one will be created using the
given values.  The resource list entry that matches is then returned.


@brief Add or modify a resource entry . If an existing entry exists with the same type and rid it will be modified using the given values of @p start @p end and @p count . If no entry exists a new one will be created using the given values . The resource list entry that matches is then returned .
struct resource_list_entry *
resource_list_add(struct resource_list *rl, int type, int rid,
    rman_res_t start, rman_res_t end, rman_res_t count)
{
	struct resource_list_entry *rle;
	rle = resource_list_find(rl, type, rid);
	if (!rle) {
		rle = malloc(sizeof(struct resource_list_entry), M_BUS,
		    M_NOWAIT);
		if (!rle)
			panic("resource_list_add: can't record entry");
		STAILQ_INSERT_TAIL(rl, rle, link);
		rle->type = type;
		rle->rid = rid;
		rle->res = NULL;
		rle->flags = 0;
	}
	if (rle->res)
		panic("resource_list_add: resource entry is busy");
	rle->start = start;
	rle->end = end;
	rle->count = count;
	return (rle);
}
struct resource_list_entry * resource_list_add ( struct resource_list * rl , int type , int rid , rman_res_t start , rman_res_t end , rman_res_t count ) { struct resource_list_entry * rle ; rle = resource_list_find ( rl , type , rid ) ; if ( ! rle ) { rle = malloc ( sizeof ( struct resource_list_entry ) , M_BUS , M_NOWAIT ) ; if ( ! rle ) panic ( " " ) ; STAILQ_INSERT_TAIL ( rl , rle , link ) ; rle -> type = type ; rle -> rid = rid ; rle -> res = NULL ; rle -> flags = 0 ; } if ( rle -> res ) panic ( " " ) ; rle -> start = start ; rle -> end = end ; rle -> count = count ; return ( rle ) ; }
@brief Add or modify a resource entry.
@brief Add or modify a resource entry .