summaryrefslogtreecommitdiffstats
path: root/drivers/video/sti-bmode.h
blob: 4aa38f6d9daa16015a862faf9c01d3806657f2db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#define STI_REGION_MAX 8
#define STI_DEV_NAME_LENGTH 32

typedef struct {
	 u8 res[3];
	 u8 data;
} __attribute__((packed)) sti_u8;

typedef struct {
	sti_u8 data[2];
} __attribute__((packed)) sti_u16;

typedef struct {
	sti_u8 data[4];
} __attribute__((packed)) sti_u32;

#define  STI_U8( u8) ((u8).data)
#define STI_U16(u16) ((STI_U8((u16).data[0])<<8) | STI_U8((u16).data[1]))
#define STI_U32(u32) ((STI_U8((u32).data[0])<<24) | \
		      (STI_U8((u32).data[1])<<16) | \
		      (STI_U8((u32).data[2])<< 8) | \
		      (STI_U8((u32).data[3])<< 0))

struct sti_rom_region {
	sti_u32 region;
};

struct sti_rom_font {
	sti_u16 first_char;
	sti_u16 last_char;
	 sti_u8 width;
	 sti_u8 height;
	 sti_u8 font_type;
	 sti_u8 bytes_per_char;
	sti_u32 next_font;
	 sti_u8 underline_height;
	 sti_u8 underline_pos;
	 sti_u8 res008[2];
};

struct sti_rom {
	 sti_u8 type;
	 sti_u8 num_mons;
	 sti_u8 revno[2];

	 sti_u8 graphics_id[8];			/* 0x010 */

	sti_u32 font_start;			/* 0x030 */
	sti_u32 statesize;
	sti_u32 last_addr;
	sti_u32 region_list;

	sti_u16 reentsize;			/* 0x070 */
	sti_u16 maxtime;
	sti_u32 mon_tbl_addr;
	sti_u32 user_data_addr;
	sti_u32 sti_mem_req;

	sti_u32 user_data_size;			/* 0x0b0 */
	sti_u16 power;				/* 0x0c0 */
	 sti_u8 bus_support;
	 sti_u8 ext_bus_support;
	 sti_u8 alt_code_type;			/* 0x0d0 */
	 sti_u8 ext_dd_struct[3];
	sti_u32 cfb_addr;			/* 0x0e0 */
	
	 sti_u8 res0f0[4];			

	sti_u32 init_graph;		/* 0x0e0 */
	sti_u32 state_mgmt;
	sti_u32 font_unpmv;
	sti_u32 block_move;
	sti_u32 self_test;
	sti_u32 excep_hdlr;
	sti_u32 inq_conf;
	sti_u32 set_cm_entry;
	sti_u32 dma_ctrl;
	sti_u32 flow_ctrl;
	sti_u32 user_timing;
	sti_u32 process_mgr;
	sti_u32 sti_util;
	sti_u32 end_addr;
	sti_u32 res0b8;
	sti_u32 res0bc;

	sti_u32 init_graph_m68k;		/* 0x0e0 */
	sti_u32 state_mgmt_m68k;
	sti_u32 font_unpmv_m68k;
	sti_u32 block_move_m68k;
	sti_u32 self_test_m68k;
	sti_u32 excep_hdlr_m68k;
	sti_u32 inq_conf_m68k;
	sti_u32 set_cm_entry_m68k;
	sti_u32 dma_ctrl_m68k;
	sti_u32 flow_ctrl_m68k;
	sti_u32 user_timing_m68k;
	sti_u32 process_mgr_m68k;
	sti_u32 sti_util_m68k;
	sti_u32 end_addr_m68k;
	sti_u32 res0b8_m68k;
	sti_u32 res0bc_m68k;

	 sti_u8 res040[7 * 4];
};
	
struct sti_cooked_font {
	struct sti_rom_font *raw;
	struct sti_cooked_font *next_font;
};

struct sti_cooked_rom {
	struct sti_rom *raw;
	struct sti_cooked_font *font_start;
	u32 *region_list;
};

