system.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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/cache.h>
  14. #include <asm-generic/cmpxchg.h>
  15. #include <asm-generic/cmpxchg-local.h>
  16. #define __ARCH_WANT_INTERRUPTS_ON_CTXSW
  17. struct task_struct;
  18. struct thread_info;
  19. extern struct task_struct *_switch_to(struct thread_info *prev,
  20. struct thread_info *next);
  21. #define switch_to(prev, next, last) \
  22. do { \
  23. (last) = _switch_to(task_thread_info(prev), \
  24. task_thread_info(next)); \
  25. } while (0)
  26. #define smp_read_barrier_depends() do {} while (0)
  27. #define read_barrier_depends() do {} while (0)
  28. #define nop() asm volatile ("nop")
  29. #define mb() barrier()
  30. #define rmb() mb()
  31. #define wmb() mb()
  32. #define set_mb(var, value) do { var = value; mb(); } while (0)
  33. #define set_wmb(var, value) do { var = value; wmb(); } while (0)
  34. #define smp_mb() mb()
  35. #define smp_rmb() rmb()
  36. #define smp_wmb() wmb()
  37. void show_trace(struct task_struct *task, unsigned long *stack);
  38. void __bad_xchg(volatile void *ptr, int size);
  39. static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
  40. int size)
  41. {
  42. unsigned long ret;
  43. unsigned long flags;
  44. switch (size) {
  45. case 1:
  46. local_irq_save(flags);
  47. ret = *(volatile unsigned char *)ptr;
  48. *(volatile unsigned char *)ptr = x;
  49. local_irq_restore(flags);
  50. break;
  51. case 4:
  52. local_irq_save(flags);
  53. ret = *(volatile unsigned long *)ptr;
  54. *(volatile unsigned long *)ptr = x;
  55. local_irq_restore(flags);
  56. break;
  57. default:
  58. __bad_xchg(ptr, size), ret = 0;
  59. break;
  60. }
  61. return ret;
  62. }
  63. void disable_hlt(void);
  64. void enable_hlt(void);
  65. void default_idle(void);
  66. #define xchg(ptr, x) \
  67. ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
  68. void free_init_pages(char *what, unsigned long begin, unsigned long end);
  69. void free_initmem(void);
  70. extern char *klimit;
  71. extern void ret_from_fork(void);
  72. extern void *alloc_maybe_bootmem(size_t size, gfp_t mask);
  73. extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
  74. #ifdef CONFIG_DEBUG_FS
  75. extern struct dentry *of_debugfs_root;
  76. #endif
  77. #define arch_align_stack(x) (x)
  78. /*
  79. * MicroBlaze doesn't handle unaligned accesses in hardware.
  80. *
  81. * Based on this we force the IP header alignment in network drivers.
  82. */
  83. #define NET_IP_ALIGN 2
  84. #endif /* _ASM_MICROBLAZE_SYSTEM_H */