Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/include/linux DEFINE_RES_MEM, resource...



details:   https://anonhg.NetBSD.org/src/rev/23c48de36a7a
branches:  trunk
changeset: 1028021:23c48de36a7a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 01:40:04 2021 +0000

description:
DEFINE_RES_MEM, resource_contains

diffstat:

 sys/external/bsd/drm2/include/linux/ioport.h |  13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diffs (33 lines):

diff -r 08944d05ab69 -r 23c48de36a7a sys/external/bsd/drm2/include/linux/ioport.h
--- a/sys/external/bsd/drm2/include/linux/ioport.h      Sun Dec 19 01:39:57 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/ioport.h      Sun Dec 19 01:40:04 2021 +0000
@@ -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 @@
        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)
 {



Home | Main Index | Thread Index | Old Index