[OpenBIOS] [PATCH 05/11] ppc: add PReP support to dma-map-in

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sat May 26 21:29:50 CEST 2018


PReP machines have a separate iova address space mapped into the CPU address
space at 0x80000000, so add a new dma-map-in implementation that supports
this behaviour for the PReP machine.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 arch/ppc/qemu/init.c  | 18 ++++++++++++++++++
 arch/ppc/qemu/tree.fs |  5 -----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/arch/ppc/qemu/init.c b/arch/ppc/qemu/init.c
index 74a4c6b..c113482 100644
--- a/arch/ppc/qemu/init.c
+++ b/arch/ppc/qemu/init.c
@@ -768,6 +768,22 @@ dma_alloc(void)
     }
 }
 
+/* ( virt size cacheable? -- devaddr ) */
+static void
+dma_map_in(void)
+{
+    POP();
+    POP();
+    ucell va = POP();
+
+    if (is_apple()) {
+        PUSH(va);
+    } else {
+        /* PReP */
+        PUSH(va + 0x80000000);
+    }
+}
+
 /* ( virt devaddr size -- ) */
 static void
 dma_sync(void)
@@ -800,6 +816,8 @@ arch_of_init(void)
 
     bind_func("ppc-dma-alloc", dma_alloc);
     feval("['] ppc-dma-alloc to (dma-alloc)");
+    bind_func("ppc-dma-map-in", dma_map_in);
+    feval("['] ppc-dma-map-in to (dma-map-in)");
     bind_func("ppc-dma-sync", dma_sync);
     feval("['] ppc-dma-sync to (dma-sync)");
 
diff --git a/arch/ppc/qemu/tree.fs b/arch/ppc/qemu/tree.fs
index 481acd9..06583ab 100644
--- a/arch/ppc/qemu/tree.fs
+++ b/arch/ppc/qemu/tree.fs
@@ -15,16 +15,11 @@ include config.fs
   2drop
 ;
 
-: ppc-dma-map-in  ( virt size cacheable? -- devaddr )
-  2drop
-;
-
 : ppc-dma-map-out  ( virt devaddr size -- )
   (dma-sync)
 ;
 
 ['] ppc-dma-free to (dma-free)
-['] ppc-dma-map-in to (dma-map-in)
 ['] ppc-dma-map-out to (dma-map-out)
 
 \ -------------------------------------------------------------
-- 
2.11.0




More information about the OpenBIOS mailing list