1
2
3
4
5
6
7
8 #ifndef __GBE_H__
9 #define __GBE_H__
10
11 struct sgi_gbe {
12 volatile uint32_t ctrlstat;
13 volatile uint32_t dotclock;
14 volatile uint32_t i2c;
15 volatile uint32_t sysclk;
16 volatile uint32_t i2cfp;
17 volatile uint32_t id;
18 volatile uint32_t config;
19 volatile uint32_t bist;
20 uint32_t _pad0[0x010000/4 - 8];
21 volatile uint32_t vt_xy;
22 volatile uint32_t vt_xymax;
23 volatile uint32_t vt_vsync;
24 volatile uint32_t vt_hsync;
25 volatile uint32_t vt_vblank;
26 volatile uint32_t vt_hblank;
27 volatile uint32_t vt_flags;
28 volatile uint32_t vt_f2rf_lock;
29 volatile uint32_t vt_intr01;
30 volatile uint32_t vt_intr23;
31 volatile uint32_t fp_hdrv;
32 volatile uint32_t fp_vdrv;
33 volatile uint32_t fp_de;
34 volatile uint32_t vt_hpixen;
35 volatile uint32_t vt_vpixen;
36 volatile uint32_t vt_hcmap;
37 volatile uint32_t vt_vcmap;
38 volatile uint32_t did_start_xy;
39 volatile uint32_t crs_start_xy;
40 volatile uint32_t vc_start_xy;
41 uint32_t _pad1[0xffb0/4];
42 volatile uint32_t ovr_width_tile;
43 volatile uint32_t ovr_inhwctrl;
44 volatile uint32_t ovr_control;
45 uint32_t _pad2[0xfff4/4];
46 volatile uint32_t frm_size_tile;
47 volatile uint32_t frm_size_pixel;
48 volatile uint32_t frm_inhwctrl;
49 volatile uint32_t frm_control;
50 uint32_t _pad3[0xfff0/4];
51 volatile uint32_t did_inhwctrl;
52 volatile uint32_t did_control;
53 uint32_t _pad4[0x7ff8/4];
54 volatile uint32_t mode_regs[32];
55 uint32_t _pad5[0x7f80/4];
56 volatile uint32_t cmap[6144];
57 uint32_t _pad6[0x2000/4];
58 volatile uint32_t cm_fifo;
59 uint32_t _pad7[0x7ffc/4];
60 volatile uint32_t gmap[256];
61 uint32_t _pad8[0x7c00/4];
62 volatile uint32_t gmap10[1024];
63 uint32_t _pad9[0x7000/4];
64 volatile uint32_t crs_pos;
65 volatile uint32_t crs_ctl;
66 volatile uint32_t crs_cmap[3];
67 uint32_t _pad10[0x7fec/4];
68 volatile uint32_t crs_glyph[64];
69 uint32_t _pad11[0x7f00/4];
70 volatile uint32_t vc_0;
71 volatile uint32_t vc_1;
72 volatile uint32_t vc_2;
73 volatile uint32_t vc_3;
74 volatile uint32_t vc_4;
75 volatile uint32_t vc_5;
76 volatile uint32_t vc_6;
77 volatile uint32_t vc_7;
78 volatile uint32_t vc_8;
79 };
80
81 #define MASK(msb, lsb) \
82 ( (((u32)1<<((msb)-(lsb)+1))-1) << (lsb) )
83 #define GET(v, msb, lsb) \
84 ( ((u32)(v) & MASK(msb,lsb)) >> (lsb) )
85 #define SET(v, f, msb, lsb) \
86 ( (v) = ((v)&~MASK(msb,lsb)) | (( (u32)(f)<<(lsb) ) & MASK(msb,lsb)) )
87
88 #define GET_GBE_FIELD(reg, field, v) \
89 GET((v), GBE_##reg##_##field##_MSB, GBE_##reg##_##field##_LSB)
90 #define SET_GBE_FIELD(reg, field, v, f) \
91 SET((v), (f), GBE_##reg##_##field##_MSB, GBE_##reg##_##field##_LSB)
92
93
94
95
96 #define GBE_CTRLSTAT_CHIPID_MSB 3
97 #define GBE_CTRLSTAT_CHIPID_LSB 0
98 #define GBE_CTRLSTAT_SENSE_N_MSB 4
99 #define GBE_CTRLSTAT_SENSE_N_LSB 4
100 #define GBE_CTRLSTAT_PCLKSEL_MSB 29
101 #define GBE_CTRLSTAT_PCLKSEL_LSB 28
102
103 #define GBE_DOTCLK_M_MSB 7
104 #define GBE_DOTCLK_M_LSB 0
105 #define GBE_DOTCLK_N_MSB 13
106 #define GBE_DOTCLK_N_LSB 8
107 #define GBE_DOTCLK_P_MSB 15
108 #define GBE_DOTCLK_P_LSB 14
109 #define GBE_DOTCLK_RUN_MSB 20
110 #define GBE_DOTCLK_RUN_LSB 20
111
112 #define GBE_VT_XY_Y_MSB 23
113 #define GBE_VT_XY_Y_LSB 12
114 #define GBE_VT_XY_X_MSB 11
115 #define GBE_VT_XY_X_LSB 0
116 #define GBE_VT_XY_FREEZE_MSB 31
117 #define GBE_VT_XY_FREEZE_LSB 31
118
119 #define GBE_FP_VDRV_ON_MSB 23
120 #define GBE_FP_VDRV_ON_LSB 12
121 #define GBE_FP_VDRV_OFF_MSB 11
122 #define GBE_FP_VDRV_OFF_LSB 0
123
124 #define GBE_FP_HDRV_ON_MSB 23
125 #define GBE_FP_HDRV_ON_LSB 12
126 #define GBE_FP_HDRV_OFF_MSB 11
127 #define GBE_FP_HDRV_OFF_LSB 0
128
129 #define GBE_FP_DE_ON_MSB 23
130 #define GBE_FP_DE_ON_LSB 12
131 #define GBE_FP_DE_OFF_MSB 11
132 #define GBE_FP_DE_OFF_LSB 0
133
134 #define GBE_VT_VSYNC_VSYNC_ON_MSB 23
135 #define GBE_VT_VSYNC_VSYNC_ON_LSB 12
136 #define GBE_VT_VSYNC_VSYNC_OFF_MSB 11
137 #define GBE_VT_VSYNC_VSYNC_OFF_LSB 0
138
139 #define GBE_VT_HSYNC_HSYNC_ON_MSB 23
140 #define GBE_VT_HSYNC_HSYNC_ON_LSB 12
141 #define GBE_VT_HSYNC_HSYNC_OFF_MSB 11
142 #define GBE_VT_HSYNC_HSYNC_OFF_LSB 0
143
144 #define GBE_VT_VBLANK_VBLANK_ON_MSB 23
145 #define GBE_VT_VBLANK_VBLANK_ON_LSB 12
146 #define GBE_VT_VBLANK_VBLANK_OFF_MSB 11
147 #define GBE_VT_VBLANK_VBLANK_OFF_LSB 0
148
149 #define GBE_VT_HBLANK_HBLANK_ON_MSB 23
150 #define GBE_VT_HBLANK_HBLANK_ON_LSB 12
151 #define GBE_VT_HBLANK_HBLANK_OFF_MSB 11
152 #define GBE_VT_HBLANK_HBLANK_OFF_LSB 0
153
154 #define GBE_VT_FLAGS_F2RF_HIGH_MSB 6
155 #define GBE_VT_FLAGS_F2RF_HIGH_LSB 6
156 #define GBE_VT_FLAGS_SYNC_LOW_MSB 5
157 #define GBE_VT_FLAGS_SYNC_LOW_LSB 5
158 #define GBE_VT_FLAGS_SYNC_HIGH_MSB 4
159 #define GBE_VT_FLAGS_SYNC_HIGH_LSB 4
160 #define GBE_VT_FLAGS_HDRV_LOW_MSB 3
161 #define GBE_VT_FLAGS_HDRV_LOW_LSB 3
162 #define GBE_VT_FLAGS_HDRV_INVERT_MSB 2
163 #define GBE_VT_FLAGS_HDRV_INVERT_LSB 2
164 #define GBE_VT_FLAGS_VDRV_LOW_MSB 1
165 #define GBE_VT_FLAGS_VDRV_LOW_LSB 1
166 #define GBE_VT_FLAGS_VDRV_INVERT_MSB 0
167 #define GBE_VT_FLAGS_VDRV_INVERT_LSB 0
168
169 #define GBE_VT_VCMAP_VCMAP_ON_MSB 23
170 #define GBE_VT_VCMAP_VCMAP_ON_LSB 12
171 #define GBE_VT_VCMAP_VCMAP_OFF_MSB 11
172 #define GBE_VT_VCMAP_VCMAP_OFF_LSB 0
173
174 #define GBE_VT_HCMAP_HCMAP_ON_MSB 23
175 #define GBE_VT_HCMAP_HCMAP_ON_LSB 12
176 #define GBE_VT_HCMAP_HCMAP_OFF_MSB 11
177 #define GBE_VT_HCMAP_HCMAP_OFF_LSB 0
178
179 #define GBE_VT_XYMAX_MAXX_MSB 11
180 #define GBE_VT_XYMAX_MAXX_LSB 0
181 #define GBE_VT_XYMAX_MAXY_MSB 23
182 #define GBE_VT_XYMAX_MAXY_LSB 12
183
184 #define GBE_VT_HPIXEN_HPIXEN_ON_MSB 23
185 #define GBE_VT_HPIXEN_HPIXEN_ON_LSB 12
186 #define GBE_VT_HPIXEN_HPIXEN_OFF_MSB 11
187 #define GBE_VT_HPIXEN_HPIXEN_OFF_LSB 0
188
189 #define GBE_VT_VPIXEN_VPIXEN_ON_MSB 23
190 #define GBE_VT_VPIXEN_VPIXEN_ON_LSB 12
191 #define GBE_VT_VPIXEN_VPIXEN_OFF_MSB 11
192 #define GBE_VT_VPIXEN_VPIXEN_OFF_LSB 0
193
194 #define GBE_OVR_CONTROL_OVR_DMA_ENABLE_MSB 0
195 #define GBE_OVR_CONTROL_OVR_DMA_ENABLE_LSB 0
196
197 #define GBE_OVR_INHWCTRL_OVR_DMA_ENABLE_MSB 0
198 #define GBE_OVR_INHWCTRL_OVR_DMA_ENABLE_LSB 0
199
200 #define GBE_OVR_WIDTH_TILE_OVR_FIFO_RESET_MSB 13
201 #define GBE_OVR_WIDTH_TILE_OVR_FIFO_RESET_LSB 13
202
203 #define GBE_FRM_CONTROL_FRM_DMA_ENABLE_MSB 0
204 #define GBE_FRM_CONTROL_FRM_DMA_ENABLE_LSB 0
205 #define GBE_FRM_CONTROL_FRM_TILE_PTR_MSB 31
206 #define GBE_FRM_CONTROL_FRM_TILE_PTR_LSB 9
207 #define GBE_FRM_CONTROL_FRM_LINEAR_MSB 1
208 #define GBE_FRM_CONTROL_FRM_LINEAR_LSB 1
209
210 #define GBE_FRM_INHWCTRL_FRM_DMA_ENABLE_MSB 0
211 #define GBE_FRM_INHWCTRL_FRM_DMA_ENABLE_LSB 0
212
213 #define GBE_FRM_SIZE_TILE_FRM_WIDTH_TILE_MSB 12
214 #define GBE_FRM_SIZE_TILE_FRM_WIDTH_TILE_LSB 5
215 #define GBE_FRM_SIZE_TILE_FRM_RHS_MSB 4
216 #define GBE_FRM_SIZE_TILE_FRM_RHS_LSB 0
217 #define GBE_FRM_SIZE_TILE_FRM_DEPTH_MSB 14
218 #define GBE_FRM_SIZE_TILE_FRM_DEPTH_LSB 13
219 #define GBE_FRM_SIZE_TILE_FRM_FIFO_RESET_MSB 15
220 #define GBE_FRM_SIZE_TILE_FRM_FIFO_RESET_LSB 15
221
222 #define GBE_FRM_SIZE_PIXEL_FB_HEIGHT_PIX_MSB 31
223 #define GBE_FRM_SIZE_PIXEL_FB_HEIGHT_PIX_LSB 16
224
225 #define GBE_DID_CONTROL_DID_DMA_ENABLE_MSB 0
226 #define GBE_DID_CONTROL_DID_DMA_ENABLE_LSB 0
227 #define GBE_DID_INHWCTRL_DID_DMA_ENABLE_MSB 0
228 #define GBE_DID_INHWCTRL_DID_DMA_ENABLE_LSB 0
229
230 #define GBE_DID_START_XY_DID_STARTY_MSB 23
231 #define GBE_DID_START_XY_DID_STARTY_LSB 12
232 #define GBE_DID_START_XY_DID_STARTX_MSB 11
233 #define GBE_DID_START_XY_DID_STARTX_LSB 0
234
235 #define GBE_CRS_START_XY_CRS_STARTY_MSB 23
236 #define GBE_CRS_START_XY_CRS_STARTY_LSB 12
237 #define GBE_CRS_START_XY_CRS_STARTX_MSB 11
238 #define GBE_CRS_START_XY_CRS_STARTX_LSB 0
239
240 #define GBE_WID_AUX_MSB 12
241 #define GBE_WID_AUX_LSB 11
242 #define GBE_WID_GAMMA_MSB 10
243 #define GBE_WID_GAMMA_LSB 10
244 #define GBE_WID_CM_MSB 9
245 #define GBE_WID_CM_LSB 5
246 #define GBE_WID_TYP_MSB 4
247 #define GBE_WID_TYP_LSB 2
248 #define GBE_WID_BUF_MSB 1
249 #define GBE_WID_BUF_LSB 0
250
251 #define GBE_VC_START_XY_VC_STARTY_MSB 23
252 #define GBE_VC_START_XY_VC_STARTY_LSB 12
253 #define GBE_VC_START_XY_VC_STARTX_MSB 11
254 #define GBE_VC_START_XY_VC_STARTX_LSB 0
255
256
257
258 #define GBE_FRM_DEPTH_8 0
259 #define GBE_FRM_DEPTH_16 1
260 #define GBE_FRM_DEPTH_32 2
261
262 #define GBE_CMODE_I8 0
263 #define GBE_CMODE_I12 1
264 #define GBE_CMODE_RG3B2 2
265 #define GBE_CMODE_RGB4 3
266 #define GBE_CMODE_ARGB5 4
267 #define GBE_CMODE_RGB8 5
268 #define GBE_CMODE_RGBA5 6
269 #define GBE_CMODE_RGB10 7
270
271 #define GBE_BMODE_BOTH 3
272
273 #define GBE_CRS_MAGIC 54
274 #define GBE_PIXEN_MAGIC_ON 19
275 #define GBE_PIXEN_MAGIC_OFF 2
276
277 #define GBE_TLB_SIZE 128
278
279
280
281
282
283
284
285 struct gbe_timing_info {
286 int flags;
287 short width;
288 short height;
289 int fields_sec;
290 int cfreq;
291 short htotal;
292 short hblank_start;
293 short hblank_end;
294 short hsync_start;
295 short hsync_end;
296 short vtotal;
297 short vblank_start;
298 short vblank_end;
299 short vsync_start;
300 short vsync_end;
301 short pll_m;
302 short pll_n;
303 short pll_p;
304 };
305
306
307
308 #define GBE_VOF_UNKNOWNMON 1
309 #define GBE_VOF_STEREO 2
310 #define GBE_VOF_DO_GENSYNC 4
311 #define GBE_VOF_SYNC_ON_GREEN 8
312 #define GBE_VOF_FLATPANEL 0x1000
313 #define GBE_VOF_MAGICKEY 0x2000
314
315 #endif