diff options
author | imp <imp@FreeBSD.org> | 2002-11-27 03:55:22 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2002-11-27 03:55:22 +0000 |
commit | 0d50dd2183c2aa653f3dcba7855f40ef7af83386 (patch) | |
tree | 764736e4bfbee80bde6f915fe416da12383a1395 /sys/kern | |
parent | 8380cfda3bd890dc6b0647473ca1ca89a90caa92 (diff) | |
download | FreeBSD-src-0d50dd2183c2aa653f3dcba7855f40ef7af83386.zip FreeBSD-src-0d50dd2183c2aa653f3dcba7855f40ef7af83386.tar.gz |
Make the rman_{get,set}_* macros into real functions. The macros
create an ABI that encodes offsets and sizes of structures into client
drivers. The functions isolate the ABI from changes to the resource
structure. Since these are used very rarely (once at startup), the
speed penalty will be down in the noise.
Also, add r_rid to the structure so that clients can save the 'rid' of
the resource in the struct resource, plus accessor functions. Future
additions to newbus will make use of this to present a simplified
interface for resource specification.
Approved by: re (jhb)
Reviewed by: jhb, jake
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/subr_rman.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c index 858434b..9ebbfcf 100644 --- a/sys/kern/subr_rman.c +++ b/sys/kern/subr_rman.c @@ -613,3 +613,75 @@ rman_make_alignment_flags(uint32_t size) return(RF_ALIGNMENT_LOG2(i)); } + +u_long +rman_get_start(struct resource *r) +{ + return (r->r_start); +} + +u_long +rman_get_end(struct resource *r) +{ + return (r->r_end); +} + +u_long +rman_get_size(struct resource *r) +{ + return (r->r_end - r->r_start + 1); +} + +u_int +rman_get_flags(struct resource *r) +{ + return (r->r_flags); +} + +void +rman_set_virtual(struct resource *r, void *v) +{ + r->r_virtual = v; +} + +void * +rman_get_virtual(struct resource *r) +{ + return (r->r_virtual); +} + +void +rman_set_bustag(struct resource *r, bus_space_tag_t t) +{ + r->r_bustag = t; +} + +bus_space_tag_t +rman_get_bustag(struct resource *r) +{ + return (r->r_bustag); +} + +void +rman_set_bushandle(struct resource *r, bus_space_handle_t h) +{ + r->r_bushandle = h; +} + +bus_space_handle_t +rman_get_bushandle(struct resource *r) +{ + return (r->r_bushandle); +} + +void +rman_set_rid(struct resource *r, int rid) +{ + r->r_rid = rid; +} + +int +rman_get_rid(struct resource *r) +{ + return (r->r_rid); +} |