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