svn commit: r206772 - in user/jmallett/octeon/sys/mips: include mips

Juli Mallett jmallett at FreeBSD.org
Sat Apr 17 22:38:17 UTC 2010


Author: jmallett
Date: Sat Apr 17 22:38:16 2010
New Revision: 206772
URL: http://svn.freebsd.org/changeset/base/206772

Log:
  Use the direct map for sfbufs in the n64 ABI and note how we should do the same
  on n32 and o32.

Modified:
  user/jmallett/octeon/sys/mips/include/sf_buf.h
  user/jmallett/octeon/sys/mips/mips/vm_machdep.c

Modified: user/jmallett/octeon/sys/mips/include/sf_buf.h
==============================================================================
--- user/jmallett/octeon/sys/mips/include/sf_buf.h	Sat Apr 17 21:31:42 2010	(r206771)
+++ user/jmallett/octeon/sys/mips/include/sf_buf.h	Sat Apr 17 22:38:16 2010	(r206772)
@@ -29,10 +29,17 @@
 #ifndef _MACHINE_SF_BUF_H_
 #define _MACHINE_SF_BUF_H_
 
+#if !defined(__mips_n64)
 #include <sys/queue.h>
+#else
+#include <vm/vm.h>
+#include <vm/vm_param.h>
+#include <vm/vm_page.h>
+#endif
 
 struct vm_page;
 
+#if !defined(__mips_n64)
 struct sf_buf {
 	SLIST_ENTRY(sf_buf) free_list;	/* list of free buffer slots */
 	struct		vm_page *m;	/* currently mapped page */
@@ -52,5 +59,28 @@ sf_buf_page(struct sf_buf *sf)
 
 	return (sf->m);
 }
+#else
+/*
+ * On this machine, the only purpose for which sf_buf is used is to implement
+ * an opaque pointer required by the machine-independent parts of the kernel.
+ * That pointer references the vm_page that is "mapped" by the sf_buf.  The
+ * actual mapping is provided by the direct virtual-to-physical mapping.  
+ */
+struct sf_buf;
+
+static __inline vm_offset_t
+sf_buf_kva(struct sf_buf *sf)
+{
+
+	return (MIPS_PHYS_TO_XKPHYS(MIPS_XKPHYS_CCA_CNC, VM_PAGE_TO_PHYS((vm_page_t)sf)));
+}
+
+static __inline vm_page_t
+sf_buf_page(struct sf_buf *sf)
+{
+
+	return ((vm_page_t)sf);
+}
+#endif
 
 #endif /* !_MACHINE_SF_BUF_H_ */

Modified: user/jmallett/octeon/sys/mips/mips/vm_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/vm_machdep.c	Sat Apr 17 21:31:42 2010	(r206771)
+++ user/jmallett/octeon/sys/mips/mips/vm_machdep.c	Sat Apr 17 22:38:16 2010	(r206772)
@@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/mbuf.h>
 #include <sys/sf_buf.h>
 
+#if !defined(__mips_n64)
 #ifndef NSFBUFS
 #define	NSFBUFS		(512 + maxusers * 16)
 #endif
@@ -95,6 +96,7 @@ static struct {
 } sf_freelist;
 
 static u_int	sf_buf_alloc_want;
+#endif
 
 /*
  * Finish a fork operation, with process p2 nearly set up.
@@ -458,6 +460,7 @@ kvtop(void *addr)
 #define	ZIDLE_LO(v)	((v) * 2 / 3)
 #define	ZIDLE_HI(v)	((v) * 4 / 5)
 
+#if !defined(__mips_n64)
 /*
  * Allocate a pool of sf_bufs (sendfile(2) or "super-fast" if you prefer. :-))
  */
@@ -485,6 +488,11 @@ sf_buf_init(void *arg)
 
 /*
  * Get an sf_buf from the freelist.  Will block if none are available.
+ *
+ * XXX
+ * If the physical address of m is within range of KSEG0, we should not do the
+ * qenter, and we should make sf_buf_kva() check the physical address and give
+ * the direct-mapped virutal address instead.
  */
 struct sf_buf *
 sf_buf_alloc(struct vm_page *m, int flags)
@@ -534,6 +542,26 @@ sf_buf_free(struct sf_buf *sf)
 		wakeup_one(&sf_freelist);
 	mtx_unlock(&sf_freelist.sf_lock);
 }
+#else
+/*
+ * Allocate an sf_buf.  We just return the vm_page and use XKPHYS.
+ */
+struct sf_buf *
+sf_buf_alloc(struct vm_page *m, int flags)
+{
+	return ((struct sf_buf *)m);
+}
+
+/*
+ * Release resources back to the system.
+ *
+ * XXX Invalidate dcache?
+ */
+void
+sf_buf_free(struct sf_buf *sf)
+{
+}
+#endif
 
 /*
  * Software interrupt handler for queued VM system processing.


More information about the svn-src-user mailing list