aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/rman.h
diff options
context:
space:
mode:
authorMike Smith <msmith@FreeBSD.org>2000-11-09 10:21:23 +0000
committerMike Smith <msmith@FreeBSD.org>2000-11-09 10:21:23 +0000
commitedcb5775ec92e05c234f48a08896fbc591c0762a (patch)
treee7d285cec31cf4839d9d7deb0d048472e4ce5933 /sys/sys/rman.h
parent9934b00e8466b567a1f526b46cc887cc1132161d (diff)
downloadsrc-edcb5775ec92e05c234f48a08896fbc591c0762a.tar.gz
src-edcb5775ec92e05c234f48a08896fbc591c0762a.zip
Implement a trivial but effective interface for obtaining the kernel's
device tree and resource manager contents. This is the kernel side of the upcoming libdevinfo, which will expose this information to userspace applications in a trivial fashion. Remove the now-obsolete DEVICE_SYSCTLS code.
Notes
Notes: svn path=/head/; revision=68522
Diffstat (limited to 'sys/sys/rman.h')
-rw-r--r--sys/sys/rman.h61
1 files changed, 44 insertions, 17 deletions
diff --git a/sys/sys/rman.h b/sys/sys/rman.h
index 0ec22050a2d7..6535f200a850 100644
--- a/sys/sys/rman.h
+++ b/sys/sys/rman.h
@@ -36,6 +36,50 @@
#include <sys/queue.h>
#endif
+#define RF_ALLOCATED 0x0001 /* resource has been reserved */
+#define RF_ACTIVE 0x0002 /* resource allocation has been activated */
+#define RF_SHAREABLE 0x0004 /* resource permits contemporaneous sharing */
+#define RF_TIMESHARE 0x0008 /* resource permits time-division sharing */
+#define RF_WANTED 0x0010 /* somebody is waiting for this resource */
+#define RF_FIRSTSHARE 0x0020 /* first in sharing list */
+
+#define RF_ALIGNMENT_SHIFT 10 /* alignment size bit starts bit 10 */
+#define RF_ALIGNMENT_MASK (0x003F << RF_ALIGNMENT_SHIFT)
+ /* resource address alignemnt size bit mask */
+#define RF_ALIGNMENT_LOG2(x) ((x) << RF_ALIGNMENT_SHIFT)
+#define RF_ALIGNMENT(x) (((x) & RF_ALIGNMENT_MASK) >> RF_ALIGNMENT_SHIFT)
+
+enum rman_type { RMAN_UNINIT = 0, RMAN_GAUGE, RMAN_ARRAY };
+
+/*
+ * String length exported to userspace for resource names, etc.
+ */
+#define RM_TEXTLEN 32
+
+/*
+ * Userspace-exported structures.
+ */
+struct u_resource {
+ uintptr_t r_handle; /* resource uniquifier */
+ uintptr_t r_parent; /* parent rman */
+ uintptr_t r_device; /* device owning this resource */
+ char r_devname[RM_TEXTLEN]; /* device name XXX obsolete */
+
+ u_long r_start; /* offset in resource space */
+ u_long r_size; /* size in resource space */
+ u_int r_flags; /* RF_* flags */
+};
+
+struct u_rman {
+ uintptr_t rm_handle; /* rman uniquifier */
+ char rm_descr[RM_TEXTLEN]; /* rman description */
+
+ u_long rm_start; /* base of managed region */
+ u_long rm_size; /* size of managed region */
+ enum rman_type rm_type; /* region type */
+};
+
+#ifdef _KERNEL
/*
* We use a linked list rather than a bitmap because we need to be able to
* represent potentially huge objects (like all of a processor's physical
@@ -57,21 +101,6 @@ struct resource {
struct rman *r_rm; /* resource manager from whence this came */
};
-#define RF_ALLOCATED 0x0001 /* resource has been reserved */
-#define RF_ACTIVE 0x0002 /* resource allocation has been activated */
-#define RF_SHAREABLE 0x0004 /* resource permits contemporaneous sharing */
-#define RF_TIMESHARE 0x0008 /* resource permits time-division sharing */
-#define RF_WANTED 0x0010 /* somebody is waiting for this resource */
-#define RF_FIRSTSHARE 0x0020 /* first in sharing list */
-
-#define RF_ALIGNMENT_SHIFT 10 /* alignment size bit starts bit 10 */
-#define RF_ALIGNMENT_MASK (0x003F << RF_ALIGNMENT_SHIFT)
- /* resource address alignemnt size bit mask */
-#define RF_ALIGNMENT_LOG2(x) ((x) << RF_ALIGNMENT_SHIFT)
-#define RF_ALIGNMENT(x) (((x) & RF_ALIGNMENT_MASK) >> RF_ALIGNMENT_SHIFT)
-
-enum rman_type { RMAN_UNINIT = 0, RMAN_GAUGE, RMAN_ARRAY };
-
struct rman {
struct resource_head rm_list;
struct simplelock *rm_slock; /* mutex used to protect rm_list */
@@ -83,8 +112,6 @@ struct rman {
};
TAILQ_HEAD(rman_head, rman);
-#ifdef _KERNEL
-
int rman_activate_resource(struct resource *r);
int rman_await_resource(struct resource *r, int pri, int timo);
int rman_deactivate_resource(struct resource *r);