struct sti_glob_cfg_ext {
	 u8 curr_mon;
	 u8 friendly_boot;
	s16 power;
	s32 freq_ref;
	s32 *sti_mem_addr;
	s32 *future_ptr;
};

struct sti_glob_cfg {
	s32 text_planes;
	s16 onscreen_x;
	s16 onscreen_y;
	s16 offscreen_x;
	s16 offscreen_y;
	s16 total_x;
	s16 total_y;
	u32 region_ptrs[STI_REGION_MAX];
	s32 reent_lvl;
	s32 *save_addr;
	struct sti_glob_cfg_ext *ext_ptr;
};

struct sti_init_flags {
	u32 wait : 1;
	u32 reset : 1;
	u32 text : 1;
	u32 nontext : 1;
	u32 clear : 1;
	u32 cmap_blk : 1;
	u32 enable_be_timer : 1;
	u32 enable_be_int : 1;
	u32 no_chg_tx : 1;
	u32 no_chg_ntx : 1;
	u32 no_chg_bet : 1;
	u32 no_chg_bei : 1;
	u32 init_cmap_tx : 1;
	u32 cmt_chg : 1;
	u32 retain_ie : 1;
	u32 pad : 17;

	s32 *future_ptr;
};

struct sti_init_inptr_ext {
	u8  config_mon_type;
	u8  pad[1];
	u16 inflight_data;
	s32 *future_ptr;
};

struct sti_init_inptr {
	s32 text_planes;
	struct sti_init_inptr_ext *ext_ptr;
};

struct sti_init_outptr {
	s32 errno;
	s32 text_planes;
	s32 *future_ptr;
};

struct sti_conf_flags {
	u32 wait : 1;
	u32 pad : 31;
	s32 *future_ptr;
};

struct sti_conf_inptr {
	s32 *future_ptr;
};

struct sti_conf_outptr_ext {
	u32 crt_config[3];
	u32 crt_hdw[3];
	s32 *future_ptr;
};

struct sti_conf_outptr {
	s32 errno;
	s16 onscreen_x;
	s16 onscreen_y;
	s16 offscreen_x;
	s16 offscreen_y;
	s16 total_x;
	s16 total_y;
	s32 bits_per_pixel;
	s32 bits_used;
	s32 planes;
	 u8 dev_name[STI_DEV_NAME_LENGTH];
	u32 attributes;
	struct sti_conf_outptr_ext *ext_ptr;
};


struct sti_font_inptr {
	u32 font_start_addr;
	s16 index;
	u8 fg_color;
	u8 bg_color;
	s16 dest_x;
	s16 dest_y;
	s32 *future_ptr;
};

struct sti_font_flags {
	u32 wait : 1;
	u32 non_text : 1;
	u32 pad : 30;

	s32 *future_ptr;
};
	
struct sti_font_outptr {
	s32 errno;
	s32 *future_ptr;
};

struct sti_blkmv_flags {
	u32 wait : 1;
	u32 color : 1;
	u32 clear : 1;
	u32 non_text : 1;
	u32 pad : 28;
	s32 *future_ptr;
};

struct sti_blkmv_inptr {
	u8 fg_color;
	u8 bg_color;
	s16 src_x;
	s16 src_y;
	s16 dest_x;
	s16 dest_y;
	s16 width;
	s16 height;
	s32 *future_ptr;
};

struct sti_blkmv_outptr {
	s32 errno;
	s32 *future_ptr;
};

struct sti_struct {
	spinlock_t lock;

	struct sti_cooked_rom *rom;

	unsigned long font_unpmv;
	unsigned long block_move;
	unsigned long init_graph;
	unsigned long inq_conf;

	struct sti_glob_cfg *glob_cfg;
	struct sti_rom_font *font;

	s32 text_planes;

	char **mon_strings;
	u32 *regions;
	 u8 *pci_regions;
};

#define STI_CALL(func, flags, inptr, outptr, glob_cfg) \
	({	 						\
		real32_call( func, (unsigned long)STI_PTR(flags), \
				    STI_PTR(inptr), STI_PTR(outptr), \
				    glob_cfg); \
	})