system.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 __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. extern void *alloc_maybe_bootmem(size_t size, gfp_t mask);
  72. extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
  73. #ifdef CONFIG_DEBUG_FS
  74. extern struct dentry *of_debugfs_root;
  75. #endif
  76. #define arch_align_stack(x) (x)
  77. /*
  78. * MicroBlaze doesn't handle unaligned accesses in hardware.
  79. *
  80. * Based on this we force the IP header alignment in network drivers.
  81. */
  82. #define NET_IP_ALIGN 2
  83. #endif /* _ASM_MICROBLAZE_SYSTEM_H */