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