Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jul 2016 23:03:34 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302789 - in head/sys/arm64: arm64 include
Message-ID:  <201607132303.u6DN3YhJ097696@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Wed Jul 13 23:03:34 2016
New Revision: 302789
URL: https://svnweb.freebsd.org/changeset/base/302789

Log:
  Add memmmap on arm64 so we can mmap /dev/mem and /dev/kmem.
  
  Obtained from:	ABT Systems Ltd
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/mem.c
  head/sys/arm64/include/memdev.h

Modified: head/sys/arm64/arm64/mem.c
==============================================================================
--- head/sys/arm64/arm64/mem.c	Wed Jul 13 22:53:30 2016	(r302788)
+++ head/sys/arm64/arm64/mem.c	Wed Jul 13 23:03:34 2016	(r302789)
@@ -114,3 +114,19 @@ memrw(struct cdev *dev, struct uio *uio,
 	return (error);
 }
 
+/*
+ * allow user processes to MMAP some memory sections
+ * instead of going through read/write
+ */
+/* ARGSUSED */
+int
+memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
+    int prot __unused, vm_memattr_t *memattr __unused)
+{
+	if (dev2unit(dev) == CDEV_MINOR_MEM)
+		*paddr = offset;
+	else if (dev2unit(dev) == CDEV_MINOR_KMEM)
+		*paddr = vtophys(offset);
+	/* else panic! */
+	return (0);
+}

Modified: head/sys/arm64/include/memdev.h
==============================================================================
--- head/sys/arm64/include/memdev.h	Wed Jul 13 22:53:30 2016	(r302788)
+++ head/sys/arm64/include/memdev.h	Wed Jul 13 23:03:34 2016	(r302789)
@@ -35,6 +35,6 @@
 d_open_t	memopen;
 d_read_t	memrw;
 #define		memioctl	(d_ioctl_t *)NULL
-#define		memmmap		(d_mmap_t *)NULL
+d_mmap_t	memmmap;
 
 #endif /* _MACHINE_MEMDEV_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607132303.u6DN3YhJ097696>