system.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. struct task_struct;
  16. struct thread_info;
  17. extern struct task_struct *_switch_to(struct thread_info *prev,
  18. struct thread_info *next);
  19. #define switch_to(prev, next, last) \
  20. do { \
  21. (last) = _switch_to(task_thread_info(prev), \
  22. task_thread_info(next)); \
  23. } while (0)
  24. #define smp_read_barrier_depends() do {} while (0)
  25. #define read_barrier_depends() do {} while (0)
  26. #define nop() asm volatile ("nop")
  27. #define mb() barrier()
  28. #define rmb() mb()
  29. #define wmb() mb()
  30. #define set_mb(var, value) do { var = value; mb(); } while (0)
  31. #define set_wmb(var, value) do { var = value; wmb(); } while (0)
  32. #define smp_mb() mb()
  33. #define smp_rmb() rmb()
  34. #define smp_wmb() wmb()
  35. void show_trace(struct task_struct *task, unsigned long *stack);
  36. void __bad_xchg(volatile void *ptr, int size);
  37. static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
  38. int size)
  39. {
  40. unsigned long ret;
  41. unsigned long flags;
  42. switch (size) {
  43. case 1:
  44. local_irq_save(flags);
  45. ret = *(volatile unsigned char *)ptr;
  46. *(volatile unsigned char *)ptr = x;
  47. local_irq_restore(flags);
  48. break;
  49. case 4:
  50. local_irq_save(flags);
  51. ret = *(volatile unsigned long *)ptr;
  52. *(volatile unsigned long *)ptr = x;
  53. local_irq_restore(flags);
  54. break;
  55. default:
  56. __bad_xchg(ptr, size), ret = 0;
  57. break;
  58. }
  59. return ret;
  60. }
  61. void disable_hlt(void);
  62. void enable_hlt(void);
  63. void default_idle(void);
  64. #define xchg(ptr, x) \
  65. ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
  66. void free_init_pages(char *what, unsigned long begin, unsigned long end);
  67. void free_initmem(void);
  68. extern char *klimit;
  69. extern void ret_from_fork(void);
  70. #ifdef CONFIG_DEBUG_FS
  71. extern struct dentry *of_debugfs_root;
  72. #endif
  73. #define arch_align_stack(x) (x)
  74. #endif /* _ASM_MICROBLAZE_SYSTEM_H */