spu_priv1.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /*
  2. * Defines an spu hypervisor abstraction layer.
  3. *
  4. * Copyright 2006 Sony Corp.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; version 2 of the License.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #if !defined(_SPU_PRIV1_H)
  20. #define _SPU_PRIV1_H
  21. #if defined(__KERNEL__)
  22. struct spu;
  23. /* access to priv1 registers */
  24. struct spu_priv1_ops
  25. {
  26. void (*int_mask_and) (struct spu *spu, int class, u64 mask);
  27. void (*int_mask_or) (struct spu *spu, int class, u64 mask);
  28. void (*int_mask_set) (struct spu *spu, int class, u64 mask);
  29. u64 (*int_mask_get) (struct spu *spu, int class);
  30. void (*int_stat_clear) (struct spu *spu, int class, u64 stat);
  31. u64 (*int_stat_get) (struct spu *spu, int class);
  32. void (*cpu_affinity_set) (struct spu *spu, int cpu);
  33. u64 (*mfc_dar_get) (struct spu *spu);
  34. u64 (*mfc_dsisr_get) (struct spu *spu);
  35. void (*mfc_dsisr_set) (struct spu *spu, u64 dsisr);
  36. void (*mfc_sdr_set) (struct spu *spu, u64 sdr);
  37. void (*mfc_sr1_set) (struct spu *spu, u64 sr1);
  38. u64 (*mfc_sr1_get) (struct spu *spu);
  39. void (*mfc_tclass_id_set) (struct spu *spu, u64 tclass_id);
  40. u64 (*mfc_tclass_id_get) (struct spu *spu);
  41. void (*tlb_invalidate) (struct spu *spu);
  42. void (*resource_allocation_groupID_set) (struct spu *spu, u64 id);
  43. u64 (*resource_allocation_groupID_get) (struct spu *spu);
  44. void (*resource_allocation_enable_set) (struct spu *spu, u64 enable);
  45. u64 (*resource_allocation_enable_get) (struct spu *spu);
  46. };
  47. extern const struct spu_priv1_ops* spu_priv1_ops;
  48. static inline void
  49. spu_int_mask_and (struct spu *spu, int class, u64 mask)
  50. {
  51. spu_priv1_ops->int_mask_and(spu, class, mask);
  52. }
  53. static inline void
  54. spu_int_mask_or (struct spu *spu, int class, u64 mask)
  55. {
  56. spu_priv1_ops->int_mask_or(spu, class, mask);
  57. }
  58. static inline void
  59. spu_int_mask_set (struct spu *spu, int class, u64 mask)
  60. {
  61. spu_priv1_ops->int_mask_set(spu, class, mask);
  62. }
  63. static inline u64
  64. spu_int_mask_get (struct spu *spu, int class)
  65. {
  66. return spu_priv1_ops->int_mask_get(spu, class);
  67. }
  68. static inline void
  69. spu_int_stat_clear (struct spu *spu, int class, u64 stat)
  70. {
  71. spu_priv1_ops->int_stat_clear(spu, class, stat);
  72. }
  73. static inline u64
  74. spu_int_stat_get (struct spu *spu, int class)
  75. {
  76. return spu_priv1_ops->int_stat_get (spu, class);
  77. }
  78. static inline void
  79. spu_cpu_affinity_set (struct spu *spu, int cpu)
  80. {
  81. spu_priv1_ops->cpu_affinity_set(spu, cpu);
  82. }
  83. static inline u64
  84. spu_mfc_dar_get (struct spu *spu)
  85. {
  86. return spu_priv1_ops->mfc_dar_get(spu);
  87. }
  88. static inline u64
  89. spu_mfc_dsisr_get (struct spu *spu)
  90. {
  91. return spu_priv1_ops->mfc_dsisr_get(spu);
  92. }
  93. static inline void
  94. spu_mfc_dsisr_set (struct spu *spu, u64 dsisr)
  95. {
  96. spu_priv1_ops->mfc_dsisr_set(spu, dsisr);
  97. }
  98. static inline void
  99. spu_mfc_sdr_set (struct spu *spu, u64 sdr)
  100. {
  101. spu_priv1_ops->mfc_sdr_set(spu, sdr);
  102. }
  103. static inline void
  104. spu_mfc_sr1_set (struct spu *spu, u64 sr1)
  105. {
  106. spu_priv1_ops->mfc_sr1_set(spu, sr1);
  107. }
  108. static inline u64
  109. spu_mfc_sr1_get (struct spu *spu)
  110. {
  111. return spu_priv1_ops->mfc_sr1_get(spu);
  112. }
  113. static inline void
  114. spu_mfc_tclass_id_set (struct spu *spu, u64 tclass_id)
  115. {
  116. spu_priv1_ops->mfc_tclass_id_set(spu, tclass_id);
  117. }
  118. static inline u64
  119. spu_mfc_tclass_id_get (struct spu *spu)
  120. {
  121. return spu_priv1_ops->mfc_tclass_id_get(spu);
  122. }
  123. static inline void
  124. spu_tlb_invalidate (struct spu *spu)
  125. {
  126. spu_priv1_ops->tlb_invalidate(spu);
  127. }
  128. static inline void
  129. spu_resource_allocation_groupID_set (struct spu *spu, u64 id)
  130. {
  131. spu_priv1_ops->resource_allocation_groupID_set(spu, id);
  132. }
  133. static inline u64
  134. spu_resource_allocation_groupID_get (struct spu *spu)
  135. {
  136. return spu_priv1_ops->resource_allocation_groupID_get(spu);
  137. }
  138. static inline void
  139. spu_resource_allocation_enable_set (struct spu *spu, u64 enable)
  140. {
  141. spu_priv1_ops->resource_allocation_enable_set(spu, enable);
  142. }
  143. static inline u64
  144. spu_resource_allocation_enable_get (struct spu *spu)
  145. {
  146. return spu_priv1_ops->resource_allocation_enable_get(spu);
  147. }
  148. /* The declarations folowing are put here for convenience
  149. * and only intended to be used by the platform setup code
  150. * for initializing spu_priv1_ops.
  151. */
  152. extern const struct spu_priv1_ops spu_priv1_mmio_ops;
  153. #endif /* __KERNEL__ */
  154. #endif