Full support for Ginger Console
[linux-ginger.git] / arch / blackfin / kernel / sys_bfin.c
blobafcef129d4e843fb3c81b27253356f55c76bbc50
1 /*
2 * contains various random system calls that have a non-standard
3 * calling sequence on the Linux/Blackfin platform.
5 * Copyright 2004-2009 Analog Devices Inc.
7 * Licensed under the GPL-2 or later
8 */
10 #include <linux/spinlock.h>
11 #include <linux/sem.h>
12 #include <linux/msg.h>
13 #include <linux/shm.h>
14 #include <linux/syscalls.h>
15 #include <linux/mman.h>
16 #include <linux/file.h>
17 #include <linux/fs.h>
18 #include <linux/uaccess.h>
19 #include <linux/ipc.h>
20 #include <linux/unistd.h>
22 #include <asm/cacheflush.h>
23 #include <asm/dma.h>
25 /* common code for old and new mmaps */
26 static inline long
27 do_mmap2(unsigned long addr, unsigned long len,
28 unsigned long prot, unsigned long flags,
29 unsigned long fd, unsigned long pgoff)
31 int error = -EBADF;
32 struct file *file = NULL;
34 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
35 if (!(flags & MAP_ANONYMOUS)) {
36 file = fget(fd);
37 if (!file)
38 goto out;
41 down_write(&current->mm->mmap_sem);
42 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
43 up_write(&current->mm->mmap_sem);
45 if (file)
46 fput(file);
47 out:
48 return error;
51 asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
52 unsigned long prot, unsigned long flags,
53 unsigned long fd, unsigned long pgoff)
55 return do_mmap2(addr, len, prot, flags, fd, pgoff);
58 asmlinkage void *sys_sram_alloc(size_t size, unsigned long flags)
60 return sram_alloc_with_lsl(size, flags);
63 asmlinkage int sys_sram_free(const void *addr)
65 return sram_free_with_lsl(addr);
68 asmlinkage void *sys_dma_memcpy(void *dest, const void *src, size_t len)
70 return safe_dma_memcpy(dest, src, len);
73 #if defined(CONFIG_FB) || defined(CONFIG_FB_MODULE)
74 #include <linux/fb.h>
75 unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr,
76 unsigned long len, unsigned long pgoff, unsigned long flags)
78 struct fb_info *info = filp->private_data;
79 return (unsigned long)info->screen_base;
81 EXPORT_SYMBOL(get_fb_unmapped_area);
82 #endif