Import changeset
[linux-flexiantxendom0-3.2.10.git] / drivers / video / sti-bmode.h
1 #define STI_REGION_MAX 8
2 #define STI_DEV_NAME_LENGTH 32
3
4 typedef struct {
5          u8 res[3];
6          u8 data;
7 } __attribute__((packed)) sti_u8;
8
9 typedef struct {
10         sti_u8 data[2];
11 } __attribute__((packed)) sti_u16;
12
13 typedef struct {
14         sti_u8 data[4];
15 } __attribute__((packed)) sti_u32;
16
17 #define  STI_U8( u8) ((u8).data)
18 #define STI_U16(u16) ((STI_U8((u16).data[0])<<8) | STI_U8((u16).data[1]))
19 #define STI_U32(u32) ((STI_U8((u32).data[0])<<24) | \
20                       (STI_U8((u32).data[1])<<16) | \
21                       (STI_U8((u32).data[2])<< 8) | \
22                       (STI_U8((u32).data[3])<< 0))
23
24 struct sti_rom_region {
25         sti_u32 region;
26 };
27
28 struct sti_rom_font {
29         sti_u16 first_char;
30         sti_u16 last_char;
31          sti_u8 width;
32          sti_u8 height;
33          sti_u8 font_type;
34          sti_u8 bytes_per_char;
35         sti_u32 next_font;
36          sti_u8 underline_height;
37          sti_u8 underline_pos;
38          sti_u8 res008[2];
39 };
40
41 struct sti_rom {
42          sti_u8 type;
43          sti_u8 num_mons;
44          sti_u8 revno[2];
45
46          sti_u8 graphics_id[8];                 /* 0x010 */
47
48         sti_u32 font_start;                     /* 0x030 */
49         sti_u32 statesize;
50         sti_u32 last_addr;
51         sti_u32 region_list;
52
53         sti_u16 reentsize;                      /* 0x070 */
54         sti_u16 maxtime;
55         sti_u32 mon_tbl_addr;
56         sti_u32 user_data_addr;
57         sti_u32 sti_mem_req;
58
59         sti_u32 user_data_size;                 /* 0x0b0 */
60         sti_u16 power;                          /* 0x0c0 */
61          sti_u8 bus_support;
62          sti_u8 ext_bus_support;
63          sti_u8 alt_code_type;                  /* 0x0d0 */
64          sti_u8 ext_dd_struct[3];
65         sti_u32 cfb_addr;                       /* 0x0e0 */
66         
67          sti_u8 res0f0[4];                      
68
69         sti_u32 init_graph;             /* 0x0e0 */
70         sti_u32 state_mgmt;
71         sti_u32 font_unpmv;
72         sti_u32 block_move;
73         sti_u32 self_test;
74         sti_u32 excep_hdlr;
75         sti_u32 inq_conf;
76         sti_u32 set_cm_entry;
77         sti_u32 dma_ctrl;
78         sti_u32 flow_ctrl;
79         sti_u32 user_timing;
80         sti_u32 process_mgr;
81         sti_u32 sti_util;
82         sti_u32 end_addr;
83         sti_u32 res0b8;
84         sti_u32 res0bc;
85
86         sti_u32 init_graph_m68k;                /* 0x0e0 */
87         sti_u32 state_mgmt_m68k;
88         sti_u32 font_unpmv_m68k;
89         sti_u32 block_move_m68k;
90         sti_u32 self_test_m68k;
91         sti_u32 excep_hdlr_m68k;
92         sti_u32 inq_conf_m68k;
93         sti_u32 set_cm_entry_m68k;
94         sti_u32 dma_ctrl_m68k;
95         sti_u32 flow_ctrl_m68k;
96         sti_u32 user_timing_m68k;
97         sti_u32 process_mgr_m68k;
98         sti_u32 sti_util_m68k;
99         sti_u32 end_addr_m68k;
100         sti_u32 res0b8_m68k;
101         sti_u32 res0bc_m68k;
102
103          sti_u8 res040[7 * 4];
104 };
105         
106 struct sti_cooked_font {
107         struct sti_rom_font *raw;
108         struct sti_cooked_font *next_font;
109 };
110
111 struct sti_cooked_rom {
112         struct sti_rom *raw;
113         struct sti_cooked_font *font_start;
114         u32 *region_list;
115 };
116
117 struct sti_glob_cfg_ext {
118          u8 curr_mon;
119          u8 friendly_boot;
120         s16 power;
121         s32 freq_ref;
122         s32 *sti_mem_addr;
123         s32 *future_ptr;
124 };
125
126 struct sti_glob_cfg {
127         s32 text_planes;
128         s16 onscreen_x;
129         s16 onscreen_y;
130         s16 offscreen_x;
131         s16 offscreen_y;
132         s16 total_x;
133         s16 total_y;
134         u32 region_ptrs[STI_REGION_MAX];
135         s32 reent_lvl;
136         s32 *save_addr;
137         struct sti_glob_cfg_ext *ext_ptr;
138 };
139
140 struct sti_init_flags {
141         u32 wait : 1;
142         u32 reset : 1;
143         u32 text : 1;
144         u32 nontext : 1;
145         u32 clear : 1;
146         u32 cmap_blk : 1;
147         u32 enable_be_timer : 1;
148         u32 enable_be_int : 1;
149         u32 no_chg_tx : 1;
150         u32 no_chg_ntx : 1;
151         u32 no_chg_bet : 1;
152         u32 no_chg_bei : 1;
153         u32 init_cmap_tx : 1;
154         u32 cmt_chg : 1;
155         u32 retain_ie : 1;
156         u32 pad : 17;
157
158         s32 *future_ptr;
159 };
160
161 struct sti_init_inptr_ext {
162         u8  config_mon_type;
163         u8  pad[1];
164         u16 inflight_data;
165         s32 *future_ptr;
166 };
167
168 struct sti_init_inptr {
169         s32 text_planes;
170         struct sti_init_inptr_ext *ext_ptr;
171 };
172
173 struct sti_init_outptr {
174         s32 errno;
175         s32 text_planes;
176         s32 *future_ptr;
177 };
178
179 struct sti_conf_flags {
180         u32 wait : 1;
181         u32 pad : 31;
182         s32 *future_ptr;
183 };
184
185 struct sti_conf_inptr {
186         s32 *future_ptr;
187 };
188
189 struct sti_conf_outptr_ext {
190         u32 crt_config[3];
191         u32 crt_hdw[3];
192         s32 *future_ptr;
193 };
194
195 struct sti_conf_outptr {
196         s32 errno;
197         s16 onscreen_x;
198         s16 onscreen_y;
199         s16 offscreen_x;
200         s16 offscreen_y;
201         s16 total_x;
202         s16 total_y;
203         s32 bits_per_pixel;
204         s32 bits_used;
205         s32 planes;
206          u8 dev_name[STI_DEV_NAME_LENGTH];
207         u32 attributes;
208         struct sti_conf_outptr_ext *ext_ptr;
209 };
210
211
212 struct sti_font_inptr {
213         u32 font_start_addr;
214         s16 index;
215         u8 fg_color;
216         u8 bg_color;
217         s16 dest_x;
218         s16 dest_y;
219         s32 *future_ptr;
220 };
221
222 struct sti_font_flags {
223         u32 wait : 1;
224         u32 non_text : 1;
225         u32 pad : 30;
226
227         s32 *future_ptr;
228 };
229         
230 struct sti_font_outptr {
231         s32 errno;
232         s32 *future_ptr;
233 };
234
235 struct sti_blkmv_flags {
236         u32 wait : 1;
237         u32 color : 1;
238         u32 clear : 1;
239         u32 non_text : 1;
240         u32 pad : 28;
241         s32 *future_ptr;
242 };
243
244 struct sti_blkmv_inptr {
245         u8 fg_color;
246         u8 bg_color;
247         s16 src_x;
248         s16 src_y;
249         s16 dest_x;
250         s16 dest_y;
251         s16 width;
252         s16 height;
253         s32 *future_ptr;
254 };
255
256 struct sti_blkmv_outptr {
257         s32 errno;
258         s32 *future_ptr;
259 };
260
261 struct sti_struct {
262         spinlock_t lock;
263
264         struct sti_cooked_rom *rom;
265
266         unsigned long font_unpmv;
267         unsigned long block_move;
268         unsigned long init_graph;
269         unsigned long inq_conf;
270
271         struct sti_glob_cfg *glob_cfg;
272         struct sti_rom_font *font;
273
274         s32 text_planes;
275
276         char **mon_strings;
277         u32 *regions;
278          u8 *pci_regions;
279 };
280
281 #define STI_CALL(func, flags, inptr, outptr, glob_cfg) \
282         ({                                                      \
283                 real32_call( func, (unsigned long)STI_PTR(flags), \
284                                     STI_PTR(inptr), STI_PTR(outptr), \
285                                     glob_cfg); \
286         })
287