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