FreeBSD kernel kern code
|
#include "opt_ddb.h"
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <sys/sysctl.h>
Go to the source code of this file.
Data Structures | |
struct | resource_i |
Macros | |
#define | DPRINTF(params) if (rman_debug) printf params |
#define | SHARE_TYPE(f) (f & (RF_SHAREABLE | RF_PREFETCHABLE)) |
Functions | |
__FBSDID ("$FreeBSD$") | |
SYSCTL_INT (_debug, OID_AUTO, rman_debug, CTLFLAG_RWTUN, &rman_debug, 0, "rman debug") | |
static | MALLOC_DEFINE (M_RMAN, "rman", "Resource manager") |
static int | int_rman_release_resource (struct rman *rm, struct resource_i *r) |
static __inline struct resource_i * | int_alloc_resource (int malloc_flag) |
int | rman_init (struct rman *rm) |
int | rman_manage_region (struct rman *rm, rman_res_t start, rman_res_t end) |
int | rman_init_from_resource (struct rman *rm, struct resource *r) |
int | rman_fini (struct rman *rm) |
int | rman_first_free_region (struct rman *rm, rman_res_t *start, rman_res_t *end) |
int | rman_last_free_region (struct rman *rm, rman_res_t *start, rman_res_t *end) |
int | rman_adjust_resource (struct resource *rr, rman_res_t start, rman_res_t end) |
struct resource * | rman_reserve_resource_bound (struct rman *rm, rman_res_t start, rman_res_t end, rman_res_t count, rman_res_t bound, u_int flags, device_t dev) |
struct resource * | rman_reserve_resource (struct rman *rm, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags, device_t dev) |
int | rman_activate_resource (struct resource *re) |
int | rman_deactivate_resource (struct resource *r) |
int | rman_release_resource (struct resource *re) |
uint32_t | rman_make_alignment_flags (uint32_t size) |
void | rman_set_start (struct resource *r, rman_res_t start) |
rman_res_t | rman_get_start (struct resource *r) |
void | rman_set_end (struct resource *r, rman_res_t end) |
rman_res_t | rman_get_end (struct resource *r) |
rman_res_t | rman_get_size (struct resource *r) |
u_int | rman_get_flags (struct resource *r) |
void | rman_set_virtual (struct resource *r, void *v) |
void * | rman_get_virtual (struct resource *r) |
void | rman_set_irq_cookie (struct resource *r, void *c) |
void * | rman_get_irq_cookie (struct resource *r) |
void | rman_set_bustag (struct resource *r, bus_space_tag_t t) |
bus_space_tag_t | rman_get_bustag (struct resource *r) |
void | rman_set_bushandle (struct resource *r, bus_space_handle_t h) |
bus_space_handle_t | rman_get_bushandle (struct resource *r) |
void | rman_set_mapping (struct resource *r, struct resource_map *map) |
void | rman_get_mapping (struct resource *r, struct resource_map *map) |
void | rman_set_rid (struct resource *r, int rid) |
int | rman_get_rid (struct resource *r) |
void | rman_set_device (struct resource *r, device_t dev) |
device_t | rman_get_device (struct resource *r) |
int | rman_is_region_manager (struct resource *r, struct rman *rm) |
static int | sysctl_rman (SYSCTL_HANDLER_ARGS) |
static | SYSCTL_NODE (_hw_bus, OID_AUTO, rman, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_rman, "kernel resource manager") |
Variables | |
static int | rman_debug = 0 |
struct rman_head | rman_head |
static struct mtx | rman_mtx |
#define DPRINTF | ( | params | ) | if (rman_debug) printf params |
Definition at line 103 of file subr_rman.c.
#define SHARE_TYPE | ( | f | ) | (f & (RF_SHAREABLE | RF_PREFETCHABLE)) |
Definition at line 431 of file subr_rman.c.
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 112 of file subr_rman.c.
References malloc(), and resource_i::r_r.
Referenced by rman_adjust_resource(), rman_manage_region(), and rman_reserve_resource_bound().
|
static |
Definition at line 688 of file subr_rman.c.
References free().
Referenced by rman_release_resource().
|
static |
int rman_activate_resource | ( | struct resource * | re | ) |
Definition at line 662 of file subr_rman.c.
int rman_adjust_resource | ( | struct resource * | rr, |
rman_res_t | start, | ||
rman_res_t | end | ||
) |
Definition at line 311 of file subr_rman.c.
References free(), int_alloc_resource(), panic(), and start.
int rman_deactivate_resource | ( | struct resource * | r | ) |
Definition at line 676 of file subr_rman.c.
int rman_fini | ( | struct rman * | rm | ) |
Definition at line 242 of file subr_rman.c.
References free(), rman_head, and rman_mtx.
int rman_first_free_region | ( | struct rman * | rm, |
rman_res_t * | start, | ||
rman_res_t * | end | ||
) |
Definition at line 274 of file subr_rman.c.
References start.
bus_space_handle_t rman_get_bushandle | ( | struct resource * | r | ) |
Definition at line 906 of file subr_rman.c.
Referenced by rman_get_mapping().
bus_space_tag_t rman_get_bustag | ( | struct resource * | r | ) |
Definition at line 892 of file subr_rman.c.
Referenced by rman_get_mapping().
device_t rman_get_device | ( | struct resource * | r | ) |
Definition at line 955 of file subr_rman.c.
Referenced by resource_list_purge().
rman_res_t rman_get_end | ( | struct resource * | r | ) |
Definition at line 836 of file subr_rman.c.
Referenced by intr_activate_irq(), intr_deactivate_irq(), intr_describe_irq(), intr_setup_irq(), intr_teardown_irq(), and resource_list_alloc().
u_int rman_get_flags | ( | struct resource * | r | ) |
Definition at line 850 of file subr_rman.c.
Referenced by resource_list_busy(), and resource_list_release().
void * rman_get_irq_cookie | ( | struct resource * | r | ) |
Definition at line 878 of file subr_rman.c.
void rman_get_mapping | ( | struct resource * | r, |
struct resource_map * | map | ||
) |
Definition at line 924 of file subr_rman.c.
References rman_get_bushandle(), rman_get_bustag(), rman_get_size(), and rman_get_virtual().
int rman_get_rid | ( | struct resource * | r | ) |
Definition at line 941 of file subr_rman.c.
Referenced by bus_free_resource(), and resource_list_release_active().
rman_res_t rman_get_size | ( | struct resource * | r | ) |
Definition at line 843 of file subr_rman.c.
Referenced by rman_get_mapping(), and rman_set_mapping().
rman_res_t rman_get_start | ( | struct resource * | r | ) |
Definition at line 822 of file subr_rman.c.
Referenced by intr_activate_irq(), intr_deactivate_irq(), intr_describe_irq(), intr_is_per_cpu(), intr_setup_irq(), intr_teardown_irq(), and resource_list_alloc().
void * rman_get_virtual | ( | struct resource * | r | ) |
Definition at line 864 of file subr_rman.c.
Referenced by intr_deactivate_irq(), intr_setup_irq(), intr_teardown_irq(), and rman_get_mapping().
int rman_init | ( | struct rman * | rm | ) |
Definition at line 124 of file subr_rman.c.
References malloc(), panic(), rman_head, and rman_mtx.
Referenced by rman_init_from_resource().
int rman_init_from_resource | ( | struct rman * | rm, |
struct resource * | r | ||
) |
Definition at line 232 of file subr_rman.c.
References rman_init(), and rman_manage_region().
int rman_is_region_manager | ( | struct resource * | r, |
struct rman * | rm | ||
) |
Definition at line 962 of file subr_rman.c.
int rman_last_free_region | ( | struct rman * | rm, |
rman_res_t * | start, | ||
rman_res_t * | end | ||
) |
Definition at line 292 of file subr_rman.c.
References start.
uint32_t rman_make_alignment_flags | ( | uint32_t | size | ) |
Definition at line 797 of file subr_rman.c.
int rman_manage_region | ( | struct rman * | rm, |
rman_res_t | start, | ||
rman_res_t | end | ||
) |
Definition at line 154 of file subr_rman.c.
References DPRINTF, free(), int_alloc_resource(), and start.
Referenced by rman_init_from_resource().
int rman_release_resource | ( | struct resource * | re | ) |
Definition at line 782 of file subr_rman.c.
References int_rman_release_resource().
struct resource * rman_reserve_resource | ( | struct rman * | rm, |
rman_res_t | start, | ||
rman_res_t | end, | ||
rman_res_t | count, | ||
u_int | flags, | ||
device_t | dev | ||
) |
Definition at line 653 of file subr_rman.c.
References count, flags, rman_reserve_resource_bound(), and start.
struct resource * rman_reserve_resource_bound | ( | struct rman * | rm, |
rman_res_t | start, | ||
rman_res_t | end, | ||
rman_res_t | count, | ||
rman_res_t | bound, | ||
u_int | flags, | ||
device_t | dev | ||
) |
Definition at line 434 of file subr_rman.c.
References count, device_get_nameunit(), DPRINTF, flags, free(), int_alloc_resource(), malloc(), resource_i::r_r, SHARE_TYPE, and start.
Referenced by rman_reserve_resource().
void rman_set_bushandle | ( | struct resource * | r, |
bus_space_handle_t | h | ||
) |
Definition at line 899 of file subr_rman.c.
Referenced by rman_set_mapping().
void rman_set_bustag | ( | struct resource * | r, |
bus_space_tag_t | t | ||
) |
Definition at line 885 of file subr_rman.c.
Referenced by rman_set_mapping().
void rman_set_device | ( | struct resource * | r, |
device_t | dev | ||
) |
Definition at line 948 of file subr_rman.c.
void rman_set_end | ( | struct resource * | r, |
rman_res_t | end | ||
) |
Definition at line 829 of file subr_rman.c.
void rman_set_irq_cookie | ( | struct resource * | r, |
void * | c | ||
) |
Definition at line 871 of file subr_rman.c.
void rman_set_mapping | ( | struct resource * | r, |
struct resource_map * | map | ||
) |
Definition at line 913 of file subr_rman.c.
References rman_get_size(), rman_set_bushandle(), rman_set_bustag(), and rman_set_virtual().
void rman_set_rid | ( | struct resource * | r, |
int | rid | ||
) |
Definition at line 934 of file subr_rman.c.
void rman_set_start | ( | struct resource * | r, |
rman_res_t | start | ||
) |
Definition at line 815 of file subr_rman.c.
References start.
void rman_set_virtual | ( | struct resource * | r, |
void * | v | ||
) |
Definition at line 857 of file subr_rman.c.
Referenced by intr_activate_irq(), intr_deactivate_irq(), and rman_set_mapping().
SYSCTL_INT | ( | _debug | , |
OID_AUTO | , | ||
rman_debug | , | ||
CTLFLAG_RWTUN | , | ||
& | rman_debug, | ||
0 | , | ||
"rman debug" | |||
) |
|
static |
|
static |
Definition at line 975 of file subr_rman.c.
References bus_data_generation_check(), device_get_name(), device_get_unit(), name, res, rman_head, rman_mtx, and snprintf().
|
static |
Definition at line 99 of file subr_rman.c.
struct rman_head rman_head |
Definition at line 107 of file subr_rman.c.
Referenced by rman_fini(), rman_init(), and sysctl_rman().
|
static |
Definition at line 108 of file subr_rman.c.
Referenced by rman_fini(), rman_init(), and sysctl_rman().