patch-2.3.17 linux/arch/m68k/sun3/dvma.c

Next file: linux/arch/m68k/sun3/idprom.c
Previous file: linux/arch/m68k/sun3/config.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.16/linux/arch/m68k/sun3/dvma.c linux/arch/m68k/sun3/dvma.c
@@ -0,0 +1,33 @@
+
+/* dvma support routines */
+
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <asm/page.h>
+#include <asm/pgtable.h>
+#include <asm/sun3mmu.h>
+#include <asm/dvma.h>
+
+unsigned long dvma_next_free = DVMA_START;
+
+/* get needed number of free dma pages, or panic if not enough */
+
+void *sun3_dvma_malloc(int len)
+{
+	unsigned long vaddr;
+	
+	/* if the next free pages have been accessed, skip them */
+	while((dvma_next_free < DVMA_END) &&
+	      (sun3_get_pte(dvma_next_free) & SUN3_PAGE_ACCESSED))
+		dvma_next_free += SUN3_PTE_SIZE;
+
+       	if((dvma_next_free + len) > DVMA_END) 
+		panic("sun3_dvma_malloc: out of dvma pages");
+	
+	vaddr = dvma_next_free;
+	dvma_next_free = PAGE_ALIGN(dvma_next_free + len);
+
+	return (void *)vaddr;
+}
+     
+

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)