r100d.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * Copyright 2008 Advanced Micro Devices, Inc.
  3. * Copyright 2008 Red Hat Inc.
  4. * Copyright 2009 Jerome Glisse.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the "Software"),
  8. * to deal in the Software without restriction, including without limitation
  9. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. * and/or sell copies of the Software, and to permit persons to whom the
  11. * Software is furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22. * OTHER DEALINGS IN THE SOFTWARE.
  23. *
  24. * Authors: Dave Airlie
  25. * Alex Deucher
  26. * Jerome Glisse
  27. */
  28. #ifndef __R100D_H__
  29. #define __R100D_H__
  30. #define CP_PACKET0 0x00000000
  31. #define PACKET0_BASE_INDEX_SHIFT 0
  32. #define PACKET0_BASE_INDEX_MASK (0x1ffff << 0)
  33. #define PACKET0_COUNT_SHIFT 16
  34. #define PACKET0_COUNT_MASK (0x3fff << 16)
  35. #define CP_PACKET1 0x40000000
  36. #define CP_PACKET2 0x80000000
  37. #define PACKET2_PAD_SHIFT 0
  38. #define PACKET2_PAD_MASK (0x3fffffff << 0)
  39. #define CP_PACKET3 0xC0000000
  40. #define PACKET3_IT_OPCODE_SHIFT 8
  41. #define PACKET3_IT_OPCODE_MASK (0xff << 8)
  42. #define PACKET3_COUNT_SHIFT 16
  43. #define PACKET3_COUNT_MASK (0x3fff << 16)
  44. /* PACKET3 op code */
  45. #define PACKET3_NOP 0x10
  46. #define PACKET3_3D_DRAW_VBUF 0x28
  47. #define PACKET3_3D_DRAW_IMMD 0x29
  48. #define PACKET3_3D_DRAW_INDX 0x2A
  49. #define PACKET3_3D_LOAD_VBPNTR 0x2F
  50. #define PACKET3_INDX_BUFFER 0x33
  51. #define PACKET3_3D_DRAW_VBUF_2 0x34
  52. #define PACKET3_3D_DRAW_IMMD_2 0x35
  53. #define PACKET3_3D_DRAW_INDX_2 0x36
  54. #define PACKET3_BITBLT_MULTI 0x9B
  55. #define PACKET0(reg, n) (CP_PACKET0 | \
  56. REG_SET(PACKET0_BASE_INDEX, (reg) >> 2) | \
  57. REG_SET(PACKET0_COUNT, (n)))
  58. #define PACKET2(v) (CP_PACKET2 | REG_SET(PACKET2_PAD, (v)))
  59. #define PACKET3(op, n) (CP_PACKET3 | \
  60. REG_SET(PACKET3_IT_OPCODE, (op)) | \
  61. REG_SET(PACKET3_COUNT, (n)))
  62. #define PACKET_TYPE0 0
  63. #define PACKET_TYPE1 1
  64. #define PACKET_TYPE2 2
  65. #define PACKET_TYPE3 3
  66. #define CP_PACKET_GET_TYPE(h) (((h) >> 30) & 3)
  67. #define CP_PACKET_GET_COUNT(h) (((h) >> 16) & 0x3FFF)
  68. #define CP_PACKET0_GET_REG(h) (((h) & 0x1FFF) << 2)
  69. #define CP_PACKET0_GET_ONE_REG_WR(h) (((h) >> 15) & 1)
  70. #define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF)
  71. /* Registers */
  72. #define R_000E40_RBBM_STATUS 0x000E40
  73. #define S_000E40_CMDFIFO_AVAIL(x) (((x) & 0x7F) << 0)
  74. #define G_000E40_CMDFIFO_AVAIL(x) (((x) >> 0) & 0x7F)
  75. #define C_000E40_CMDFIFO_AVAIL 0xFFFFFF80
  76. #define S_000E40_HIRQ_ON_RBB(x) (((x) & 0x1) << 8)
  77. #define G_000E40_HIRQ_ON_RBB(x) (((x) >> 8) & 0x1)
  78. #define C_000E40_HIRQ_ON_RBB 0xFFFFFEFF
  79. #define S_000E40_CPRQ_ON_RBB(x) (((x) & 0x1) << 9)
  80. #define G_000E40_CPRQ_ON_RBB(x) (((x) >> 9) & 0x1)
  81. #define C_000E40_CPRQ_ON_RBB 0xFFFFFDFF
  82. #define S_000E40_CFRQ_ON_RBB(x) (((x) & 0x1) << 10)
  83. #define G_000E40_CFRQ_ON_RBB(x) (((x) >> 10) & 0x1)
  84. #define C_000E40_CFRQ_ON_RBB 0xFFFFFBFF
  85. #define S_000E40_HIRQ_IN_RTBUF(x) (((x) & 0x1) << 11)
  86. #define G_000E40_HIRQ_IN_RTBUF(x) (((x) >> 11) & 0x1)
  87. #define C_000E40_HIRQ_IN_RTBUF 0xFFFFF7FF
  88. #define S_000E40_CPRQ_IN_RTBUF(x) (((x) & 0x1) << 12)
  89. #define G_000E40_CPRQ_IN_RTBUF(x) (((x) >> 12) & 0x1)
  90. #define C_000E40_CPRQ_IN_RTBUF 0xFFFFEFFF
  91. #define S_000E40_CFRQ_IN_RTBUF(x) (((x) & 0x1) << 13)
  92. #define G_000E40_CFRQ_IN_RTBUF(x) (((x) >> 13) & 0x1)
  93. #define C_000E40_CFRQ_IN_RTBUF 0xFFFFDFFF
  94. #define S_000E40_CF_PIPE_BUSY(x) (((x) & 0x1) << 14)
  95. #define G_000E40_CF_PIPE_BUSY(x) (((x) >> 14) & 0x1)
  96. #define C_000E40_CF_PIPE_BUSY 0xFFFFBFFF
  97. #define S_000E40_ENG_EV_BUSY(x) (((x) & 0x1) << 15)
  98. #define G_000E40_ENG_EV_BUSY(x) (((x) >> 15) & 0x1)
  99. #define C_000E40_ENG_EV_BUSY 0xFFFF7FFF
  100. #define S_000E40_CP_CMDSTRM_BUSY(x) (((x) & 0x1) << 16)
  101. #define G_000E40_CP_CMDSTRM_BUSY(x) (((x) >> 16) & 0x1)
  102. #define C_000E40_CP_CMDSTRM_BUSY 0xFFFEFFFF
  103. #define S_000E40_E2_BUSY(x) (((x) & 0x1) << 17)
  104. #define G_000E40_E2_BUSY(x) (((x) >> 17) & 0x1)
  105. #define C_000E40_E2_BUSY 0xFFFDFFFF
  106. #define S_000E40_RB2D_BUSY(x) (((x) & 0x1) << 18)
  107. #define G_000E40_RB2D_BUSY(x) (((x) >> 18) & 0x1)
  108. #define C_000E40_RB2D_BUSY 0xFFFBFFFF
  109. #define S_000E40_RB3D_BUSY(x) (((x) & 0x1) << 19)
  110. #define G_000E40_RB3D_BUSY(x) (((x) >> 19) & 0x1)
  111. #define C_000E40_RB3D_BUSY 0xFFF7FFFF
  112. #define S_000E40_SE_BUSY(x) (((x) & 0x1) << 20)
  113. #define G_000E40_SE_BUSY(x) (((x) >> 20) & 0x1)
  114. #define C_000E40_SE_BUSY 0xFFEFFFFF
  115. #define S_000E40_RE_BUSY(x) (((x) & 0x1) << 21)
  116. #define G_000E40_RE_BUSY(x) (((x) >> 21) & 0x1)
  117. #define C_000E40_RE_BUSY 0xFFDFFFFF
  118. #define S_000E40_TAM_BUSY(x) (((x) & 0x1) << 22)
  119. #define G_000E40_TAM_BUSY(x) (((x) >> 22) & 0x1)
  120. #define C_000E40_TAM_BUSY 0xFFBFFFFF
  121. #define S_000E40_TDM_BUSY(x) (((x) & 0x1) << 23)
  122. #define G_000E40_TDM_BUSY(x) (((x) >> 23) & 0x1)
  123. #define C_000E40_TDM_BUSY 0xFF7FFFFF
  124. #define S_000E40_PB_BUSY(x) (((x) & 0x1) << 24)
  125. #define G_000E40_PB_BUSY(x) (((x) >> 24) & 0x1)
  126. #define C_000E40_PB_BUSY 0xFEFFFFFF
  127. #define S_000E40_GUI_ACTIVE(x) (((x) & 0x1) << 31)
  128. #define G_000E40_GUI_ACTIVE(x) (((x) >> 31) & 0x1)
  129. #define C_000E40_GUI_ACTIVE 0x7FFFFFFF
  130. #endif