summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/include/sf_buf.h
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2009-04-04 00:22:44 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2009-04-04 00:22:44 +0000
commitef1e56b6d485dbe76218164db7b0414e30ab423c (patch)
treed2c385231a9dbcaffdd618abd8accd1c9a2a8559 /sys/powerpc/include/sf_buf.h
parent86b18dc38b6aaf20c8399264b992273cf312d727 (diff)
downloadFreeBSD-src-ef1e56b6d485dbe76218164db7b0414e30ab423c.zip
FreeBSD-src-ef1e56b6d485dbe76218164db7b0414e30ab423c.tar.gz
Add support for 64-bit PowerPC CPUs operating in the 64-bit bridge mode
provided, for example, on the PowerPC 970 (G5), as well as on related CPUs like the POWER3 and POWER4. This also adds support for various built-in hardware found on Apple G5 hardware (e.g. the IBM CPC925 northbridge). Reviewed by: grehan
Diffstat (limited to 'sys/powerpc/include/sf_buf.h')
-rw-r--r--sys/powerpc/include/sf_buf.h43
1 files changed, 16 insertions, 27 deletions
diff --git a/sys/powerpc/include/sf_buf.h b/sys/powerpc/include/sf_buf.h
index 162f5a6..7ddb981 100644
--- a/sys/powerpc/include/sf_buf.h
+++ b/sys/powerpc/include/sf_buf.h
@@ -32,33 +32,9 @@
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_page.h>
+#include <machine/md_var.h>
#include <sys/queue.h>
-#if defined(AIM)
-/*
- * 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 (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);
-}
-
-#elif defined(E500)
-
struct vm_page;
struct sf_buf {
@@ -69,9 +45,22 @@ struct sf_buf {
int ref_count; /* usage of this mapping */
};
+/*
+ * On 32-bit OEA, 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.
+ *
+ * On OEA64 and Book-E, we need to do something a little more complicated. Use
+ * the runtime-detected hw_direct_map to pick between the two cases. Our
+ * friends in vm_machdep.c will do the same to ensure nothing gets confused.
+ */
+
static __inline vm_offset_t
sf_buf_kva(struct sf_buf *sf)
{
+ if (hw_direct_map)
+ return (VM_PAGE_TO_PHYS((vm_page_t)sf));
return (sf->kva);
}
@@ -79,10 +68,10 @@ sf_buf_kva(struct sf_buf *sf)
static __inline struct vm_page *
sf_buf_page(struct sf_buf *sf)
{
+ if (hw_direct_map)
+ return ((vm_page_t)sf);
return (sf->m);
}
-#endif
-
#endif /* !_MACHINE_SF_BUF_H_ */
OpenPOWER on IntegriCloud