ffb_drv.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:11k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /* $Id: ffb_drv.h,v 1.1 2000/06/01 04:24:39 davem Exp $
  2.  * ffb_drv.h: Creator/Creator3D direct rendering driver.
  3.  *
  4.  * Copyright (C) 2000 David S. Miller (davem@redhat.com)
  5.  */
  6. /* Auxilliary clips. */
  7. typedef struct  {
  8. volatile unsigned int min;
  9. volatile unsigned int max;
  10. } ffb_auxclip, *ffb_auxclipPtr;
  11. /* FFB register set. */
  12. typedef struct _ffb_fbc {
  13. /* Next vertex registers, on the right we list which drawops
  14.  * use said register and the logical name the register has in
  15.  * that context.
  16.  */ /* DESCRIPTION DRAWOP(NAME) */
  17. /*0x00*/unsigned int pad1[3]; /* Reserved */
  18. /*0x0c*/volatile unsigned int alpha; /* ALPHA Transparency */
  19. /*0x10*/volatile unsigned int red; /* RED */
  20. /*0x14*/volatile unsigned int green; /* GREEN */
  21. /*0x18*/volatile unsigned int blue; /* BLUE */
  22. /*0x1c*/volatile unsigned int z; /* DEPTH */
  23. /*0x20*/volatile unsigned int y; /* Y triangle(DOYF) */
  24. /*                      aadot(DYF) */
  25. /*                      ddline(DYF) */
  26. /*                      aaline(DYF) */
  27. /*0x24*/volatile unsigned int x; /* X triangle(DOXF) */
  28. /*                      aadot(DXF) */
  29. /*                      ddline(DXF) */
  30. /*                      aaline(DXF) */
  31. /*0x28*/unsigned int pad2[2]; /* Reserved */
  32. /*0x30*/volatile unsigned int ryf; /* Y (alias to DOYF) ddline(RYF) */
  33. /* aaline(RYF) */
  34. /* triangle(RYF) */
  35. /*0x34*/volatile unsigned int rxf; /* X ddline(RXF) */
  36. /* aaline(RXF) */
  37. /* triangle(RXF) */
  38. /*0x38*/unsigned int pad3[2]; /* Reserved */
  39. /*0x40*/volatile unsigned int dmyf; /* Y (alias to DOYF) triangle(DMYF) */
  40. /*0x44*/volatile unsigned int dmxf; /* X triangle(DMXF) */
  41. /*0x48*/unsigned int pad4[2]; /* Reserved */
  42. /*0x50*/volatile unsigned int ebyi; /* Y (alias to RYI) polygon(EBYI) */
  43. /*0x54*/volatile unsigned int ebxi; /* X polygon(EBXI) */
  44. /*0x58*/unsigned int pad5[2]; /* Reserved */
  45. /*0x60*/volatile unsigned int by; /* Y brline(RYI) */
  46. /* fastfill(OP) */
  47. /* polygon(YI) */
  48. /* rectangle(YI) */
  49. /* bcopy(SRCY) */
  50. /* vscroll(SRCY) */
  51. /*0x64*/volatile unsigned int bx; /* X brline(RXI) */
  52. /* polygon(XI) */
  53. /* rectangle(XI) */
  54. /* bcopy(SRCX) */
  55. /* vscroll(SRCX) */
  56. /* fastfill(GO) */
  57. /*0x68*/volatile unsigned int dy; /* destination Y fastfill(DSTY) */
  58. /* bcopy(DSRY) */
  59. /* vscroll(DSRY) */
  60. /*0x6c*/volatile unsigned int dx; /* destination X fastfill(DSTX) */
  61. /* bcopy(DSTX) */
  62. /* vscroll(DSTX) */
  63. /*0x70*/volatile unsigned int bh; /* Y (alias to RYI) brline(DYI) */
  64. /* dot(DYI) */
  65. /* polygon(ETYI) */
  66. /* Height fastfill(H) */
  67. /* bcopy(H) */
  68. /* vscroll(H) */
  69. /* Y count fastfill(NY) */
  70. /*0x74*/volatile unsigned int bw; /* X dot(DXI) */
  71. /* brline(DXI) */
  72. /* polygon(ETXI) */
  73. /* fastfill(W) */
  74. /* bcopy(W) */
  75. /* vscroll(W) */
  76. /* fastfill(NX) */
  77. /*0x78*/unsigned int pad6[2]; /* Reserved */
  78. /*0x80*/unsigned int pad7[32]; /* Reserved */
  79. /* Setup Unit's vertex state register */
  80. /*100*/ volatile unsigned int suvtx;
  81. /*104*/ unsigned int pad8[63]; /* Reserved */
  82. /* Frame Buffer Control Registers */
  83. /*200*/ volatile unsigned int ppc; /* Pixel Processor Control */
  84. /*204*/ volatile unsigned int wid; /* Current WID */
  85. /*208*/ volatile unsigned int fg; /* FG data */
  86. /*20c*/ volatile unsigned int bg; /* BG data */
  87. /*210*/ volatile unsigned int consty; /* Constant Y */
  88. /*214*/ volatile unsigned int constz; /* Constant Z */
  89. /*218*/ volatile unsigned int xclip; /* X Clip */
  90. /*21c*/ volatile unsigned int dcss; /* Depth Cue Scale Slope */
  91. /*220*/ volatile unsigned int vclipmin; /* Viewclip XY Min Bounds */
  92. /*224*/ volatile unsigned int vclipmax; /* Viewclip XY Max Bounds */
  93. /*228*/ volatile unsigned int vclipzmin; /* Viewclip Z Min Bounds */
  94. /*22c*/ volatile unsigned int vclipzmax; /* Viewclip Z Max Bounds */
  95. /*230*/ volatile unsigned int dcsf; /* Depth Cue Scale Front Bound */
  96. /*234*/ volatile unsigned int dcsb; /* Depth Cue Scale Back Bound */
  97. /*238*/ volatile unsigned int dczf; /* Depth Cue Z Front */
  98. /*23c*/ volatile unsigned int dczb; /* Depth Cue Z Back */
  99. /*240*/ unsigned int pad9; /* Reserved */
  100. /*244*/ volatile unsigned int blendc; /* Alpha Blend Control */
  101. /*248*/ volatile unsigned int blendc1; /* Alpha Blend Color 1 */
  102. /*24c*/ volatile unsigned int blendc2; /* Alpha Blend Color 2 */
  103. /*250*/ volatile unsigned int fbramitc; /* FB RAM Interleave Test Control */
  104. /*254*/ volatile unsigned int fbc; /* Frame Buffer Control */
  105. /*258*/ volatile unsigned int rop; /* Raster OPeration */
  106. /*25c*/ volatile unsigned int cmp; /* Frame Buffer Compare */
  107. /*260*/ volatile unsigned int matchab; /* Buffer AB Match Mask */
  108. /*264*/ volatile unsigned int matchc; /* Buffer C(YZ) Match Mask */
  109. /*268*/ volatile unsigned int magnab; /* Buffer AB Magnitude Mask */
  110. /*26c*/ volatile unsigned int magnc; /* Buffer C(YZ) Magnitude Mask */
  111. /*270*/ volatile unsigned int fbcfg0; /* Frame Buffer Config 0 */
  112. /*274*/ volatile unsigned int fbcfg1; /* Frame Buffer Config 1 */
  113. /*278*/ volatile unsigned int fbcfg2; /* Frame Buffer Config 2 */
  114. /*27c*/ volatile unsigned int fbcfg3; /* Frame Buffer Config 3 */
  115. /*280*/ volatile unsigned int ppcfg; /* Pixel Processor Config */
  116. /*284*/ volatile unsigned int pick; /* Picking Control */
  117. /*288*/ volatile unsigned int fillmode; /* FillMode */
  118. /*28c*/ volatile unsigned int fbramwac; /* FB RAM Write Address Control */
  119. /*290*/ volatile unsigned int pmask; /* RGB PlaneMask */
  120. /*294*/ volatile unsigned int xpmask; /* X PlaneMask */
  121. /*298*/ volatile unsigned int ypmask; /* Y PlaneMask */
  122. /*29c*/ volatile unsigned int zpmask; /* Z PlaneMask */
  123. /*2a0*/ ffb_auxclip auxclip[4];  /* Auxilliary Viewport Clip */
  124. /* New 3dRAM III support regs */
  125. /*2c0*/ volatile unsigned int rawblend2;
  126. /*2c4*/ volatile unsigned int rawpreblend;
  127. /*2c8*/ volatile unsigned int rawstencil;
  128. /*2cc*/ volatile unsigned int rawstencilctl;
  129. /*2d0*/ volatile unsigned int threedram1;
  130. /*2d4*/ volatile unsigned int threedram2;
  131. /*2d8*/ volatile unsigned int passin;
  132. /*2dc*/ volatile unsigned int rawclrdepth;
  133. /*2e0*/ volatile unsigned int rawpmask;
  134. /*2e4*/ volatile unsigned int rawcsrc;
  135. /*2e8*/ volatile unsigned int rawmatch;
  136. /*2ec*/ volatile unsigned int rawmagn;
  137. /*2f0*/ volatile unsigned int rawropblend;
  138. /*2f4*/ volatile unsigned int rawcmp;
  139. /*2f8*/ volatile unsigned int rawwac;
  140. /*2fc*/ volatile unsigned int fbramid;
  141. /*300*/ volatile unsigned int drawop; /* Draw OPeration */
  142. /*304*/ unsigned int pad10[2]; /* Reserved */
  143. /*30c*/ volatile unsigned int lpat; /* Line Pattern control */
  144. /*310*/ unsigned int pad11; /* Reserved */
  145. /*314*/ volatile unsigned int fontxy; /* XY Font coordinate */
  146. /*318*/ volatile unsigned int fontw; /* Font Width */
  147. /*31c*/ volatile unsigned int fontinc; /* Font Increment */
  148. /*320*/ volatile unsigned int font; /* Font bits */
  149. /*324*/ unsigned int pad12[3]; /* Reserved */
  150. /*330*/ volatile unsigned int blend2;
  151. /*334*/ volatile unsigned int preblend;
  152. /*338*/ volatile unsigned int stencil;
  153. /*33c*/ volatile unsigned int stencilctl;
  154. /*340*/ unsigned int pad13[4]; /* Reserved */
  155. /*350*/ volatile unsigned int dcss1; /* Depth Cue Scale Slope 1 */
  156. /*354*/ volatile unsigned int dcss2; /* Depth Cue Scale Slope 2 */
  157. /*358*/ volatile unsigned int dcss3; /* Depth Cue Scale Slope 3 */
  158. /*35c*/ volatile unsigned int widpmask;
  159. /*360*/ volatile unsigned int dcs2;
  160. /*364*/ volatile unsigned int dcs3;
  161. /*368*/ volatile unsigned int dcs4;
  162. /*36c*/ unsigned int pad14; /* Reserved */
  163. /*370*/ volatile unsigned int dcd2;
  164. /*374*/ volatile unsigned int dcd3;
  165. /*378*/ volatile unsigned int dcd4;
  166. /*37c*/ unsigned int pad15; /* Reserved */
  167. /*380*/ volatile unsigned int pattern[32]; /* area Pattern */
  168. /*400*/ unsigned int pad16[8]; /* Reserved */
  169. /*420*/ volatile unsigned int reset; /* chip RESET */
  170. /*424*/ unsigned int pad17[247]; /* Reserved */
  171. /*800*/ volatile unsigned int devid; /* Device ID */
  172. /*804*/ unsigned int pad18[63]; /* Reserved */
  173. /*900*/ volatile unsigned int ucsr; /* User Control & Status Register */
  174. /*904*/ unsigned int pad19[31]; /* Reserved */
  175. /*980*/ volatile unsigned int mer; /* Mode Enable Register */
  176. /*984*/ unsigned int pad20[1439]; /* Reserved */
  177. } ffb_fbc, *ffb_fbcPtr;
  178. struct ffb_hw_context {
  179. int is_2d_only;
  180. unsigned int ppc;
  181. unsigned int wid;
  182. unsigned int fg;
  183. unsigned int bg;
  184. unsigned int consty;
  185. unsigned int constz;
  186. unsigned int xclip;
  187. unsigned int dcss;
  188. unsigned int vclipmin;
  189. unsigned int vclipmax;
  190. unsigned int vclipzmin;
  191. unsigned int vclipzmax;
  192. unsigned int dcsf;
  193. unsigned int dcsb;
  194. unsigned int dczf;
  195. unsigned int dczb;
  196. unsigned int blendc;
  197. unsigned int blendc1;
  198. unsigned int blendc2;
  199. unsigned int fbc;
  200. unsigned int rop;
  201. unsigned int cmp;
  202. unsigned int matchab;
  203. unsigned int matchc;
  204. unsigned int magnab;
  205. unsigned int magnc;
  206. unsigned int pmask;
  207. unsigned int xpmask;
  208. unsigned int ypmask;
  209. unsigned int zpmask;
  210. unsigned int auxclip0min;
  211. unsigned int auxclip0max;
  212. unsigned int auxclip1min;
  213. unsigned int auxclip1max;
  214. unsigned int auxclip2min;
  215. unsigned int auxclip2max;
  216. unsigned int auxclip3min;
  217. unsigned int auxclip3max;
  218. unsigned int drawop;
  219. unsigned int lpat;
  220. unsigned int fontxy;
  221. unsigned int fontw;
  222. unsigned int fontinc;
  223. unsigned int area_pattern[32];
  224. unsigned int ucsr;
  225. unsigned int stencil;
  226. unsigned int stencilctl;
  227. unsigned int dcss1;
  228. unsigned int dcss2;
  229. unsigned int dcss3;
  230. unsigned int dcs2;
  231. unsigned int dcs3;
  232. unsigned int dcs4;
  233. unsigned int dcd2;
  234. unsigned int dcd3;
  235. unsigned int dcd4;
  236. unsigned int mer;
  237. };
  238. #define FFB_MAX_CTXS 32
  239. enum ffb_chip_type {
  240. ffb1_prototype = 0, /* Early pre-FCS FFB */
  241. ffb1_standard, /* First FCS FFB, 100Mhz UPA, 66MHz gclk */
  242. ffb1_speedsort, /* Second FCS FFB, 100Mhz UPA, 75MHz gclk */
  243. ffb2_prototype, /* Early pre-FCS vertical FFB2 */
  244. ffb2_vertical, /* First FCS FFB2/vertical, 100Mhz UPA, 100MHZ gclk,
  245.    75(SingleBuffer)/83(DoubleBuffer) MHz fclk */
  246. ffb2_vertical_plus, /* Second FCS FFB2/vertical, same timings */
  247. ffb2_horizontal, /* First FCS FFB2/horizontal, same timings as FFB2/vert */
  248. ffb2_horizontal_plus, /* Second FCS FFB2/horizontal, same timings */
  249. afb_m3, /* FCS Elite3D, 3 float chips */
  250. afb_m6 /* FCS Elite3D, 6 float chips */
  251. };
  252. typedef struct ffb_dev_priv {
  253. /* Misc software state. */
  254. int prom_node;
  255. enum ffb_chip_type ffb_type;
  256. u64 card_phys_base;
  257. struct miscdevice  miscdev;
  258. /* Controller registers. */
  259. ffb_fbcPtr regs;
  260. /* Context table. */
  261. struct ffb_hw_context *hw_state[FFB_MAX_CTXS];
  262. } ffb_dev_priv_t;