summaryrefslogtreecommitdiffstats
path: root/sys/dev/mem
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2004-08-04 18:30:31 +0000
committermarkm <markm@FreeBSD.org>2004-08-04 18:30:31 +0000
commit124b176fef5130ca995d2b9f839ccf690a880eef (patch)
treeabf47e071c49af987bfa30304247de6cd6e8fa78 /sys/dev/mem
parentbc0c49120545212dcc8b185d81971a000bf866d1 (diff)
downloadFreeBSD-src-124b176fef5130ca995d2b9f839ccf690a880eef.zip
FreeBSD-src-124b176fef5130ca995d2b9f839ccf690a880eef.tar.gz
Fix module builds for i386 and amd64.
Diffstat (limited to 'sys/dev/mem')
-rw-r--r--sys/dev/mem/memdev.c2
-rw-r--r--sys/dev/mem/memutil.c62
2 files changed, 62 insertions, 2 deletions
diff --git a/sys/dev/mem/memdev.c b/sys/dev/mem/memdev.c
index c6059a5..9fb33d2 100644
--- a/sys/dev/mem/memdev.c
+++ b/sys/dev/mem/memdev.c
@@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
-#include <sys/memrange.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/proc.h>
@@ -98,7 +97,6 @@ mem_modevent(module_t mod __unused, int type, void *data __unused)
default:
return(EOPNOTSUPP);
- break;
}
diff --git a/sys/dev/mem/memutil.c b/sys/dev/mem/memutil.c
new file mode 100644
index 0000000..f514f50
--- /dev/null
+++ b/sys/dev/mem/memutil.c
@@ -0,0 +1,62 @@
+/*-
+ * Copyright (c) 2004 Mark R V Murray
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/malloc.h>
+#include <sys/memrange.h>
+#include <sys/systm.h>
+
+/*
+ * Implementation-neutral, kernel-callable functions for manipulating
+ * memory range attributes.
+ */
+int
+mem_range_attr_get(struct mem_range_desc *mrd, int *arg)
+{
+ /* can we handle this? */
+ if (mem_range_softc.mr_op == NULL)
+ return (EOPNOTSUPP);
+
+ if (*arg == 0)
+ *arg = mem_range_softc.mr_ndesc;
+ else
+ bcopy(mem_range_softc.mr_desc, mrd,
+ (*arg) * sizeof(struct mem_range_desc));
+ return (0);
+}
+
+int
+mem_range_attr_set(struct mem_range_desc *mrd, int *arg)
+{
+ /* can we handle this? */
+ if (mem_range_softc.mr_op == NULL)
+ return (EOPNOTSUPP);
+
+ return (mem_range_softc.mr_op->set(&mem_range_softc, mrd, arg));
+}
OpenPOWER on IntegriCloud