1
2 #ifndef STICORE_H
3 #define STICORE_H
4
5
6
7 #if 0
8 #define DPRINTK(x) printk x
9 #else
10 #define DPRINTK(x)
11 #endif
12
13 #define MAX_STI_ROMS 4
14
15 #define STI_REGION_MAX 8
16 #define STI_DEV_NAME_LENGTH 32
17 #define STI_MONITOR_MAX 256
18
19 #define STI_FONT_HPROMAN8 1
20 #define STI_FONT_KANA8 2
21
22 #define ALT_CODE_TYPE_UNKNOWN 0x00
23 #define ALT_CODE_TYPE_PA_RISC_64 0x01
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 #include <asm/io.h>
42
43 #define STI_WAIT 1
44
45 #define STI_PTR(p) ( virt_to_phys(p) )
46 #define PTR_STI(p) ( phys_to_virt((unsigned long)p) )
47
48 #define sti_onscreen_x(sti) (sti->glob_cfg->onscreen_x)
49 #define sti_onscreen_y(sti) (sti->glob_cfg->onscreen_y)
50
51
52 #define sti_font_x(sti) (PTR_STI(sti->font)->width)
53 #define sti_font_y(sti) (PTR_STI(sti->font)->height)
54
55 #ifdef CONFIG_64BIT
56 #define STI_LOWMEM (GFP_KERNEL | GFP_DMA)
57 #else
58 #define STI_LOWMEM (GFP_KERNEL)
59 #endif
60
61
62
63
64 typedef union region {
65 struct {
66 u32 offset : 14;
67 u32 sys_only : 1;
68 u32 cache : 1;
69 u32 btlb : 1;
70 u32 last : 1;
71 u32 length : 14;
72 } region_desc;
73
74 u32 region;
75 } region_t;
76
77 #define REGION_OFFSET_TO_PHYS( rt, hpa ) \
78 (((rt).region_desc.offset << 12) + (hpa))
79
80 struct sti_glob_cfg_ext {
81 u8 curr_mon;
82 u8 friendly_boot;
83 s16 power;
84 s32 freq_ref;
85 u32 sti_mem_addr;
86 u32 future_ptr;
87 };
88
89 struct sti_glob_cfg {
90 s32 text_planes;
91 s16 onscreen_x;
92 s16 onscreen_y;
93 s16 offscreen_x;
94 s16 offscreen_y;
95 s16 total_x;
96 s16 total_y;
97 u32 region_ptrs[STI_REGION_MAX];
98 s32 reent_lvl;
99 u32 save_addr;
100 u32 ext_ptr;
101 };
102
103
104
105
106 struct sti_init_flags {
107 u32 wait : 1;
108 u32 reset : 1;
109 u32 text : 1;
110 u32 nontext : 1;
111 u32 clear : 1;
112 u32 cmap_blk : 1;
113 u32 enable_be_timer : 1;
114 u32 enable_be_int : 1;
115 u32 no_chg_tx : 1;
116 u32 no_chg_ntx : 1;
117 u32 no_chg_bet : 1;
118 u32 no_chg_bei : 1;
119 u32 init_cmap_tx : 1;
120 u32 cmt_chg : 1;
121 u32 retain_ie : 1;
122 u32 caller_bootrom : 1;
123 u32 caller_kernel : 1;
124 u32 caller_other : 1;
125 u32 pad : 14;
126 u32 future_ptr;
127 };
128
129 struct sti_init_inptr_ext {
130 u8 config_mon_type;
131 u8 pad[1];
132 u16 inflight_data;
133 u32 future_ptr;
134 };
135
136 struct sti_init_inptr {
137 s32 text_planes;
138 u32 ext_ptr;
139 };
140
141
142 struct sti_init_outptr {
143 s32 errno;
144 s32 text_planes;
145 u32 future_ptr;
146 };
147
148
149
150
151
152 struct sti_conf_flags {
153 u32 wait : 1;
154 u32 pad : 31;
155 u32 future_ptr;
156 };
157
158 struct sti_conf_inptr {
159 u32 future_ptr;
160 };
161
162 struct sti_conf_outptr_ext {
163 u32 crt_config[3];
164 u32 crt_hdw[3];
165 u32 future_ptr;
166 };
167
168 struct sti_conf_outptr {
169 s32 errno;
170 s16 onscreen_x;
171 s16 onscreen_y;
172 s16 offscreen_x;
173 s16 offscreen_y;
174 s16 total_x;
175 s16 total_y;
176 s32 bits_per_pixel;
177 s32 bits_used;
178 s32 planes;
179 u8 dev_name[STI_DEV_NAME_LENGTH];
180 u32 attributes;
181 u32 ext_ptr;
182 };
183
184 struct sti_rom {
185 u8 type[4];
186 u8 res004;
187 u8 num_mons;
188 u8 revno[2];
189 u32 graphics_id[2];
190
191 u32 font_start;
192 u32 statesize;
193 u32 last_addr;
194 u32 region_list;
195
196 u16 reentsize;
197 u16 maxtime;
198 u32 mon_tbl_addr;
199 u32 user_data_addr;
200 u32 sti_mem_req;
201
202 u32 user_data_size;
203 u16 power;
204 u8 bus_support;
205 u8 ext_bus_support;
206 u8 alt_code_type;
207 u8 ext_dd_struct[3];
208 u32 cfb_addr;
209
210 u32 init_graph;
211 u32 state_mgmt;
212 u32 font_unpmv;
213 u32 block_move;
214 u32 self_test;
215 u32 excep_hdlr;
216 u32 inq_conf;
217 u32 set_cm_entry;
218 u32 dma_ctrl;
219 u8 res040[7 * 4];
220
221 u32 init_graph_addr;
222 u32 state_mgmt_addr;
223 u32 font_unp_addr;
224 u32 block_move_addr;
225 u32 self_test_addr;
226 u32 excep_hdlr_addr;
227 u32 inq_conf_addr;
228 u32 set_cm_entry_addr;
229 u32 image_unpack_addr;
230 u32 pa_risx_addrs[7];
231 };
232
233 struct sti_rom_font {
234 u16 first_char;
235 u16 last_char;
236 u8 width;
237 u8 height;
238 u8 font_type;
239 u8 bytes_per_char;
240 u32 next_font;
241 u8 underline_height;
242 u8 underline_pos;
243 u8 res008[2];
244 };
245
246
247
248 struct sti_cooked_font {
249 struct sti_rom_font *raw;
250 struct sti_cooked_font *next_font;
251 };
252
253 struct sti_cooked_rom {
254 struct sti_rom *raw;
255 struct sti_cooked_font *font_start;
256 };
257
258
259
260 struct sti_font_inptr {
261 u32 font_start_addr;
262 s16 index;
263 u8 fg_color;
264 u8 bg_color;
265 s16 dest_x;
266 s16 dest_y;
267 u32 future_ptr;
268 };
269
270 struct sti_font_flags {
271 u32 wait : 1;
272 u32 non_text : 1;
273 u32 pad : 30;
274 u32 future_ptr;
275 };
276
277 struct sti_font_outptr {
278 s32 errno;
279 u32 future_ptr;
280 };
281
282
283
284 struct sti_blkmv_flags {
285 u32 wait : 1;
286 u32 color : 1;
287 u32 clear : 1;
288 u32 non_text : 1;
289 u32 pad : 28;
290 u32 future_ptr;
291 };
292
293 struct sti_blkmv_inptr {
294 u8 fg_color;
295 u8 bg_color;
296 s16 src_x;
297 s16 src_y;
298 s16 dest_x;
299 s16 dest_y;
300 s16 width;
301 s16 height;
302 u32 future_ptr;
303 };
304
305 struct sti_blkmv_outptr {
306 s32 errno;
307 u32 future_ptr;
308 };
309
310
311
312
313
314 struct sti_all_data {
315 struct sti_glob_cfg glob_cfg;
316 struct sti_glob_cfg_ext glob_cfg_ext;
317
318 struct sti_conf_inptr inq_inptr;
319 struct sti_conf_outptr inq_outptr;
320 struct sti_conf_outptr_ext inq_outptr_ext;
321
322 struct sti_init_inptr_ext init_inptr_ext;
323 struct sti_init_inptr init_inptr;
324 struct sti_init_outptr init_outptr;
325
326 struct sti_blkmv_inptr blkmv_inptr;
327 struct sti_blkmv_outptr blkmv_outptr;
328
329 struct sti_font_inptr font_inptr;
330 struct sti_font_outptr font_outptr;
331
332
333 unsigned long save_addr[1024 / sizeof(unsigned long)];
334
335 unsigned long sti_mem_addr[256 / sizeof(unsigned long)];
336
337 };
338
339
340
341 struct sti_struct {
342 spinlock_t lock;
343
344
345 int font_width;
346 int font_height;
347
348 int sti_mem_request;
349 u32 graphics_id[2];
350
351 struct sti_cooked_rom *rom;
352
353 unsigned long font_unpmv;
354 unsigned long block_move;
355 unsigned long init_graph;
356 unsigned long inq_conf;
357
358
359 int text_planes;
360 region_t regions[STI_REGION_MAX];
361 unsigned long regions_phys[STI_REGION_MAX];
362
363 struct sti_glob_cfg *glob_cfg;
364
365 struct sti_cooked_font *font;
366
367 struct pci_dev *pd;
368
369
370 u8 rm_entry[16];
371
372
373 struct fb_info *info;
374
375
376 struct sti_all_data *sti_data;
377 };
378
379
380
381
382 struct sti_struct *sti_get_rom(unsigned int index);
383
384
385
386
387 int sti_call(const struct sti_struct *sti, unsigned long func,
388 const void *flags, void *inptr, void *outptr,
389 struct sti_glob_cfg *glob_cfg);
390
391
392
393
394 void sti_putc(struct sti_struct *sti, int c, int y, int x);
395 void sti_set(struct sti_struct *sti, int src_y, int src_x,
396 int height, int width, u8 color);
397 void sti_clear(struct sti_struct *sti, int src_y, int src_x,
398 int height, int width, int c);
399 void sti_bmove(struct sti_struct *sti, int src_y, int src_x,
400 int dst_y, int dst_x, int height, int width);
401
402 #endif