asmmacro.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2003 Ralf Baechle
  7. */
  8. #ifndef _ASM_ASMMACRO_H
  9. #define _ASM_ASMMACRO_H
  10. #include <asm/hazards.h>
  11. #ifdef CONFIG_32BIT
  12. #include <asm/asmmacro-32.h>
  13. #endif
  14. #ifdef CONFIG_64BIT
  15. #include <asm/asmmacro-64.h>
  16. #endif
  17. #ifdef CONFIG_MIPS_MT_SMTC
  18. #include <asm/mipsmtregs.h>
  19. #endif
  20. #ifdef CONFIG_MIPS_MT_SMTC
  21. .macro local_irq_enable reg=t0
  22. mfc0 \reg, CP0_TCSTATUS
  23. ori \reg, \reg, TCSTATUS_IXMT
  24. xori \reg, \reg, TCSTATUS_IXMT
  25. mtc0 \reg, CP0_TCSTATUS
  26. _ehb
  27. .endm
  28. .macro local_irq_disable reg=t0
  29. mfc0 \reg, CP0_TCSTATUS
  30. ori \reg, \reg, TCSTATUS_IXMT
  31. mtc0 \reg, CP0_TCSTATUS
  32. _ehb
  33. .endm
  34. #elif defined(CONFIG_CPU_MIPSR2)
  35. .macro local_irq_enable reg=t0
  36. ei
  37. irq_enable_hazard
  38. .endm
  39. .macro local_irq_disable reg=t0
  40. di
  41. irq_disable_hazard
  42. .endm
  43. #else
  44. .macro local_irq_enable reg=t0
  45. mfc0 \reg, CP0_STATUS
  46. ori \reg, \reg, 1
  47. mtc0 \reg, CP0_STATUS
  48. irq_enable_hazard
  49. .endm
  50. .macro local_irq_disable reg=t0
  51. mfc0 \reg, CP0_STATUS
  52. ori \reg, \reg, 1
  53. xori \reg, \reg, 1
  54. mtc0 \reg, CP0_STATUS
  55. irq_disable_hazard
  56. .endm
  57. #endif /* CONFIG_MIPS_MT_SMTC */
  58. /*
  59. * Temporary until all gas have MT ASE support
  60. */
  61. .macro DMT reg=0
  62. .word 0x41600bc1 | (\reg << 16)
  63. .endm
  64. .macro EMT reg=0
  65. .word 0x41600be1 | (\reg << 16)
  66. .endm
  67. .macro DVPE reg=0
  68. .word 0x41600001 | (\reg << 16)
  69. .endm
  70. .macro EVPE reg=0
  71. .word 0x41600021 | (\reg << 16)
  72. .endm
  73. .macro MFTR rt=0, rd=0, u=0, sel=0
  74. .word 0x41000000 | (\rt << 16) | (\rd << 11) | (\u << 5) | (\sel)
  75. .endm
  76. .macro MTTR rt=0, rd=0, u=0, sel=0
  77. .word 0x41800000 | (\rt << 16) | (\rd << 11) | (\u << 5) | (\sel)
  78. .endm
  79. #endif /* _ASM_ASMMACRO_H */