1 #define STI_REGION_MAX 8
2 #define STI_DEV_NAME_LENGTH 32
3
4 struct sti_rom_font {
5 u16 first_char;
6 u16 last_char;
7 u8 width;
8 u8 height;
9 u8 font_type;
10 u8 bytes_per_char;
11 u32 next_font;
12 u8 underline_height;
13 u8 underline_pos;
14 u8 res008[2];
15 };
16
17 struct sti_rom {
18 u8 type[4];
19 u8 res004;
20 u8 num_mons;
21 u8 revno[2];
22 u8 graphics_id[8];
23
24 u32 font_start;
25 u32 statesize;
26 u32 last_addr;
27 u32 region_list;
28
29 u16 reentsize;
30 u16 maxtime;
31 u32 mon_tbl_addr;
32 u32 user_data_addr;
33 u32 sti_mem_req;
34
35 u32 user_data_size;
36 u16 power;
37 u8 bus_support;
38 u8 ext_bus_support;
39 u8 alt_code_type;
40 u8 ext_dd_struct[3];
41 u32 cfb_addr;
42
43 u32 init_graph;
44 u32 state_mgmt;
45 u32 font_unpmv;
46 u32 block_move;
47 u32 self_test;
48 u32 excep_hdlr;
49 u32 inq_conf;
50 u32 set_cm_entry;
51 u32 dma_ctrl;
52 u8 res040[7 * 4];
53
54 u32 init_graph_m68k;
55 u32 flow_ctrl;
56 u32 user_timing;
57 u32 process_mgr;
58 u32 sti_util;
59 u32 end_addr;
60 u32 res0b8;
61 u32 res0bc;
62 };
63
64 struct sti_cooked_font {
65 struct sti_rom_font *raw;
66 struct sti_cooked_font *next_font;
67 };
68
69 struct sti_cooked_rom {
70 struct sti_rom *raw;
71 struct sti_cooked_font *font_start;
72 u32 *region_list;
73 };
74
75 struct sti_glob_cfg_ext {
76 u8 curr_mon;
77 u8 friendly_boot;
78 s16 power;
79 s32 freq_ref;
80 s32 *sti_mem_addr;
81 s32 *future_ptr;
82 };
83
84 struct sti_glob_cfg {
85 s32 text_planes;
86 s16 onscreen_x;
87 s16 onscreen_y;
88 s16 offscreen_x;
89 s16 offscreen_y;
90 s16 total_x;
91 s16 total_y;
92 u32 region_ptrs[STI_REGION_MAX];
93 s32 reent_lvl;
94 s32 *save_addr;
95 struct sti_glob_cfg_ext *ext_ptr;
96 };
97
98 struct sti_init_flags {
99 u32 wait : 1;
100 u32 reset : 1;
101 u32 text : 1;
102 u32 nontext : 1;
103 u32 clear : 1;
104 u32 cmap_blk : 1;
105 u32 enable_be_timer : 1;
106 u32 enable_be_int : 1;
107 u32 no_chg_tx : 1;
108 u32 no_chg_ntx : 1;
109 u32 no_chg_bet : 1;
110 u32 no_chg_bei : 1;
111 u32 init_cmap_tx : 1;
112 u32 cmt_chg : 1;
113 u32 retain_ie : 1;
114 u32 pad : 17;
115
116 s32 *future_ptr;
117 };
118
119 struct sti_init_inptr_ext {
120 u8 config_mon_type;
121 u8 pad[1];
122 u16 inflight_data;
123 s32 *future_ptr;
124 };
125
126 struct sti_init_inptr {
127 s32 text_planes;
128 struct sti_init_inptr_ext *ext_ptr;
129 };
130
131 struct sti_init_outptr {
132 s32 errno;
133 s32 text_planes;
134 s32 *future_ptr;
135 };
136
137 struct sti_conf_flags {
138 u32 wait : 1;
139 u32 pad : 31;
140 s32 *future_ptr;
141 };
142
143 struct sti_conf_inptr {
144 s32 *future_ptr;
145 };
146
147 struct sti_conf_outptr_ext {
148 u32 crt_config[3];
149 u32 crt_hdw[3];
150 s32 *future_ptr;
151 };
152
153 struct sti_conf_outptr {
154 s32 errno;
155 s16 onscreen_x;
156 s16 onscreen_y;
157 s16 offscreen_x;
158 s16 offscreen_y;
159 s16 total_x;
160 s16 total_y;
161 s32 bits_per_pixel;
162 s32 bits_used;
163 s32 planes;
164 u8 dev_name[STI_DEV_NAME_LENGTH];
165 u32 attributes;
166 struct sti_conf_outptr_ext *ext_ptr;
167 };
168
169
170 struct sti_font_inptr {
171 u32 font_start_addr;
172 s16 index;
173 u8 fg_color;
174 u8 bg_color;
175 s16 dest_x;
176 s16 dest_y;
177 s32 *future_ptr;
178 };
179
180 struct sti_font_flags {
181 u32 wait : 1;
182 u32 non_text : 1;
183 u32 pad : 30;
184
185 s32 *future_ptr;
186 };
187
188 struct sti_font_outptr {
189 s32 errno;
190 s32 *future_ptr;
191 };
192
193 struct sti_blkmv_flags {
194 u32 wait : 1;
195 u32 color : 1;
196 u32 clear : 1;
197 u32 non_text : 1;
198 u32 pad : 28;
199 s32 *future_ptr;
200 };
201
202 struct sti_blkmv_inptr {
203 u8 fg_color;
204 u8 bg_color;
205 s16 src_x;
206 s16 src_y;
207 s16 dest_x;
208 s16 dest_y;
209 s16 width;
210 s16 height;
211 s32 *future_ptr;
212 };
213
214 struct sti_blkmv_outptr {
215 s32 errno;
216 s32 *future_ptr;
217 };
218
219 struct sti_struct {
220 spinlock_t lock;
221
222 struct sti_cooked_rom *rom;
223
224 unsigned long font_unpmv;
225 unsigned long block_move;
226 unsigned long init_graph;
227 unsigned long inq_conf;
228
229 struct sti_glob_cfg *glob_cfg;
230 struct sti_rom_font *font;
231
232 s32 text_planes;
233
234 char **mon_strings;
235 u32 *regions;
236 u8 *pci_regions;
237 };
238
239 #define STI_CALL(func, flags, inptr, outptr, glob_cfg) \
240 ({ \
241 real32_call( func, (unsigned long)STI_PTR(flags), \
242 STI_PTR(inptr), STI_PTR(outptr), \
243 glob_cfg); \
244 })
245
246 /* The latency of the STI functions cannot really be reduced by setting
247 * this to 0; STI doesn't seem to be designed to allow calling a different
248 * function (or the same function with different arguments) after a
249 * function exited with 1 as return value.
250 *
251 * As all of the functions below could be called from interrupt context,
252 * we have to spin_lock_irqsave around the do { ret = bla(); } while(ret==1)
253 * block. Really bad latency there.
254 *
255 * Probably the best solution to all this is have the generic code manage
256 * the screen buffer and a kernel thread to call STI occasionally.
257 *
258 * Luckily, the frame buffer guys have the same problem so we can just wait
259 * for them to fix it and steal their solution. prumpf
260 *
261 * Actually, another long-term viable solution is to completely do STI
262 * support in userspace - that way we avoid the potential license issues
263 * of using proprietary fonts, too. */
264
265 #define STI_WAIT 1
266 #define STI_PTR(p) ( (typeof(p)) virt_to_phys(p))
267 #define PTR_STI(p) ( (typeof(p)) phys_to_virt((unsigned long)p) )
268
269 #define sti_onscreen_x(sti) (PTR_STI(sti->glob_cfg)->onscreen_x)
270 #define sti_onscreen_y(sti) (PTR_STI(sti->glob_cfg)->onscreen_y)
271 #define sti_font_x(sti) (PTR_STI(sti->font)->width)
272 #define sti_font_y(sti) (PTR_STI(sti->font)->height)
273
274 extern struct sti_struct * sti_init_roms(void);
275
276 void sti_init_graph(struct sti_struct *sti);
277 void sti_inq_conf(struct sti_struct *sti);
278 void sti_putc(struct sti_struct *sti, int c, int y, int x);
279 void sti_set(struct sti_struct *sti, int src_y, int src_x,
280 int height, int width, u8 color);
281 void sti_clear(struct sti_struct *sti, int src_y, int src_x,
282 int height, int width);
283 void sti_bmove(struct sti_struct *sti, int src_y, int src_x,
284 int dst_y, int dst_x, int height, int width);
285
286 /* XXX: this probably should not be here, but we rely on STI being
287 initialized early and independently of stifb at the moment, so
288 there's no other way for stifb to find it. */
289 extern struct sti_struct default_sti;
290
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.