xref: /OK3568_Linux_fs/kernel/drivers/video/fbdev/sticore.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun #ifndef STICORE_H
3*4882a593Smuzhiyun #define STICORE_H
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun /* generic STI structures & functions */
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #define MAX_STI_ROMS 4		/* max no. of ROMs which this driver handles */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #define STI_REGION_MAX 8	/* hardcoded STI constants */
10*4882a593Smuzhiyun #define STI_DEV_NAME_LENGTH 32
11*4882a593Smuzhiyun #define STI_MONITOR_MAX 256
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun #define STI_FONT_HPROMAN8 1
14*4882a593Smuzhiyun #define STI_FONT_KANA8 2
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun #define ALT_CODE_TYPE_UNKNOWN 0x00	/* alt code type values */
17*4882a593Smuzhiyun #define ALT_CODE_TYPE_PA_RISC_64 0x01
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun /* The latency of the STI functions cannot really be reduced by setting
20*4882a593Smuzhiyun  * this to 0;  STI doesn't seem to be designed to allow calling a different
21*4882a593Smuzhiyun  * function (or the same function with different arguments) after a
22*4882a593Smuzhiyun  * function exited with 1 as return value.
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  * As all of the functions below could be called from interrupt context,
25*4882a593Smuzhiyun  * we have to spin_lock_irqsave around the do { ret = bla(); } while(ret==1)
26*4882a593Smuzhiyun  * block.  Really bad latency there.
27*4882a593Smuzhiyun  *
28*4882a593Smuzhiyun  * Probably the best solution to all this is have the generic code manage
29*4882a593Smuzhiyun  * the screen buffer and a kernel thread to call STI occasionally.
30*4882a593Smuzhiyun  *
31*4882a593Smuzhiyun  * Luckily, the frame buffer guys have the same problem so we can just wait
32*4882a593Smuzhiyun  * for them to fix it and steal their solution.   prumpf
33*4882a593Smuzhiyun  */
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #include <asm/io.h>
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun #define STI_WAIT 1
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun #define STI_PTR(p)	( virt_to_phys(p) )
40*4882a593Smuzhiyun #define PTR_STI(p)	( phys_to_virt((unsigned long)p) )
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun #define sti_onscreen_x(sti) (sti->glob_cfg->onscreen_x)
43*4882a593Smuzhiyun #define sti_onscreen_y(sti) (sti->glob_cfg->onscreen_y)
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun /* sti_font_xy() use the native font ROM ! */
46*4882a593Smuzhiyun #define sti_font_x(sti) (PTR_STI(sti->font)->width)
47*4882a593Smuzhiyun #define sti_font_y(sti) (PTR_STI(sti->font)->height)
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun #ifdef CONFIG_64BIT
50*4882a593Smuzhiyun #define STI_LOWMEM	(GFP_KERNEL | GFP_DMA)
51*4882a593Smuzhiyun #else
52*4882a593Smuzhiyun #define STI_LOWMEM	(GFP_KERNEL)
53*4882a593Smuzhiyun #endif
54*4882a593Smuzhiyun 
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun /* STI function configuration structs */
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun typedef union region {
59*4882a593Smuzhiyun 	struct {
60*4882a593Smuzhiyun 		u32 offset	: 14;	/* offset in 4kbyte page */
61*4882a593Smuzhiyun 		u32 sys_only	: 1;	/* don't map to user space */
62*4882a593Smuzhiyun 		u32 cache	: 1;	/* map to data cache */
63*4882a593Smuzhiyun 		u32 btlb	: 1;	/* map to block tlb */
64*4882a593Smuzhiyun 		u32 last	: 1;	/* last region in list */
65*4882a593Smuzhiyun 		u32 length	: 14;	/* length in 4kbyte page */
66*4882a593Smuzhiyun 	} region_desc;
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun 	u32 region;			/* complete region value */
69*4882a593Smuzhiyun } region_t;
70*4882a593Smuzhiyun 
71*4882a593Smuzhiyun #define REGION_OFFSET_TO_PHYS( rt, hpa ) \
72*4882a593Smuzhiyun 	(((rt).region_desc.offset << 12) + (hpa))
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun struct sti_glob_cfg_ext {
75*4882a593Smuzhiyun 	 u8 curr_mon;			/* current monitor configured */
76*4882a593Smuzhiyun 	 u8 friendly_boot;		/* in friendly boot mode */
77*4882a593Smuzhiyun 	s16 power;			/* power calculation (in Watts) */
78*4882a593Smuzhiyun 	s32 freq_ref;			/* frequency reference */
79*4882a593Smuzhiyun 	u32 sti_mem_addr;		/* pointer to global sti memory (size=sti_mem_request) */
80*4882a593Smuzhiyun 	u32 future_ptr; 		/* pointer to future data */
81*4882a593Smuzhiyun };
82*4882a593Smuzhiyun 
83*4882a593Smuzhiyun struct sti_glob_cfg {
84*4882a593Smuzhiyun 	s32 text_planes;		/* number of planes used for text */
85*4882a593Smuzhiyun 	s16 onscreen_x;			/* screen width in pixels */
86*4882a593Smuzhiyun 	s16 onscreen_y;			/* screen height in pixels */
87*4882a593Smuzhiyun 	s16 offscreen_x;		/* offset width in pixels */
88*4882a593Smuzhiyun 	s16 offscreen_y;		/* offset height in pixels */
89*4882a593Smuzhiyun 	s16 total_x;			/* frame buffer width in pixels */
90*4882a593Smuzhiyun 	s16 total_y;			/* frame buffer height in pixels */
91*4882a593Smuzhiyun 	u32 region_ptrs[STI_REGION_MAX]; /* region pointers */
92*4882a593Smuzhiyun 	s32 reent_lvl;			/* storage for reentry level value */
93*4882a593Smuzhiyun 	u32 save_addr;			/* where to save or restore reentrant state */
94*4882a593Smuzhiyun 	u32 ext_ptr;			/* pointer to extended glob_cfg data structure */
95*4882a593Smuzhiyun };
96*4882a593Smuzhiyun 
97*4882a593Smuzhiyun 
98*4882a593Smuzhiyun /* STI init function structs */
99*4882a593Smuzhiyun 
100*4882a593Smuzhiyun struct sti_init_flags {
101*4882a593Smuzhiyun 	u32 wait : 1;		/* should routine idle wait or not */
102*4882a593Smuzhiyun 	u32 reset : 1;		/* hard reset the device? */
103*4882a593Smuzhiyun 	u32 text : 1;		/* turn on text display planes? */
104*4882a593Smuzhiyun 	u32 nontext : 1;	/* turn on non-text display planes? */
105*4882a593Smuzhiyun 	u32 clear : 1;		/* clear text display planes? */
106*4882a593Smuzhiyun 	u32 cmap_blk : 1;	/* non-text planes cmap black? */
107*4882a593Smuzhiyun 	u32 enable_be_timer : 1; /* enable bus error timer */
108*4882a593Smuzhiyun 	u32 enable_be_int : 1;	/* enable bus error timer interrupt */
109*4882a593Smuzhiyun 	u32 no_chg_tx : 1;	/* don't change text settings */
110*4882a593Smuzhiyun 	u32 no_chg_ntx : 1;	/* don't change non-text settings */
111*4882a593Smuzhiyun 	u32 no_chg_bet : 1;	/* don't change berr timer settings */
112*4882a593Smuzhiyun 	u32 no_chg_bei : 1;	/* don't change berr int settings */
113*4882a593Smuzhiyun 	u32 init_cmap_tx : 1;	/* initialize cmap for text planes */
114*4882a593Smuzhiyun 	u32 cmt_chg : 1;	/* change current monitor type */
115*4882a593Smuzhiyun 	u32 retain_ie : 1;	/* don't allow reset to clear int enables */
116*4882a593Smuzhiyun 	u32 caller_bootrom : 1;	/* set only by bootrom for each call */
117*4882a593Smuzhiyun 	u32 caller_kernel : 1;	/* set only by kernel for each call */
118*4882a593Smuzhiyun 	u32 caller_other : 1;	/* set only by non-[BR/K] caller */
119*4882a593Smuzhiyun 	u32 pad	: 14;		/* pad to word boundary */
120*4882a593Smuzhiyun 	u32 future_ptr; 	/* pointer to future data */
121*4882a593Smuzhiyun };
122*4882a593Smuzhiyun 
123*4882a593Smuzhiyun struct sti_init_inptr_ext {
124*4882a593Smuzhiyun 	u8  config_mon_type;	/* configure to monitor type */
125*4882a593Smuzhiyun 	u8  pad[1];		/* pad to word boundary */
126*4882a593Smuzhiyun 	u16 inflight_data;	/* inflight data possible on PCI */
127*4882a593Smuzhiyun 	u32 future_ptr; 	/* pointer to future data */
128*4882a593Smuzhiyun };
129*4882a593Smuzhiyun 
130*4882a593Smuzhiyun struct sti_init_inptr {
131*4882a593Smuzhiyun 	s32 text_planes;	/* number of planes to use for text */
132*4882a593Smuzhiyun 	u32 ext_ptr;		/* pointer to extended init_graph inptr data structure*/
133*4882a593Smuzhiyun };
134*4882a593Smuzhiyun 
135*4882a593Smuzhiyun 
136*4882a593Smuzhiyun struct sti_init_outptr {
137*4882a593Smuzhiyun 	s32 errno;		/* error number on failure */
138*4882a593Smuzhiyun 	s32 text_planes;	/* number of planes used for text */
139*4882a593Smuzhiyun 	u32 future_ptr; 	/* pointer to future data */
140*4882a593Smuzhiyun };
141*4882a593Smuzhiyun 
142*4882a593Smuzhiyun 
143*4882a593Smuzhiyun 
144*4882a593Smuzhiyun /* STI configuration function structs */
145*4882a593Smuzhiyun 
146*4882a593Smuzhiyun struct sti_conf_flags {
147*4882a593Smuzhiyun 	u32 wait : 1;		/* should routine idle wait or not */
148*4882a593Smuzhiyun 	u32 pad : 31;		/* pad to word boundary */
149*4882a593Smuzhiyun 	u32 future_ptr; 	/* pointer to future data */
150*4882a593Smuzhiyun };
151*4882a593Smuzhiyun 
152*4882a593Smuzhiyun struct sti_conf_inptr {
153*4882a593Smuzhiyun 	u32 future_ptr; 	/* pointer to future data */
154*4882a593Smuzhiyun };
155*4882a593Smuzhiyun 
156*4882a593Smuzhiyun struct sti_conf_outptr_ext {
157*4882a593Smuzhiyun 	u32 crt_config[3];	/* hardware specific X11/OGL information */
158*4882a593Smuzhiyun 	u32 crt_hdw[3];
159*4882a593Smuzhiyun 	u32 future_ptr;
160*4882a593Smuzhiyun };
161*4882a593Smuzhiyun 
162*4882a593Smuzhiyun struct sti_conf_outptr {
163*4882a593Smuzhiyun 	s32 errno;		/* error number on failure */
164*4882a593Smuzhiyun 	s16 onscreen_x;		/* screen width in pixels */
165*4882a593Smuzhiyun 	s16 onscreen_y;		/* screen height in pixels */
166*4882a593Smuzhiyun 	s16 offscreen_x;	/* offscreen width in pixels */
167*4882a593Smuzhiyun 	s16 offscreen_y;	/* offscreen height in pixels */
168*4882a593Smuzhiyun 	s16 total_x;		/* frame buffer width in pixels */
169*4882a593Smuzhiyun 	s16 total_y;		/* frame buffer height in pixels */
170*4882a593Smuzhiyun 	s32 bits_per_pixel;	/* bits/pixel device has configured */
171*4882a593Smuzhiyun 	s32 bits_used;		/* bits which can be accessed */
172*4882a593Smuzhiyun 	s32 planes;		/* number of fb planes in system */
173*4882a593Smuzhiyun 	 u8 dev_name[STI_DEV_NAME_LENGTH]; /* null terminated product name */
174*4882a593Smuzhiyun 	u32 attributes;		/* flags denoting attributes */
175*4882a593Smuzhiyun 	u32 ext_ptr;		/* pointer to future data */
176*4882a593Smuzhiyun };
177*4882a593Smuzhiyun 
178*4882a593Smuzhiyun struct sti_rom {
179*4882a593Smuzhiyun 	 u8 type[4];
180*4882a593Smuzhiyun 	 u8 res004;
181*4882a593Smuzhiyun 	 u8 num_mons;
182*4882a593Smuzhiyun 	 u8 revno[2];
183*4882a593Smuzhiyun 	u32 graphics_id[2];
184*4882a593Smuzhiyun 
185*4882a593Smuzhiyun 	u32 font_start;
186*4882a593Smuzhiyun 	u32 statesize;
187*4882a593Smuzhiyun 	u32 last_addr;
188*4882a593Smuzhiyun 	u32 region_list;
189*4882a593Smuzhiyun 
190*4882a593Smuzhiyun 	u16 reentsize;
191*4882a593Smuzhiyun 	u16 maxtime;
192*4882a593Smuzhiyun 	u32 mon_tbl_addr;
193*4882a593Smuzhiyun 	u32 user_data_addr;
194*4882a593Smuzhiyun 	u32 sti_mem_req;
195*4882a593Smuzhiyun 
196*4882a593Smuzhiyun 	u32 user_data_size;
197*4882a593Smuzhiyun 	u16 power;
198*4882a593Smuzhiyun 	 u8 bus_support;
199*4882a593Smuzhiyun 	 u8 ext_bus_support;
200*4882a593Smuzhiyun 	 u8 alt_code_type;
201*4882a593Smuzhiyun 	 u8 ext_dd_struct[3];
202*4882a593Smuzhiyun 	u32 cfb_addr;
203*4882a593Smuzhiyun 
204*4882a593Smuzhiyun 	u32 init_graph;
205*4882a593Smuzhiyun 	u32 state_mgmt;
206*4882a593Smuzhiyun 	u32 font_unpmv;
207*4882a593Smuzhiyun 	u32 block_move;
208*4882a593Smuzhiyun 	u32 self_test;
209*4882a593Smuzhiyun 	u32 excep_hdlr;
210*4882a593Smuzhiyun 	u32 inq_conf;
211*4882a593Smuzhiyun 	u32 set_cm_entry;
212*4882a593Smuzhiyun 	u32 dma_ctrl;
213*4882a593Smuzhiyun 	 u8 res040[7 * 4];
214*4882a593Smuzhiyun 
215*4882a593Smuzhiyun 	u32 init_graph_addr;
216*4882a593Smuzhiyun 	u32 state_mgmt_addr;
217*4882a593Smuzhiyun 	u32 font_unp_addr;
218*4882a593Smuzhiyun 	u32 block_move_addr;
219*4882a593Smuzhiyun 	u32 self_test_addr;
220*4882a593Smuzhiyun 	u32 excep_hdlr_addr;
221*4882a593Smuzhiyun 	u32 inq_conf_addr;
222*4882a593Smuzhiyun 	u32 set_cm_entry_addr;
223*4882a593Smuzhiyun 	u32 image_unpack_addr;
224*4882a593Smuzhiyun 	u32 pa_risx_addrs[7];
225*4882a593Smuzhiyun };
226*4882a593Smuzhiyun 
227*4882a593Smuzhiyun struct sti_rom_font {
228*4882a593Smuzhiyun 	u16 first_char;
229*4882a593Smuzhiyun 	u16 last_char;
230*4882a593Smuzhiyun 	 u8 width;
231*4882a593Smuzhiyun 	 u8 height;
232*4882a593Smuzhiyun 	 u8 font_type;		/* language type */
233*4882a593Smuzhiyun 	 u8 bytes_per_char;
234*4882a593Smuzhiyun 	u32 next_font;
235*4882a593Smuzhiyun 	 u8 underline_height;
236*4882a593Smuzhiyun 	 u8 underline_pos;
237*4882a593Smuzhiyun 	 u8 res008[2];
238*4882a593Smuzhiyun };
239*4882a593Smuzhiyun 
240*4882a593Smuzhiyun /* sticore internal font handling */
241*4882a593Smuzhiyun 
242*4882a593Smuzhiyun struct sti_cooked_font {
243*4882a593Smuzhiyun 	struct sti_rom_font *raw;	/* native ptr for STI functions */
244*4882a593Smuzhiyun 	void *raw_ptr;			/* kmalloc'ed font data */
245*4882a593Smuzhiyun 	struct sti_cooked_font *next_font;
246*4882a593Smuzhiyun 	int height, width;
247*4882a593Smuzhiyun 	int refcount;
248*4882a593Smuzhiyun 	u32 crc;
249*4882a593Smuzhiyun };
250*4882a593Smuzhiyun 
251*4882a593Smuzhiyun struct sti_cooked_rom {
252*4882a593Smuzhiyun         struct sti_rom *raw;
253*4882a593Smuzhiyun 	struct sti_cooked_font *font_start;
254*4882a593Smuzhiyun };
255*4882a593Smuzhiyun 
256*4882a593Smuzhiyun /* STI font printing function structs */
257*4882a593Smuzhiyun 
258*4882a593Smuzhiyun struct sti_font_inptr {
259*4882a593Smuzhiyun 	u32 font_start_addr;	/* address of font start */
260*4882a593Smuzhiyun 	s16 index;		/* index into font table of character */
261*4882a593Smuzhiyun 	u8 fg_color;		/* foreground color of character */
262*4882a593Smuzhiyun 	u8 bg_color;		/* background color of character */
263*4882a593Smuzhiyun 	s16 dest_x;		/* X location of character upper left */
264*4882a593Smuzhiyun 	s16 dest_y;		/* Y location of character upper left */
265*4882a593Smuzhiyun 	u32 future_ptr; 	/* pointer to future data */
266*4882a593Smuzhiyun };
267*4882a593Smuzhiyun 
268*4882a593Smuzhiyun struct sti_font_flags {
269*4882a593Smuzhiyun 	u32 wait : 1;		/* should routine idle wait or not */
270*4882a593Smuzhiyun 	u32 non_text : 1;	/* font unpack/move in non_text planes =1, text =0 */
271*4882a593Smuzhiyun 	u32 pad : 30;		/* pad to word boundary */
272*4882a593Smuzhiyun 	u32 future_ptr; 	/* pointer to future data */
273*4882a593Smuzhiyun };
274*4882a593Smuzhiyun 
275*4882a593Smuzhiyun struct sti_font_outptr {
276*4882a593Smuzhiyun 	s32 errno;		/* error number on failure */
277*4882a593Smuzhiyun 	u32 future_ptr; 	/* pointer to future data */
278*4882a593Smuzhiyun };
279*4882a593Smuzhiyun 
280*4882a593Smuzhiyun /* STI blockmove structs */
281*4882a593Smuzhiyun 
282*4882a593Smuzhiyun struct sti_blkmv_flags {
283*4882a593Smuzhiyun 	u32 wait : 1;		/* should routine idle wait or not */
284*4882a593Smuzhiyun 	u32 color : 1;		/* change color during move? */
285*4882a593Smuzhiyun 	u32 clear : 1;		/* clear during move? */
286*4882a593Smuzhiyun 	u32 non_text : 1;	/* block move in non_text planes =1, text =0 */
287*4882a593Smuzhiyun 	u32 pad : 28;		/* pad to word boundary */
288*4882a593Smuzhiyun 	u32 future_ptr; 	/* pointer to future data */
289*4882a593Smuzhiyun };
290*4882a593Smuzhiyun 
291*4882a593Smuzhiyun struct sti_blkmv_inptr {
292*4882a593Smuzhiyun 	u8 fg_color;		/* foreground color after move */
293*4882a593Smuzhiyun 	u8 bg_color;		/* background color after move */
294*4882a593Smuzhiyun 	s16 src_x;		/* source upper left pixel x location */
295*4882a593Smuzhiyun 	s16 src_y;		/* source upper left pixel y location */
296*4882a593Smuzhiyun 	s16 dest_x;		/* dest upper left pixel x location */
297*4882a593Smuzhiyun 	s16 dest_y;		/* dest upper left pixel y location */
298*4882a593Smuzhiyun 	s16 width;		/* block width in pixels */
299*4882a593Smuzhiyun 	s16 height;		/* block height in pixels */
300*4882a593Smuzhiyun 	u32 future_ptr; 	/* pointer to future data */
301*4882a593Smuzhiyun };
302*4882a593Smuzhiyun 
303*4882a593Smuzhiyun struct sti_blkmv_outptr {
304*4882a593Smuzhiyun 	s32 errno;		/* error number on failure */
305*4882a593Smuzhiyun 	u32 future_ptr; 	/* pointer to future data */
306*4882a593Smuzhiyun };
307*4882a593Smuzhiyun 
308*4882a593Smuzhiyun 
309*4882a593Smuzhiyun /* sti_all_data is an internal struct which needs to be allocated in
310*4882a593Smuzhiyun  * low memory (< 4GB) if STI is used with 32bit STI on a 64bit kernel */
311*4882a593Smuzhiyun 
312*4882a593Smuzhiyun struct sti_all_data {
313*4882a593Smuzhiyun 	struct sti_glob_cfg glob_cfg;
314*4882a593Smuzhiyun 	struct sti_glob_cfg_ext glob_cfg_ext;
315*4882a593Smuzhiyun 
316*4882a593Smuzhiyun 	struct sti_conf_inptr		inq_inptr;
317*4882a593Smuzhiyun 	struct sti_conf_outptr		inq_outptr; /* configuration */
318*4882a593Smuzhiyun 	struct sti_conf_outptr_ext	inq_outptr_ext;
319*4882a593Smuzhiyun 
320*4882a593Smuzhiyun 	struct sti_init_inptr_ext	init_inptr_ext;
321*4882a593Smuzhiyun 	struct sti_init_inptr		init_inptr;
322*4882a593Smuzhiyun 	struct sti_init_outptr		init_outptr;
323*4882a593Smuzhiyun 
324*4882a593Smuzhiyun 	struct sti_blkmv_inptr		blkmv_inptr;
325*4882a593Smuzhiyun 	struct sti_blkmv_outptr		blkmv_outptr;
326*4882a593Smuzhiyun 
327*4882a593Smuzhiyun 	struct sti_font_inptr		font_inptr;
328*4882a593Smuzhiyun 	struct sti_font_outptr		font_outptr;
329*4882a593Smuzhiyun 
330*4882a593Smuzhiyun 	/* leave as last entries */
331*4882a593Smuzhiyun 	unsigned long save_addr[1024 / sizeof(unsigned long)];
332*4882a593Smuzhiyun 	   /* min 256 bytes which is STI default, max sti->sti_mem_request */
333*4882a593Smuzhiyun 	unsigned long sti_mem_addr[256 / sizeof(unsigned long)];
334*4882a593Smuzhiyun 	/* do not add something below here ! */
335*4882a593Smuzhiyun };
336*4882a593Smuzhiyun 
337*4882a593Smuzhiyun /* internal generic STI struct */
338*4882a593Smuzhiyun 
339*4882a593Smuzhiyun struct sti_struct {
340*4882a593Smuzhiyun 	spinlock_t lock;
341*4882a593Smuzhiyun 
342*4882a593Smuzhiyun 	/* char **mon_strings; */
343*4882a593Smuzhiyun 	int sti_mem_request;
344*4882a593Smuzhiyun 	u32 graphics_id[2];
345*4882a593Smuzhiyun 
346*4882a593Smuzhiyun 	struct sti_cooked_rom *rom;
347*4882a593Smuzhiyun 
348*4882a593Smuzhiyun 	unsigned long font_unpmv;
349*4882a593Smuzhiyun 	unsigned long block_move;
350*4882a593Smuzhiyun 	unsigned long init_graph;
351*4882a593Smuzhiyun 	unsigned long inq_conf;
352*4882a593Smuzhiyun 
353*4882a593Smuzhiyun 	/* all following fields are initialized by the generic routines */
354*4882a593Smuzhiyun 	int text_planes;
355*4882a593Smuzhiyun 	region_t regions[STI_REGION_MAX];
356*4882a593Smuzhiyun 	unsigned long regions_phys[STI_REGION_MAX];
357*4882a593Smuzhiyun 
358*4882a593Smuzhiyun 	struct sti_glob_cfg *glob_cfg;	/* points into sti_all_data */
359*4882a593Smuzhiyun 
360*4882a593Smuzhiyun 	int wordmode;
361*4882a593Smuzhiyun 	struct sti_cooked_font *font;	/* ptr to selected font (cooked) */
362*4882a593Smuzhiyun 
363*4882a593Smuzhiyun 	struct pci_dev *pd;
364*4882a593Smuzhiyun 
365*4882a593Smuzhiyun 	/* PCI data structures (pg. 17ff from sti.pdf) */
366*4882a593Smuzhiyun 	u8 rm_entry[16]; /* pci region mapper array == pci config space offset */
367*4882a593Smuzhiyun 
368*4882a593Smuzhiyun 	/* pointer to the fb_info where this STI device is used */
369*4882a593Smuzhiyun 	struct fb_info *info;
370*4882a593Smuzhiyun 
371*4882a593Smuzhiyun 	/* pointer to all internal data */
372*4882a593Smuzhiyun 	struct sti_all_data *sti_data;
373*4882a593Smuzhiyun };
374*4882a593Smuzhiyun 
375*4882a593Smuzhiyun 
376*4882a593Smuzhiyun /* sticore interface functions */
377*4882a593Smuzhiyun 
378*4882a593Smuzhiyun struct sti_struct *sti_get_rom(unsigned int index); /* 0: default sti */
379*4882a593Smuzhiyun void sti_font_convert_bytemode(struct sti_struct *sti, struct sti_cooked_font *f);
380*4882a593Smuzhiyun 
381*4882a593Smuzhiyun 
382*4882a593Smuzhiyun /* sticore main function to call STI firmware */
383*4882a593Smuzhiyun 
384*4882a593Smuzhiyun int sti_call(const struct sti_struct *sti, unsigned long func,
385*4882a593Smuzhiyun 		const void *flags, void *inptr, void *outptr,
386*4882a593Smuzhiyun 		struct sti_glob_cfg *glob_cfg);
387*4882a593Smuzhiyun 
388*4882a593Smuzhiyun 
389*4882a593Smuzhiyun /* functions to call the STI ROM directly */
390*4882a593Smuzhiyun 
391*4882a593Smuzhiyun void sti_putc(struct sti_struct *sti, int c, int y, int x,
392*4882a593Smuzhiyun 		struct sti_cooked_font *font);
393*4882a593Smuzhiyun void sti_set(struct sti_struct *sti, int src_y, int src_x,
394*4882a593Smuzhiyun 		int height, int width, u8 color);
395*4882a593Smuzhiyun void sti_clear(struct sti_struct *sti, int src_y, int src_x,
396*4882a593Smuzhiyun 		int height, int width, int c, struct sti_cooked_font *font);
397*4882a593Smuzhiyun void sti_bmove(struct sti_struct *sti, int src_y, int src_x,
398*4882a593Smuzhiyun 		int dst_y, int dst_x, int height, int width,
399*4882a593Smuzhiyun 		struct sti_cooked_font *font);
400*4882a593Smuzhiyun 
401*4882a593Smuzhiyun #endif	/* STICORE_H */
402