sys_bfin.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * contains various random system calls that have a non-standard
  3. * calling sequence on the Linux/Blackfin platform.
  4. *
  5. * Copyright 2004-2009 Analog Devices Inc.
  6. *
  7. * Licensed under the GPL-2 or later
  8. */
  9. #include <linux/spinlock.h>
  10. #include <linux/sem.h>
  11. #include <linux/msg.h>
  12. #include <linux/shm.h>
  13. #include <linux/syscalls.h>
  14. #include <linux/mman.h>
  15. #include <linux/file.h>
  16. #include <linux/fs.h>
  17. #include <linux/uaccess.h>
  18. #include <linux/ipc.h>
  19. #include <linux/unistd.h>
  20. #include <asm/cacheflush.h>
  21. #include <asm/dma.h>
  22. asmlinkage void *sys_sram_alloc(size_t size, unsigned long flags)
  23. {
  24. return sram_alloc_with_lsl(size, flags);
  25. }
  26. asmlinkage int sys_sram_free(const void *addr)
  27. {
  28. return sram_free_with_lsl(addr);
  29. }
  30. asmlinkage void *sys_dma_memcpy(void *dest, const void *src, size_t len)
  31. {
  32. return safe_dma_memcpy(dest, src, len);
  33. }
  34. #if defined(CONFIG_FB) || defined(CONFIG_FB_MODULE)
  35. #include <linux/fb.h>
  36. unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr,
  37. unsigned long len, unsigned long pgoff, unsigned long flags)
  38. {
  39. struct fb_info *info = filp->private_data;
  40. return (unsigned long)info->screen_base;
  41. }
  42. EXPORT_SYMBOL(get_fb_unmapped_area);
  43. #endif
  44. /* Needed for legacy userspace atomic emulation */
  45. static DEFINE_SPINLOCK(bfin_spinlock_lock);
  46. #ifdef CONFIG_SYS_BFIN_SPINLOCK_L1
  47. __attribute__((l1_text))
  48. #endif
  49. asmlinkage int sys_bfin_spinlock(int *p)
  50. {
  51. int ret, tmp = 0;
  52. spin_lock(&bfin_spinlock_lock); /* This would also hold kernel preemption. */
  53. ret = get_user(tmp, p);
  54. if (likely(ret == 0)) {
  55. if (unlikely(tmp))
  56. ret = 1;
  57. else
  58. put_user(1, p);
  59. }
  60. spin_unlock(&bfin_spinlock_lock);
  61. return ret;
  62. }