accel.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
  4. * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
  5. */
  6. #ifndef __ACCEL_H__
  7. #define __ACCEL_H__
  8. #define FB_ACCEL_VIA_UNICHROME 50
  9. /* MMIO Base Address Definition */
  10. #define MMIO_VGABASE 0x8000
  11. #define MMIO_CR_READ (MMIO_VGABASE + 0x3D4)
  12. #define MMIO_CR_WRITE (MMIO_VGABASE + 0x3D5)
  13. #define MMIO_SR_READ (MMIO_VGABASE + 0x3C4)
  14. #define MMIO_SR_WRITE (MMIO_VGABASE + 0x3C5)
  15. /* HW Cursor Status Define */
  16. #define HW_Cursor_ON 0
  17. #define HW_Cursor_OFF 1
  18. #define CURSOR_SIZE (8 * 1024)
  19. #define VQ_SIZE (256 * 1024)
  20. #define VIA_MMIO_BLTBASE 0x200000
  21. #define VIA_MMIO_BLTSIZE 0x200000
  22. /* Defines for 2D registers */
  23. #define VIA_REG_GECMD 0x000
  24. #define VIA_REG_GEMODE 0x004
  25. #define VIA_REG_SRCPOS 0x008
  26. #define VIA_REG_DSTPOS 0x00C
  27. /* width and height */
  28. #define VIA_REG_DIMENSION 0x010
  29. #define VIA_REG_PATADDR 0x014
  30. #define VIA_REG_FGCOLOR 0x018
  31. #define VIA_REG_BGCOLOR 0x01C
  32. /* top and left of clipping */
  33. #define VIA_REG_CLIPTL 0x020
  34. /* bottom and right of clipping */
  35. #define VIA_REG_CLIPBR 0x024
  36. #define VIA_REG_OFFSET 0x028
  37. /* color key control */
  38. #define VIA_REG_KEYCONTROL 0x02C
  39. #define VIA_REG_SRCBASE 0x030
  40. #define VIA_REG_DSTBASE 0x034
  41. /* pitch of src and dst */
  42. #define VIA_REG_PITCH 0x038
  43. #define VIA_REG_MONOPAT0 0x03C
  44. #define VIA_REG_MONOPAT1 0x040
  45. /* from 0x100 to 0x1ff */
  46. #define VIA_REG_COLORPAT 0x100
  47. /* defines for VIA 2D registers for vt3353/3409 (M1 engine)*/
  48. #define VIA_REG_GECMD_M1 0x000
  49. #define VIA_REG_GEMODE_M1 0x004
  50. #define VIA_REG_GESTATUS_M1 0x004 /* as same as VIA_REG_GEMODE */
  51. #define VIA_REG_PITCH_M1 0x008 /* pitch of src and dst */
  52. #define VIA_REG_DIMENSION_M1 0x00C /* width and height */
  53. #define VIA_REG_DSTPOS_M1 0x010
  54. #define VIA_REG_LINE_XY_M1 0x010
  55. #define VIA_REG_DSTBASE_M1 0x014
  56. #define VIA_REG_SRCPOS_M1 0x018
  57. #define VIA_REG_LINE_K1K2_M1 0x018
  58. #define VIA_REG_SRCBASE_M1 0x01C
  59. #define VIA_REG_PATADDR_M1 0x020
  60. #define VIA_REG_MONOPAT0_M1 0x024
  61. #define VIA_REG_MONOPAT1_M1 0x028
  62. #define VIA_REG_OFFSET_M1 0x02C
  63. #define VIA_REG_LINE_ERROR_M1 0x02C
  64. #define VIA_REG_CLIPTL_M1 0x040 /* top and left of clipping */
  65. #define VIA_REG_CLIPBR_M1 0x044 /* bottom and right of clipping */
  66. #define VIA_REG_KEYCONTROL_M1 0x048 /* color key control */
  67. #define VIA_REG_FGCOLOR_M1 0x04C
  68. #define VIA_REG_DSTCOLORKEY_M1 0x04C /* as same as VIA_REG_FG */
  69. #define VIA_REG_BGCOLOR_M1 0x050
  70. #define VIA_REG_SRCCOLORKEY_M1 0x050 /* as same as VIA_REG_BG */
  71. #define VIA_REG_MONOPATFGC_M1 0x058 /* Add BG color of Pattern. */
  72. #define VIA_REG_MONOPATBGC_M1 0x05C /* Add FG color of Pattern. */
  73. #define VIA_REG_COLORPAT_M1 0x100 /* from 0x100 to 0x1ff */
  74. /* VIA_REG_PITCH(0x38): Pitch Setting */
  75. #define VIA_PITCH_ENABLE 0x80000000
  76. /* defines for VIA HW cursor registers */
  77. #define VIA_REG_CURSOR_MODE 0x2D0
  78. #define VIA_REG_CURSOR_POS 0x2D4
  79. #define VIA_REG_CURSOR_ORG 0x2D8
  80. #define VIA_REG_CURSOR_BG 0x2DC
  81. #define VIA_REG_CURSOR_FG 0x2E0
  82. /* VIA_REG_GEMODE(0x04): GE mode */
  83. #define VIA_GEM_8bpp 0x00000000
  84. #define VIA_GEM_16bpp 0x00000100
  85. #define VIA_GEM_32bpp 0x00000300
  86. /* VIA_REG_GECMD(0x00): 2D Engine Command */
  87. #define VIA_GEC_NOOP 0x00000000
  88. #define VIA_GEC_BLT 0x00000001
  89. #define VIA_GEC_LINE 0x00000005
  90. /* Rotate Command */
  91. #define VIA_GEC_ROT 0x00000008
  92. #define VIA_GEC_SRC_XY 0x00000000
  93. #define VIA_GEC_SRC_LINEAR 0x00000010
  94. #define VIA_GEC_DST_XY 0x00000000
  95. #define VIA_GEC_DST_LINRAT 0x00000020
  96. #define VIA_GEC_SRC_FB 0x00000000
  97. #define VIA_GEC_SRC_SYS 0x00000040
  98. #define VIA_GEC_DST_FB 0x00000000
  99. #define VIA_GEC_DST_SYS 0x00000080
  100. /* source is mono */
  101. #define VIA_GEC_SRC_MONO 0x00000100
  102. /* pattern is mono */
  103. #define VIA_GEC_PAT_MONO 0x00000200
  104. /* mono src is opaque */
  105. #define VIA_GEC_MSRC_OPAQUE 0x00000000
  106. /* mono src is transparent */
  107. #define VIA_GEC_MSRC_TRANS 0x00000400
  108. /* pattern is in frame buffer */
  109. #define VIA_GEC_PAT_FB 0x00000000
  110. /* pattern is from reg setting */
  111. #define VIA_GEC_PAT_REG 0x00000800
  112. #define VIA_GEC_CLIP_DISABLE 0x00000000
  113. #define VIA_GEC_CLIP_ENABLE 0x00001000
  114. #define VIA_GEC_FIXCOLOR_PAT 0x00002000
  115. #define VIA_GEC_INCX 0x00000000
  116. #define VIA_GEC_DECY 0x00004000
  117. #define VIA_GEC_INCY 0x00000000
  118. #define VIA_GEC_DECX 0x00008000
  119. /* mono pattern is opaque */
  120. #define VIA_GEC_MPAT_OPAQUE 0x00000000
  121. /* mono pattern is transparent */
  122. #define VIA_GEC_MPAT_TRANS 0x00010000
  123. #define VIA_GEC_MONO_UNPACK 0x00000000
  124. #define VIA_GEC_MONO_PACK 0x00020000
  125. #define VIA_GEC_MONO_DWORD 0x00000000
  126. #define VIA_GEC_MONO_WORD 0x00040000
  127. #define VIA_GEC_MONO_BYTE 0x00080000
  128. #define VIA_GEC_LASTPIXEL_ON 0x00000000
  129. #define VIA_GEC_LASTPIXEL_OFF 0x00100000
  130. #define VIA_GEC_X_MAJOR 0x00000000
  131. #define VIA_GEC_Y_MAJOR 0x00200000
  132. #define VIA_GEC_QUICK_START 0x00800000
  133. /* defines for VIA 3D registers */
  134. #define VIA_REG_STATUS 0x400
  135. #define VIA_REG_CR_TRANSET 0x41C
  136. #define VIA_REG_CR_TRANSPACE 0x420
  137. #define VIA_REG_TRANSET 0x43C
  138. #define VIA_REG_TRANSPACE 0x440
  139. /* VIA_REG_STATUS(0x400): Engine Status */
  140. /* Command Regulator is busy */
  141. #define VIA_CMD_RGTR_BUSY 0x00000080
  142. /* 2D Engine is busy */
  143. #define VIA_2D_ENG_BUSY 0x00000002
  144. /* 3D Engine is busy */
  145. #define VIA_3D_ENG_BUSY 0x00000001
  146. /* Virtual Queue is busy */
  147. #define VIA_VR_QUEUE_BUSY 0x00020000
  148. /* VIA_REG_STATUS(0x400): Engine Status for H5 */
  149. #define VIA_CMD_RGTR_BUSY_H5 0x00000010 /* Command Regulator is busy */
  150. #define VIA_2D_ENG_BUSY_H5 0x00000002 /* 2D Engine is busy */
  151. #define VIA_3D_ENG_BUSY_H5 0x00001FE1 /* 3D Engine is busy */
  152. #define VIA_VR_QUEUE_BUSY_H5 0x00000004 /* Virtual Queue is busy */
  153. /* VIA_REG_STATUS(0x400): Engine Status for VT3353/3409 */
  154. #define VIA_CMD_RGTR_BUSY_M1 0x00000010 /* Command Regulator is busy */
  155. #define VIA_2D_ENG_BUSY_M1 0x00000002 /* 2D Engine is busy */
  156. #define VIA_3D_ENG_BUSY_M1 0x00001FE1 /* 3D Engine is busy */
  157. #define VIA_VR_QUEUE_BUSY_M1 0x00000004 /* Virtual Queue is busy */
  158. #define MAXLOOP 0xFFFFFF
  159. #define VIA_BITBLT_COLOR 1
  160. #define VIA_BITBLT_MONO 2
  161. #define VIA_BITBLT_FILL 3
  162. int viafb_setup_engine(struct fb_info *info);
  163. void viafb_reset_engine(struct viafb_par *viapar);
  164. void viafb_show_hw_cursor(struct fb_info *info, int Status);
  165. void viafb_wait_engine_idle(struct fb_info *info);
  166. #endif /* __ACCEL_H__ */