r300d.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 __R300D_H__
  29. #define __R300D_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_000148_MC_FB_LOCATION 0x000148
  73. #define S_000148_MC_FB_START(x) (((x) & 0xFFFF) << 0)
  74. #define G_000148_MC_FB_START(x) (((x) >> 0) & 0xFFFF)
  75. #define C_000148_MC_FB_START 0xFFFF0000
  76. #define S_000148_MC_FB_TOP(x) (((x) & 0xFFFF) << 16)
  77. #define G_000148_MC_FB_TOP(x) (((x) >> 16) & 0xFFFF)
  78. #define C_000148_MC_FB_TOP 0x0000FFFF
  79. #define R_00014C_MC_AGP_LOCATION 0x00014C
  80. #define S_00014C_MC_AGP_START(x) (((x) & 0xFFFF) << 0)
  81. #define G_00014C_MC_AGP_START(x) (((x) >> 0) & 0xFFFF)
  82. #define C_00014C_MC_AGP_START 0xFFFF0000
  83. #define S_00014C_MC_AGP_TOP(x) (((x) & 0xFFFF) << 16)
  84. #define G_00014C_MC_AGP_TOP(x) (((x) >> 16) & 0xFFFF)
  85. #define C_00014C_MC_AGP_TOP 0x0000FFFF
  86. #define R_00015C_AGP_BASE_2 0x00015C
  87. #define S_00015C_AGP_BASE_ADDR_2(x) (((x) & 0xF) << 0)
  88. #define G_00015C_AGP_BASE_ADDR_2(x) (((x) >> 0) & 0xF)
  89. #define C_00015C_AGP_BASE_ADDR_2 0xFFFFFFF0
  90. #define R_000170_AGP_BASE 0x000170
  91. #define S_000170_AGP_BASE_ADDR(x) (((x) & 0xFFFFFFFF) << 0)
  92. #define G_000170_AGP_BASE_ADDR(x) (((x) >> 0) & 0xFFFFFFFF)
  93. #define C_000170_AGP_BASE_ADDR 0x00000000
  94. #endif