Module Name: src
Committed By: riastradh
Date: Sun Dec 19 01:40:04 UTC 2021
Modified Files:
src/sys/external/bsd/drm2/include/linux: ioport.h
Log Message:
DEFINE_RES_MEM, resource_contains
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/ioport.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/drm2/include/linux/ioport.h
diff -u src/sys/external/bsd/drm2/include/linux/ioport.h:1.4 src/sys/external/bsd/drm2/include/linux/ioport.h:1.5
--- src/sys/external/bsd/drm2/include/linux/ioport.h:1.4 Sun Dec 19 01:38:58 2021
+++ src/sys/external/bsd/drm2/include/linux/ioport.h Sun Dec 19 01:40:04 2021
@@ -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)
{