system.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright (C) 2006 Atmark Techno, Inc.
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. */
  8. #ifndef _ASM_MICROBLAZE_SYSTEM_H
  9. #define _ASM_MICROBLAZE_SYSTEM_H
  10. #include <asm/registers.h>
  11. #include <asm/setup.h>
  12. #include <asm/irqflags.h>
  13. #include <asm-generic/cmpxchg.h>
  14. #include <asm-generic/cmpxchg-local.h>
  15. #define __ARCH_WANT_INTERRUPTS_ON_CTXSW
  16. struct task_struct;
  17. struct thread_info;
  18. extern struct task_struct *_switch_to(struct thread_info *prev,
  19. struct thread_info *next);
  20. #define switch_to(prev, next, last) \
  21. do { \
  22. (last) = _switch_to(task_thread_info(prev), \
  23. task_thread_info(next)); \
  24. } while (0)
  25. #define smp_read_barrier_depends() do {} while (0)
  26. #define read_barrier_depends() do {} while (0)
  27. #define nop() asm volatile ("nop")
  28. #define mb() barrier()
  29. #define rmb() mb()
  30. #define wmb() mb()
  31. #define set_mb(var, value) do { var = value; mb(); } while (0)
  32. #define set_wmb(var, value) do { var = value; wmb(); } while (0)
  33. #define smp_mb() mb()
  34. #define smp_rmb() rmb()
  35. #define smp_wmb() wmb()
  36. void show_trace(struct task_struct *task, unsigned long *stack);
  37. void __bad_xchg(volatile void *ptr, int size);
  38. static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
  39. int size)
  40. {
  41. unsigned long ret;
  42. unsigned long flags;
  43. switch (size) {
  44. case 1:
  45. local_irq_save(flags);
  46. ret = *(volatile unsigned char *)ptr;
  47. *(volatile unsigned char *)ptr = x;
  48. local_irq_restore(flags);
  49. break;
  50. case 4:
  51. local_irq_save(flags);
  52. ret = *(volatile unsigned long *)ptr;
  53. *(volatile unsigned long *)ptr = x;
  54. local_irq_restore(flags);
  55. break;
  56. default:
  57. __bad_xchg(ptr, size), ret = 0;
  58. break;
  59. }
  60. return ret;
  61. }
  62. void disable_hlt(void);
  63. void enable_hlt(void);
  64. void default_idle(void);
  65. #define xchg(ptr, x) \
  66. ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
  67. void free_init_pages(char *what, unsigned long begin, unsigned long end);
  68. void free_initmem(void);
  69. extern char *klimit;
  70. extern void ret_from_fork(void);
  71. #ifdef CONFIG_DEBUG_FS
  72. extern struct dentry *of_debugfs_root;
  73. #endif
  74. #define arch_align_stack(x) (x)
  75. #endif /* _ASM_MICROBLAZE_SYSTEM_H */