patch-2.4.0-prerelease linux/arch/m68k/sun3/dvma.c
Next file: linux/arch/m68k/sun3/mmu_emu.c
Previous file: linux/arch/m68k/sun3/config.c
Back to the patch index
Back to the overall index
- Lines: 49
- Date:
Fri Dec 29 14:07:20 2000
- Orig file:
v2.4.0-test12/linux/arch/m68k/sun3/dvma.c
- Orig date:
Sat Sep 4 13:06:41 1999
diff -u --recursive --new-file v2.4.0-test12/linux/arch/m68k/sun3/dvma.c linux/arch/m68k/sun3/dvma.c
@@ -3,29 +3,41 @@
#include <linux/kernel.h>
#include <linux/mm.h>
+#include <linux/bootmem.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/sun3mmu.h>
#include <asm/dvma.h>
unsigned long dvma_next_free = DVMA_START;
+unsigned long dvma_region_end = DVMA_START + (DVMA_RESERVED_PMEGS * SUN3_PMEG_SIZE);
+
+
+/* reserve such dma memory as we see fit */
+void sun3_dvma_init(void)
+{
+ unsigned long dvma_phys_start;
+
+ dvma_phys_start = (sun3_get_pte(DVMA_START) &
+ SUN3_PAGE_PGNUM_MASK);
+ dvma_phys_start <<= PAGE_SHIFT;
+
+ reserve_bootmem(dvma_phys_start,
+ (DVMA_RESERVED_PMEGS * SUN3_PMEG_SIZE));
+
+}
/* 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)
+ if((dvma_next_free + len) > dvma_region_end)
panic("sun3_dvma_malloc: out of dvma pages");
vaddr = dvma_next_free;
- dvma_next_free = PAGE_ALIGN(dvma_next_free + len);
+ dvma_next_free = DVMA_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)