gbe.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. /*
  2. * include/video/gbe.h -- SGI GBE (Graphics Back End)
  3. *
  4. * Copyright (C) 1999 Silicon Graphics, Inc. (Jeffrey Newquist)
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License version 2 as published by the Free Software Foundation.
  8. */
  9. #ifndef __GBE_H__
  10. #define __GBE_H__
  11. struct sgi_gbe {
  12. volatile uint32_t ctrlstat; /* general control */
  13. volatile uint32_t dotclock; /* dot clock PLL control */
  14. volatile uint32_t i2c; /* crt I2C control */
  15. volatile uint32_t sysclk; /* system clock PLL control */
  16. volatile uint32_t i2cfp; /* flat panel I2C control */
  17. volatile uint32_t id; /* device id/chip revision */
  18. volatile uint32_t config; /* power on configuration [1] */
  19. volatile uint32_t bist; /* internal bist status [1] */
  20. uint32_t _pad0[0x010000/4 - 8];
  21. volatile uint32_t vt_xy; /* current dot coords */
  22. volatile uint32_t vt_xymax; /* maximum dot coords */
  23. volatile uint32_t vt_vsync; /* vsync on/off */
  24. volatile uint32_t vt_hsync; /* hsync on/off */
  25. volatile uint32_t vt_vblank; /* vblank on/off */
  26. volatile uint32_t vt_hblank; /* hblank on/off */
  27. volatile uint32_t vt_flags; /* polarity of vt signals */
  28. volatile uint32_t vt_f2rf_lock; /* f2rf & framelck y coord */
  29. volatile uint32_t vt_intr01; /* intr 0,1 y coords */
  30. volatile uint32_t vt_intr23; /* intr 2,3 y coords */
  31. volatile uint32_t fp_hdrv; /* flat panel hdrv on/off */
  32. volatile uint32_t fp_vdrv; /* flat panel vdrv on/off */
  33. volatile uint32_t fp_de; /* flat panel de on/off */
  34. volatile uint32_t vt_hpixen; /* intrnl horiz pixel on/off */
  35. volatile uint32_t vt_vpixen; /* intrnl vert pixel on/off */
  36. volatile uint32_t vt_hcmap; /* cmap write (horiz) */
  37. volatile uint32_t vt_vcmap; /* cmap write (vert) */
  38. volatile uint32_t did_start_xy; /* eol/f did/xy reset val */
  39. volatile uint32_t crs_start_xy; /* eol/f crs/xy reset val */
  40. volatile uint32_t vc_start_xy; /* eol/f vc/xy reset val */
  41. uint32_t _pad1[0xffb0/4];
  42. volatile uint32_t ovr_width_tile;/*overlay plane ctrl 0 */
  43. volatile uint32_t ovr_inhwctrl; /* overlay plane ctrl 1 */
  44. volatile uint32_t ovr_control; /* overlay plane ctrl 1 */
  45. uint32_t _pad2[0xfff4/4];
  46. volatile uint32_t frm_size_tile;/* normal plane ctrl 0 */
  47. volatile uint32_t frm_size_pixel;/*normal plane ctrl 1 */
  48. volatile uint32_t frm_inhwctrl; /* normal plane ctrl 2 */
  49. volatile uint32_t frm_control; /* normal plane ctrl 3 */
  50. uint32_t _pad3[0xfff0/4];
  51. volatile uint32_t did_inhwctrl; /* DID control */
  52. volatile uint32_t did_control; /* DID shadow */
  53. uint32_t _pad4[0x7ff8/4];
  54. volatile uint32_t mode_regs[32];/* WID table */
  55. uint32_t _pad5[0x7f80/4];
  56. volatile uint32_t cmap[6144]; /* color map */
  57. uint32_t _pad6[0x2000/4];
  58. volatile uint32_t cm_fifo; /* color map fifo status */
  59. uint32_t _pad7[0x7ffc/4];
  60. volatile uint32_t gmap[256]; /* gamma map */
  61. uint32_t _pad8[0x7c00/4];
  62. volatile uint32_t gmap10[1024]; /* gamma map */
  63. uint32_t _pad9[0x7000/4];
  64. volatile uint32_t crs_pos; /* cusror control 0 */
  65. volatile uint32_t crs_ctl; /* cusror control 1 */
  66. volatile uint32_t crs_cmap[3]; /* crs cmap */
  67. uint32_t _pad10[0x7fec/4];
  68. volatile uint32_t crs_glyph[64];/* crs glyph */
  69. uint32_t _pad11[0x7f00/4];
  70. volatile uint32_t vc_0; /* video capture crtl 0 */
  71. volatile uint32_t vc_1; /* video capture crtl 1 */
  72. volatile uint32_t vc_2; /* video capture crtl 2 */
  73. volatile uint32_t vc_3; /* video capture crtl 3 */
  74. volatile uint32_t vc_4; /* video capture crtl 4 */
  75. volatile uint32_t vc_5; /* video capture crtl 5 */
  76. volatile uint32_t vc_6; /* video capture crtl 6 */
  77. volatile uint32_t vc_7; /* video capture crtl 7 */
  78. volatile uint32_t vc_8; /* video capture crtl 8 */
  79. };
  80. #define MASK(msb, lsb) \
  81. ( (((u32)1<<((msb)-(lsb)+1))-1) << (lsb) )
  82. #define GET(v, msb, lsb) \
  83. ( ((u32)(v) & MASK(msb,lsb)) >> (lsb) )
  84. #define SET(v, f, msb, lsb) \
  85. ( (v) = ((v)&~MASK(msb,lsb)) | (( (u32)(f)<<(lsb) ) & MASK(msb,lsb)) )
  86. #define GET_GBE_FIELD(reg, field, v) \
  87. GET((v), GBE_##reg##_##field##_MSB, GBE_##reg##_##field##_LSB)
  88. #define SET_GBE_FIELD(reg, field, v, f) \
  89. SET((v), (f), GBE_##reg##_##field##_MSB, GBE_##reg##_##field##_LSB)
  90. /*
  91. * Bit mask information
  92. */
  93. #define GBE_CTRLSTAT_CHIPID_MSB 3
  94. #define GBE_CTRLSTAT_CHIPID_LSB 0
  95. #define GBE_CTRLSTAT_SENSE_N_MSB 4
  96. #define GBE_CTRLSTAT_SENSE_N_LSB 4
  97. #define GBE_CTRLSTAT_PCLKSEL_MSB 29
  98. #define GBE_CTRLSTAT_PCLKSEL_LSB 28
  99. #define GBE_DOTCLK_M_MSB 7
  100. #define GBE_DOTCLK_M_LSB 0
  101. #define GBE_DOTCLK_N_MSB 13
  102. #define GBE_DOTCLK_N_LSB 8
  103. #define GBE_DOTCLK_P_MSB 15
  104. #define GBE_DOTCLK_P_LSB 14
  105. #define GBE_DOTCLK_RUN_MSB 20
  106. #define GBE_DOTCLK_RUN_LSB 20
  107. #define GBE_VT_XY_Y_MSB 23
  108. #define GBE_VT_XY_Y_LSB 12
  109. #define GBE_VT_XY_X_MSB 11
  110. #define GBE_VT_XY_X_LSB 0
  111. #define GBE_VT_XY_FREEZE_MSB 31
  112. #define GBE_VT_XY_FREEZE_LSB 31
  113. #define GBE_FP_VDRV_ON_MSB 23
  114. #define GBE_FP_VDRV_ON_LSB 12
  115. #define GBE_FP_VDRV_OFF_MSB 11
  116. #define GBE_FP_VDRV_OFF_LSB 0
  117. #define GBE_FP_HDRV_ON_MSB 23
  118. #define GBE_FP_HDRV_ON_LSB 12
  119. #define GBE_FP_HDRV_OFF_MSB 11
  120. #define GBE_FP_HDRV_OFF_LSB 0
  121. #define GBE_FP_DE_ON_MSB 23
  122. #define GBE_FP_DE_ON_LSB 12
  123. #define GBE_FP_DE_OFF_MSB 11
  124. #define GBE_FP_DE_OFF_LSB 0
  125. #define GBE_VT_VSYNC_VSYNC_ON_MSB 23
  126. #define GBE_VT_VSYNC_VSYNC_ON_LSB 12
  127. #define GBE_VT_VSYNC_VSYNC_OFF_MSB 11
  128. #define GBE_VT_VSYNC_VSYNC_OFF_LSB 0
  129. #define GBE_VT_HSYNC_HSYNC_ON_MSB 23
  130. #define GBE_VT_HSYNC_HSYNC_ON_LSB 12
  131. #define GBE_VT_HSYNC_HSYNC_OFF_MSB 11
  132. #define GBE_VT_HSYNC_HSYNC_OFF_LSB 0
  133. #define GBE_VT_VBLANK_VBLANK_ON_MSB 23
  134. #define GBE_VT_VBLANK_VBLANK_ON_LSB 12
  135. #define GBE_VT_VBLANK_VBLANK_OFF_MSB 11
  136. #define GBE_VT_VBLANK_VBLANK_OFF_LSB 0
  137. #define GBE_VT_HBLANK_HBLANK_ON_MSB 23
  138. #define GBE_VT_HBLANK_HBLANK_ON_LSB 12
  139. #define GBE_VT_HBLANK_HBLANK_OFF_MSB 11
  140. #define GBE_VT_HBLANK_HBLANK_OFF_LSB 0
  141. #define GBE_VT_FLAGS_F2RF_HIGH_MSB 6
  142. #define GBE_VT_FLAGS_F2RF_HIGH_LSB 6
  143. #define GBE_VT_FLAGS_SYNC_LOW_MSB 5
  144. #define GBE_VT_FLAGS_SYNC_LOW_LSB 5
  145. #define GBE_VT_FLAGS_SYNC_HIGH_MSB 4
  146. #define GBE_VT_FLAGS_SYNC_HIGH_LSB 4
  147. #define GBE_VT_FLAGS_HDRV_LOW_MSB 3
  148. #define GBE_VT_FLAGS_HDRV_LOW_LSB 3
  149. #define GBE_VT_FLAGS_HDRV_INVERT_MSB 2
  150. #define GBE_VT_FLAGS_HDRV_INVERT_LSB 2
  151. #define GBE_VT_FLAGS_VDRV_LOW_MSB 1
  152. #define GBE_VT_FLAGS_VDRV_LOW_LSB 1
  153. #define GBE_VT_FLAGS_VDRV_INVERT_MSB 0
  154. #define GBE_VT_FLAGS_VDRV_INVERT_LSB 0
  155. #define GBE_VT_VCMAP_VCMAP_ON_MSB 23
  156. #define GBE_VT_VCMAP_VCMAP_ON_LSB 12
  157. #define GBE_VT_VCMAP_VCMAP_OFF_MSB 11
  158. #define GBE_VT_VCMAP_VCMAP_OFF_LSB 0
  159. #define GBE_VT_HCMAP_HCMAP_ON_MSB 23
  160. #define GBE_VT_HCMAP_HCMAP_ON_LSB 12
  161. #define GBE_VT_HCMAP_HCMAP_OFF_MSB 11
  162. #define GBE_VT_HCMAP_HCMAP_OFF_LSB 0
  163. #define GBE_VT_XYMAX_MAXX_MSB 11
  164. #define GBE_VT_XYMAX_MAXX_LSB 0
  165. #define GBE_VT_XYMAX_MAXY_MSB 23
  166. #define GBE_VT_XYMAX_MAXY_LSB 12
  167. #define GBE_VT_HPIXEN_HPIXEN_ON_MSB 23
  168. #define GBE_VT_HPIXEN_HPIXEN_ON_LSB 12
  169. #define GBE_VT_HPIXEN_HPIXEN_OFF_MSB 11
  170. #define GBE_VT_HPIXEN_HPIXEN_OFF_LSB 0
  171. #define GBE_VT_VPIXEN_VPIXEN_ON_MSB 23
  172. #define GBE_VT_VPIXEN_VPIXEN_ON_LSB 12
  173. #define GBE_VT_VPIXEN_VPIXEN_OFF_MSB 11
  174. #define GBE_VT_VPIXEN_VPIXEN_OFF_LSB 0
  175. #define GBE_OVR_CONTROL_OVR_DMA_ENABLE_MSB 0
  176. #define GBE_OVR_CONTROL_OVR_DMA_ENABLE_LSB 0
  177. #define GBE_OVR_INHWCTRL_OVR_DMA_ENABLE_MSB 0
  178. #define GBE_OVR_INHWCTRL_OVR_DMA_ENABLE_LSB 0
  179. #define GBE_OVR_WIDTH_TILE_OVR_FIFO_RESET_MSB 13
  180. #define GBE_OVR_WIDTH_TILE_OVR_FIFO_RESET_LSB 13
  181. #define GBE_FRM_CONTROL_FRM_DMA_ENABLE_MSB 0
  182. #define GBE_FRM_CONTROL_FRM_DMA_ENABLE_LSB 0
  183. #define GBE_FRM_CONTROL_FRM_TILE_PTR_MSB 31
  184. #define GBE_FRM_CONTROL_FRM_TILE_PTR_LSB 9
  185. #define GBE_FRM_CONTROL_FRM_LINEAR_MSB 1
  186. #define GBE_FRM_CONTROL_FRM_LINEAR_LSB 1
  187. #define GBE_FRM_INHWCTRL_FRM_DMA_ENABLE_MSB 0
  188. #define GBE_FRM_INHWCTRL_FRM_DMA_ENABLE_LSB 0
  189. #define GBE_FRM_SIZE_TILE_FRM_WIDTH_TILE_MSB 12
  190. #define GBE_FRM_SIZE_TILE_FRM_WIDTH_TILE_LSB 5
  191. #define GBE_FRM_SIZE_TILE_FRM_RHS_MSB 4
  192. #define GBE_FRM_SIZE_TILE_FRM_RHS_LSB 0
  193. #define GBE_FRM_SIZE_TILE_FRM_DEPTH_MSB 14
  194. #define GBE_FRM_SIZE_TILE_FRM_DEPTH_LSB 13
  195. #define GBE_FRM_SIZE_TILE_FRM_FIFO_RESET_MSB 15
  196. #define GBE_FRM_SIZE_TILE_FRM_FIFO_RESET_LSB 15
  197. #define GBE_FRM_SIZE_PIXEL_FB_HEIGHT_PIX_MSB 31
  198. #define GBE_FRM_SIZE_PIXEL_FB_HEIGHT_PIX_LSB 16
  199. #define GBE_DID_CONTROL_DID_DMA_ENABLE_MSB 0
  200. #define GBE_DID_CONTROL_DID_DMA_ENABLE_LSB 0
  201. #define GBE_DID_INHWCTRL_DID_DMA_ENABLE_MSB 0
  202. #define GBE_DID_INHWCTRL_DID_DMA_ENABLE_LSB 0
  203. #define GBE_DID_START_XY_DID_STARTY_MSB 23
  204. #define GBE_DID_START_XY_DID_STARTY_LSB 12
  205. #define GBE_DID_START_XY_DID_STARTX_MSB 11
  206. #define GBE_DID_START_XY_DID_STARTX_LSB 0
  207. #define GBE_CRS_START_XY_CRS_STARTY_MSB 23
  208. #define GBE_CRS_START_XY_CRS_STARTY_LSB 12
  209. #define GBE_CRS_START_XY_CRS_STARTX_MSB 11
  210. #define GBE_CRS_START_XY_CRS_STARTX_LSB 0
  211. #define GBE_WID_AUX_MSB 12
  212. #define GBE_WID_AUX_LSB 11
  213. #define GBE_WID_GAMMA_MSB 10
  214. #define GBE_WID_GAMMA_LSB 10
  215. #define GBE_WID_CM_MSB 9
  216. #define GBE_WID_CM_LSB 5
  217. #define GBE_WID_TYP_MSB 4
  218. #define GBE_WID_TYP_LSB 2
  219. #define GBE_WID_BUF_MSB 1
  220. #define GBE_WID_BUF_LSB 0
  221. #define GBE_VC_START_XY_VC_STARTY_MSB 23
  222. #define GBE_VC_START_XY_VC_STARTY_LSB 12
  223. #define GBE_VC_START_XY_VC_STARTX_MSB 11
  224. #define GBE_VC_START_XY_VC_STARTX_LSB 0
  225. /* Constants */
  226. #define GBE_FRM_DEPTH_8 0
  227. #define GBE_FRM_DEPTH_16 1
  228. #define GBE_FRM_DEPTH_32 2
  229. #define GBE_CMODE_I8 0
  230. #define GBE_CMODE_I12 1
  231. #define GBE_CMODE_RG3B2 2
  232. #define GBE_CMODE_RGB4 3
  233. #define GBE_CMODE_ARGB5 4
  234. #define GBE_CMODE_RGB8 5
  235. #define GBE_CMODE_RGBA5 6
  236. #define GBE_CMODE_RGB10 7
  237. #define GBE_BMODE_BOTH 3
  238. #define GBE_CRS_MAGIC 54
  239. #define GBE_PIXEN_MAGIC_ON 19
  240. #define GBE_PIXEN_MAGIC_OFF 2
  241. #define GBE_TLB_SIZE 128
  242. /* [1] - only GBE revision 2 and later */
  243. /*
  244. * Video Timing Data Structure
  245. */
  246. struct gbe_timing_info {
  247. int flags;
  248. short width; /* Monitor resolution */
  249. short height;
  250. int fields_sec; /* fields/sec (Hz -3 dec. places */
  251. int cfreq; /* pixel clock frequency (MHz -3 dec. places) */
  252. short htotal; /* Horizontal total pixels */
  253. short hblank_start; /* Horizontal blank start */
  254. short hblank_end; /* Horizontal blank end */
  255. short hsync_start; /* Horizontal sync start */
  256. short hsync_end; /* Horizontal sync end */
  257. short vtotal; /* Vertical total lines */
  258. short vblank_start; /* Vertical blank start */
  259. short vblank_end; /* Vertical blank end */
  260. short vsync_start; /* Vertical sync start */
  261. short vsync_end; /* Vertical sync end */
  262. short pll_m; /* PLL M parameter */
  263. short pll_n; /* PLL P parameter */
  264. short pll_p; /* PLL N parameter */
  265. };
  266. /* Defines for gbe_vof_info_t flags */
  267. #define GBE_VOF_UNKNOWNMON 1
  268. #define GBE_VOF_STEREO 2
  269. #define GBE_VOF_DO_GENSYNC 4 /* enable incoming sync */
  270. #define GBE_VOF_SYNC_ON_GREEN 8 /* sync on green */
  271. #define GBE_VOF_FLATPANEL 0x1000 /* FLATPANEL Timing */
  272. #define GBE_VOF_MAGICKEY 0x2000 /* Backdoor key */
  273. #endif /* ! __GBE_H__ */