diff options
| author | riastradh <riastradh@NetBSD.org> | 2021-12-19 01:40:04 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2021-12-19 01:40:04 +0000 |
| commit | bcefeeeb0884ce51fc404df89e524e90e79190c4 (patch) | |
| tree | 3993b9948e559d678a28ef8769df7fb5e1d3d947 /sys/external/bsd/drm2/include/linux | |
| parent | 4d72f7e73f448501b3a4c01d4c9228d41e765ceb (diff) | |
DEFINE_RES_MEM, resource_contains
Diffstat (limited to 'sys/external/bsd/drm2/include/linux')
| -rw-r--r-- | sys/external/bsd/drm2/include/linux/ioport.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/external/bsd/drm2/include/linux/ioport.h b/sys/external/bsd/drm2/include/linux/ioport.h index 7694d92d13f..b2b505189a7 100644 --- a/sys/external/bsd/drm2/include/linux/ioport.h +++ b/sys/external/bsd/drm2/include/linux/ioport.h @@ -1,4 +1,4 @@ -/* $NetBSD: ioport.h,v 1.4 2021/12/19 01:38:58 riastradh Exp $ */ +/* $NetBSD: ioport.h,v 1.5 2021/12/19 01:40:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -47,12 +47,23 @@ struct resource { bus_space_handle_t r_bsh; }; +#define DEFINE_RES_MEM(START, SIZE) \ + { .start = (START), .end = (START) + ((SIZE) - 1) } + static inline bus_size_t resource_size(struct resource *resource) { return resource->end - resource->start + 1; } +static inline bool +resource_contains(struct resource *r1, struct resource *r2) +{ + if (r1->r_bst != r2->r_bst) + return false; + return r1->start <= r2->start && r2->end <= r1->end; +} + static inline void release_resource(struct resource *resource) { |
