xref: /openbsd/sys/dev/ic/stireg.h (revision 264ca280)
1 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
2 
3 /*
4  * Copyright (c) 2000 Michael Shalayeff
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
20  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
25  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26  * THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef _IC_STIREG_H_
30 #define _IC_STIREG_H_
31 
32 /* #define	STIDEBUG */
33 
34 #define	STI_REGION_MAX	8
35 #define	STI_MONITOR_MAX	256
36 #define	STI_DEVNAME_LEN	32
37 #define	STI_NCMAP	256
38 
39 /* code ROM definitions */
40 #define	STI_BEGIN	0
41 #define	STI_INIT_GRAPH	0
42 #define	STI_STATE_MGMT	1
43 #define	STI_FONT_UNPMV	2
44 #define	STI_BLOCK_MOVE	3
45 #define	STI_SELF_TEST	4
46 #define	STI_EXCEP_HDLR	5
47 #define	STI_INQ_CONF	6
48 #define	STI_SCM_ENT	7
49 #define	STI_DMA_CTRL	8
50 #define	STI_FLOW_CTRL	9
51 #define	STI_UTIMING	10
52 #define	STI_PROC_MGR	11
53 #define	STI_UTIL	12
54 #define	STI_END		13
55 #define	STI_CODECNT	16
56 
57 #define	STI_CODEBASE_MAIN	0x40
58 #define	STI_CODEBASE_ALT	0x80
59 
60 #define	STI_CODEBASE_PA		STI_CODEBASE_MAIN
61 #define	STI_CODEBASE_M68K	STI_CODEBASE_ALT
62 #define	STI_CODEBASE_PA64	STI_CODEBASE_ALT
63 
64 /* sti returns */
65 #define	STI_OK		0
66 #define	STI_FAIL	-1
67 #define	STI_NRDY	1
68 
69 /* sti errno */
70 #define	STI_NOERRNO		0	/* no error */
71 #define	STI_BADREENTLVL		1	/* bad reentry level */
72 #define	STI_NOREGIONSDEF	2	/* region table is not setup */
73 #define	STI_ILLNPLANES		3	/* invalid num of text planes */
74 #define	STI_ILLINDEX		4	/* invalid font index */
75 #define	STI_ILLLOC		5	/* invalid font location */
76 #define	STI_ILLCOLOUR		6	/* invalid colour */
77 #define	STI_ILLBLKMVFROM	7	/* invalid from in blkmv */
78 #define	STI_ILLBLKMVTO		8	/* invalid to in blkmv */
79 #define	STI_ILLBLKMVSIZE	9	/* invalid size in blkmv */
80 #define	STI_BEIUNSUPP		10	/* bus error ints unsupported */
81 #define	STI_UNXPBE		11	/* unexpected bus error */
82 #define	STI_UNXHWF		12	/* unexpected hardware failure */
83 #define	STI_NEGCFG		13	/* no ext global config struct */
84 #define	STI_NEIG		14	/* no ext init struct */
85 #define	STI_ILLSCME		15	/* invalid set cmap entry */
86 #define	STI_ILLCMVAL		16	/* invalid cmap value */
87 #define	STI_NORESMEM		17	/* no requested global memory */
88 #define	STI_RESMEMCORR		18	/* reserved memory corrupted */
89 #define	STI_ILLNTBLKMV		19	/* invalid non-text blkmv */
90 #define	STI_ILLMONITOR		20	/* monitor selection is out of range */
91 #define	STI_ILLEXCADDR		21	/* invalid excpt handler addr */
92 #define	STI_ILLEXCFLAGS		22	/* invalid excpt handler flags */
93 #define	STI_NOEHE		23	/* no ext exhdl struct */
94 #define	STI_NOINQCE		24	/* no ext inq cfg struct */
95 #define	STI_ILLRGNPTR		25	/* invalid region pointer */
96 #define	STI_ILLUTLOP		26	/* invalid util opcode */
97 #define	STI_UNKNOWN		250	/* unknown error */
98 #define	STI_NOCFGPTR		251	/* no config ptr defined */
99 #define	STI_NOFLPTR		252	/* no flag ptr defined */
100 #define	STI_NOINPTR		253	/* no in ptr defined */
101 #define	STI_NOOUTPTR		254	/* no way you can get it */
102 #define	STI_NOLOCK		255	/* kernel dishonour graphics lock */
103 
104 /* colours */
105 #define	STI_COLOUR_BLACK	0
106 #define	STI_COLOUR_WHITE	1
107 #define	STI_COLOUR_RED		2
108 #define	STI_COLOUR_YELLOW	3
109 #define	STI_COLOUR_GREEN	4
110 #define	STI_COLOUR_CYAN		5
111 #define	STI_COLOUR_BLUE		6
112 #define	STI_COLOUR_MAGENTA	7
113 
114 	/* LSB high */
115 struct	sti_dd {
116 	u_int32_t	dd_type;	/* 0x00 device type */
117 #define	STI_DEVTYPE1	1
118 #define	STI_DEVTYPE4	3
119 	u_int8_t	dd_unused;
120 	u_int8_t	dd_nmon;	/* 0x05 number monitor rates */
121 	u_int8_t	dd_grrev;	/* 0x06 global rom revision */
122 	u_int8_t	dd_lrrev;	/* 0x07 local rom revision */
123 	u_int32_t	dd_grid[2];	/* 0x08 graphics id */
124 #define	STI_DD_CRX		0x26D1482A	/* single-head CRX */
125 #define	STI_DD_GRX		0x26D1488C	/* gray-scale GRX */
126 #define	STI_DD_CRX24		0x26D148EE	/* CRX+ */
127 #define	STI_DD_EVRX		0x27134C9F	/* 425e on-board */
128 #define	STI_DD_3X2V		0x27134CB4	/* 382 on-board */
129 #define	STI_DD_TIMBER		0x27F12392	/* on-board 710, older 715 */
130 #define	STI_DD_DUAL_CRX		0x27FCCB6D	/* dual-head CRX */
131 #define	STI_DD_ARTIST		0x2B4DED6D	/* on-board 712/715, also GSC */
132 #define	STI_DD_HCRX		0x2BCB015A
133 #define	STI_DD_EG		0x2D08C0A7	/* Visualize EG */
134 #define	STI_DD_SUMMIT		0x2FC1066B	/* Visualize FX2, FX4, FX6 */
135 #define	STI_DD_PINNACLE		0x35ACDA16	/* Visualize FXe */
136 #define	STI_DD_LEGO		0x35ACDA30	/* Visualize FX5, FX10 */
137 	u_int32_t	dd_fntaddr;	/* 0x10 font start address */
138 	u_int32_t	dd_maxst;	/* 0x14 max state storage */
139 	u_int32_t	dd_romend;	/* 0x18 rom last address */
140 	u_int32_t	dd_reglst;	/* 0x1c device region list */
141 	u_int16_t	dd_maxreent;	/* 0x20 max reent storage */
142 	u_int16_t	dd_maxtimo;	/* 0x22 max execution timeout .1 sec */
143 	u_int32_t	dd_montbl;	/* 0x24 monitor table address */
144 	u_int32_t	dd_udaddr;	/* 0x28 user data address */
145 	u_int32_t	dd_stimemreq;	/* 0x2c sti memory request */
146 	u_int32_t	dd_udsize;	/* 0x30 user data size */
147 	u_int16_t	dd_pwruse;	/* 0x34 power usage */
148 	u_int8_t	dd_bussup;	/* 0x36 bus support */
149 #define	STI_BUSSUPPORT_GSCINTL	0x01	/*	supports pulling INTL for int */
150 #define	STI_BUSSUPPORT_GSC15X	0x02	/*	supports GSC 1.5X */
151 #define	STI_BUSSUPPORT_GSC2X	0x04	/*	supports GSC 2.X */
152 #define	STI_BUSSUPPORT_PCIIOEIM	0x08	/*	will use directed int */
153 #define	STI_BUSSUPPORT_PCISTD	0x10	/*	will use std PCI int */
154 #define	STI_BUSSUPPORT_ILOCK	0x20	/*	supports implicit locking */
155 #define	STI_BUSSUPPORT_ROMMAP	0x40	/*	rom is only in pci erom space */
156 #define	STI_BUSSUPPORT_2DECODE	0x80	/*	single address decoder */
157 	u_int8_t	dd_ebussup;	/* 0x37 extended bus support */
158 #define	STI_EBUSSUPPORT_DMA	0x01	/*	supports dma */
159 #define	STI_EBUSSUPPORT_PIOLOCK	0x02	/*	no implicit locking for dma */
160 	u_int8_t	dd_altcodet;	/* 0x38 alternate code type */
161 #define	STI_ALTCODE_UNKNOWN	0x00
162 #define	STI_ALTCODE_PA64	0x01	/*	alt code is in pa64 */
163 	u_int8_t	dd_eddst[3];	/* 0x39 extended DD struct */
164 	u_int32_t	dd_cfbaddr;	/* 0x3c CFB address, location of
165 						X11 driver to be used for
166 						servers w/o accel */
167 	u_int32_t	dd_pacode[16];	/* 0x40 routines for pa-risc */
168 	u_int32_t	dd_altcode[16];	/* 0x80 routines for m68k/i386 */
169 } __packed;
170 
171 #define	STI_REVISION(maj, min)	(((maj) << 4) | ((min) & 0x0f))
172 
173 /* after the last region there is one indirect list ptr */
174 struct sti_region {
175 	u_int	offset  :14;	/* page offset dev io space relative */
176 	u_int	sys_only: 1;	/* whether allow user access */
177 	u_int	cache   : 1;	/* map in cache */
178 	u_int	btlb    : 1;	/* should use BTLB if available */
179 	u_int	last    : 1;	/* last region in the list */
180 	u_int	length  :14;	/* size in pages */
181 }  __packed;
182 
183 struct sti_font {
184 	u_int16_t	first;
185 	u_int16_t	last;
186 	u_int8_t	width;
187 	u_int8_t	height;
188 	u_int8_t	type;
189 #define	STI_FONT_HPROMAN8	1
190 #define	STI_FONT_KANA8		2
191 	u_int8_t	bpc;
192 	u_int32_t	next;
193 	u_int8_t	uheight;
194 	u_int8_t	uoffset;
195 	u_int8_t	unused[2];
196 }  __packed;
197 
198 struct sti_fontcfg {
199 	u_int16_t	first;
200 	u_int16_t	last;
201 	u_int8_t	width;
202 	u_int8_t	height;
203 	u_int8_t	type;
204 	u_int8_t	bpc;
205 	u_int8_t	uheight;
206 	u_int8_t	uoffset;
207 }  __packed;
208 
209 typedef struct sti_mon {
210 	u_int32_t	width: 12;
211 	u_int32_t	height: 12;
212 	u_int32_t	hz: 7;		/* low 7 bits of refresh rate */
213 	u_int32_t	flat: 1;	/* flatpanel */
214 	u_int32_t	vesa: 1;	/* vesa mode */
215 	u_int32_t	grey: 1;	/* greyscale */
216 	u_int32_t	dblbuf: 1;	/* double buffered */
217 	u_int32_t	user: 1;	/* user-defined mode */
218 	u_int32_t	stereo: 1;	/* stereo display */
219 	u_int32_t	sam: 1;		/* ? */
220 	u_int32_t	: 15;
221 	u_int32_t	hz_upper: 3;	/* upper 3 bits of refresh rate */
222 	u_int32_t	font: 8;	/* rom font index */
223 } __packed *sti_mon_t;
224 
225 typedef struct sti_ecfg {
226 	u_int8_t	current_monitor;
227 	u_int8_t	uf_boot;
228 	u_int16_t	power;		/* power dissipation Watts */
229 	u_int32_t	freq_ref;
230 	u_int32_t	*addr;		/* memory block of size dd_stimemreq */
231 	void		*future;
232 } __packed *sti_ecfg_t;
233 
234 typedef struct sti_cfg {
235 	u_int32_t	text_planes;
236 	u_int16_t	scr_width;
237 	u_int16_t	scr_height;
238 	u_int16_t	oscr_width;
239 	u_int16_t	oscr_height;
240 	u_int16_t	fb_width;
241 	u_int16_t	fb_height;
242 	u_int32_t	regions[STI_REGION_MAX];
243 	u_int32_t	reent_level;
244 	u_int32_t	*save_addr;
245 	sti_ecfg_t	ext_cfg;
246 }  __packed *sti_cfg_t;
247 
248 
249 /* routine types */
250 #define	STI_DEP(n) \
251 	typedef int (*sti_##n##_t)( \
252 	  sti_##n##flags_t, sti_##n##in_t, sti_##n##out_t, sti_cfg_t);
253 
254 typedef struct sti_initflags {
255 	u_int32_t	flags;
256 #define	STI_INITF_WAIT	0x80000000
257 #define	STI_INITF_RESET	0x40000000
258 #define	STI_INITF_TEXT	0x20000000
259 #define	STI_INITF_NTEXT	0x10000000
260 #define	STI_INITF_CLEAR	0x08000000
261 #define	STI_INITF_CMB	0x04000000	/* non-text planes cmap black */
262 #define	STI_INITF_EBET	0x02000000	/* enable bus error timer */
263 #define	STI_INITF_EBETI	0x01000000	/* enable bus error timer interrupt */
264 #define	STI_INITF_PTS	0x00800000	/* preserve text settings */
265 #define	STI_INITF_PNTS	0x00400000	/* preserve non-text settings */
266 #define	STI_INITF_PBET	0x00200000	/* preserve BET settings */
267 #define	STI_INITF_PBETI	0x00100000	/* preserve BETI settings */
268 #define	STI_INITF_ICMT	0x00080000	/* init cmap for text planes */
269 #define	STI_INITF_SCMT	0x00040000	/* change current monitor type */
270 #define	STI_INITF_RIE	0x00020000	/* retain int enables */
271 	void *future;
272 } __packed *sti_initflags_t;
273 
274 typedef struct sti_einitin {
275 	u_int8_t	mon_type;
276 	u_int8_t	pad;
277 	u_int16_t	inflight;	/* possible on pci */
278 	void		*future;
279 } __packed *sti_einitin_t;
280 
281 typedef struct sti_initin {
282 	u_int32_t	text_planes;	/* number of planes for text */
283 	sti_einitin_t	ext_in;
284 } __packed *sti_initin_t;
285 
286 typedef struct sti_initout {
287 	int32_t		errno;
288 	u_int32_t	text_planes;	/* number of planes used for text */
289 	void		*future;
290 } __packed *sti_initout_t;
291 
292 STI_DEP(init);
293 
294 typedef struct sti_mgmtflags {
295 	u_int32_t	flags;
296 #define	STI_MGMTF_WAIT	0x80000000
297 #define	STI_MGMTF_SAVE	0x40000000
298 #define	STI_MGMTF_RALL	0x20000000	/* restore all display planes */
299 	void *future;
300 } __packed *sti_mgmtflags_t;
301 
302 typedef struct sti_mgmtin {
303 	void	*addr;
304 	void	*future;
305 } __packed *sti_mgmtin_t;
306 
307 typedef struct sti_mgmtout {
308 	int32_t		errno;
309 	void		*future;
310 } __packed *sti_mgmtout_t;
311 
312 STI_DEP(mgmt);
313 
314 typedef struct sti_unpmvflags {
315 	u_int32_t	flags;
316 #define	STI_UNPMVF_WAIT	0x80000000
317 #define	STI_UNPMVF_NTXT	0x40000000	/* intp non-text planes */
318 	void		*future;
319 } __packed *sti_unpmvflags_t;
320 
321 typedef struct sti_unpmvin {
322 	u_int32_t	*font_addr;	/* font */
323 	u_int16_t	index;		/* character index in the font */
324 	u_int8_t	fg_colour;
325 	u_int8_t	bg_colour;
326 	u_int16_t	x, y;
327 	void		*future;
328 } __packed *sti_unpmvin_t;
329 
330 typedef struct sti_unpmvout {
331 	u_int32_t	errno;
332 	void		*future;
333 } __packed *sti_unpmvout_t;
334 
335 STI_DEP(unpmv);
336 
337 typedef struct sti_blkmvflags {
338 	u_int32_t	flags;
339 #define	STI_BLKMVF_WAIT	0x80000000
340 #define	STI_BLKMVF_COLR	0x40000000	/* change colour on move */
341 #define	STI_BLKMVF_CLR	0x20000000	/* clear on move */
342 #define	STI_BLKMVF_NTXT	0x10000000	/* move in non-text planes */
343 	void		*future;
344 } __packed *sti_blkmvflags_t;
345 
346 typedef struct sti_blkmvin {
347 	u_int8_t	fg_colour;
348 	u_int8_t	bg_colour;
349 	u_int16_t	srcx, srcy, dstx, dsty;
350 	u_int16_t	width, height;
351 	u_int16_t	pad;
352 	void		*future;
353 } __packed *sti_blkmvin_t;
354 
355 typedef struct sti_blkmvout {
356 	u_int32_t	errno;
357 	void		*future;
358 } __packed *sti_blkmvout_t;
359 
360 STI_DEP(blkmv);
361 
362 typedef struct sti_testflags {
363 	u_int32_t	flags;
364 #define	STI_TESTF_WAIT	0x80000000
365 #define	STI_TESTF_ETST	0x40000000
366 	void		*future;
367 } __packed *sti_testflags_t;
368 
369 typedef struct sti_testin {
370 	void		*future;
371 } __packed *sti_testin_t;
372 
373 typedef struct sti_testout {
374 	u_int32_t	errno;
375 	u_int32_t	result;
376 	void		*future;
377 } __packed *sti_testout_t;
378 
379 STI_DEP(test);
380 
381 typedef struct sti_exhdlflags {
382 	u_int32_t	flags;
383 #define	STI_EXHDLF_WAIT	0x80000000
384 #define	STI_EXHDLF_CINT	0x40000000	/* clear int */
385 #define	STI_EXHDLF_CBE	0x20000000	/* clear BE */
386 #define	STI_EXHDLF_PINT	0x10000000	/* preserve int */
387 #define	STI_EXHDLF_RINT	0x08000000	/* restore int */
388 #define	STI_EXHDLF_WEIM	0x04000000	/* write eim w/ sti_eexhdlin */
389 #define	STI_EXHDLF_REIM	0x02000000	/* read eim to sti_eexhdlout */
390 #define	STI_EXHDLF_GIE	0x01000000	/* global int enable */
391 #define	STI_EXHDLF_PGIE	0x00800000
392 #define	STI_EXHDLF_WIEM	0x00400000
393 #define	STI_EXHDLF_EIEM	0x00200000
394 #define	STI_EXHDLF_BIC	0x00100000	/* begin int cycle */
395 #define	STI_EXHDLF_EIC	0x00080000	/* end int cycle */
396 #define	STI_EXHDLF_RIE	0x00040000	/* reset do not clear int enables */
397 	void		*future;
398 } __packed *sti_exhdlflags_t;
399 
400 typedef struct sti_eexhdlin {
401 	u_int32_t	eim_addr;
402 	u_int32_t	eim_data;
403 	u_int32_t	iem;		/* enable mask */
404 	u_int32_t	icm;		/* clear mask */
405 	void		*future;
406 } __packed *sti_eexhdlin_t;
407 
408 typedef struct sti_exhdlint {
409 	u_int32_t	flags;
410 #define	STI_EXHDLINT_BET	0x80000000	/* bus error timer */
411 #define	STI_EXHDLINT_HW		0x40000000	/* high water */
412 #define	STI_EXHDLINT_LW		0x20000000	/* low water */
413 #define	STI_EXHDLINT_TM		0x10000000	/* texture map */
414 #define	STI_EXHDLINT_VB		0x08000000	/* vertical blank */
415 #define	STI_EXHDLINT_UDC	0x04000000	/* unbuffered dma complete */
416 #define	STI_EXHDLINT_BDC	0x02000000	/* buffered dma complete */
417 #define	STI_EXHDLINT_UDPC	0x01000000	/* unbuf priv dma complete */
418 #define	STI_EXHDLINT_BDPC	0x00800000	/* buffered priv dma complete */
419 } __packed *sti_exhdlint_t;
420 
421 typedef struct sti_exhdlin {
422 	sti_exhdlint_t	addr;
423 	sti_eexhdlin_t	ext;
424 } __packed *sti_exhdlin_t;
425 
426 typedef struct sti_eexhdlout {
427 	u_int32_t	eim_addr;
428 	u_int32_t	eim_data;
429 	u_int32_t	iem;		/* enable mask */
430 	u_int32_t	icm;		/* clear mask */
431 	void		*future;
432 } __packed *sti_eexhdlout_t;
433 
434 typedef struct sti_exhdlout {
435 	u_int32_t	errno;
436 	u_int32_t	flags;
437 #define	STI_EXHDLO_BE	0x80000000	/* BE was intercepted */
438 #define	STI_EXHDLO_IP	0x40000000	/* there is int pending */
439 #define	STI_EXHDLO_IE	0x20000000	/* global enable set */
440 	sti_eexhdlout_t	ext;
441 } __packed *sti_exhdlout_t;
442 
443 STI_DEP(exhdl);
444 
445 typedef struct sti_inqconfflags {
446 	u_int32_t	flags;
447 #define	STI_INQCONFF_WAIT	0x80000000
448 	void		*future;
449 } __packed *sti_inqconfflags_t;
450 
451 typedef struct sti_inqconfin {
452 	void	*future;
453 } __packed *sti_inqconfin_t;
454 
455 typedef struct sti_einqconfout {
456 	u_int32_t	crt_config[3];
457 	u_int32_t	crt_hw[3];
458 	void		*future;
459 } __packed *sti_einqconfout_t;
460 
461 typedef struct sti_inqconfout {
462 	u_int32_t	errno;
463 	u_int16_t	width, height, owidth, oheight, fbwidth, fbheight;
464 	u_int32_t	bpp;	/* bits per pixel */
465 	u_int32_t	bppu;	/* accessible bpp */
466 	u_int32_t	planes;
467 	u_int8_t	name[STI_DEVNAME_LEN];
468 	u_int32_t	attributes;
469 #define	STI_INQCONF_Y2X		0x0001	/* pixel is higher than wider */
470 #define	STI_INQCONF_HWBLKMV	0x0002	/* hw blkmv is present */
471 #define	STI_INQCONF_AHW		0x0004	/* adv hw accel */
472 #define	STI_INQCONF_INT		0x0008	/* can interrupt */
473 #define	STI_INQCONF_GONOFF	0x0010	/* supports on/off */
474 #define	STI_INQCONF_AONOFF	0x0020	/* supports alpha on/off */
475 #define	STI_INQCONF_VARY	0x0040	/* variable fb height */
476 #define	STI_INQCONF_ODDBYTES	0x0080	/* use only odd fb bytes */
477 #define	STI_INQCONF_FLUSH	0x0100	/* fb cache requires flushing */
478 #define	STI_INQCONF_DMA		0x0200	/* supports dma */
479 #define	STI_INQCONF_VDMA	0x0400	/* supports vdma */
480 #define	STI_INQCONF_YUV1	0x2000	/* supports YUV type 1 */
481 #define	STI_INQCONF_YUV2	0x4000	/* supports YUV type 2 */
482 #define	STI_INQCONF_BITS \
483     "\020\001y2x\002hwblkmv\003ahw\004int\005gonoff\006aonoff\007vary"\
484     "\010oddb\011flush\012dma\013vdma\016yuv1\017yuv2"
485 	sti_einqconfout_t ext;
486 } __packed *sti_inqconfout_t;
487 
488 STI_DEP(inqconf);
489 
490 typedef struct sti_scmentflags {
491 	u_int32_t	flags;
492 #define	STI_SCMENTF_WAIT	0x80000000
493 	void		*future;
494 } __packed *sti_scmentflags_t;
495 
496 typedef struct sti_scmentin {
497 	u_int32_t	entry;
498 	u_int32_t	value;
499 	void		*future;
500 } __packed *sti_scmentin_t;
501 
502 typedef struct sti_scmentout {
503 	u_int32_t	errno;
504 	void		*future;
505 } __packed *sti_scmentout_t;
506 
507 STI_DEP(scment);
508 
509 typedef struct sti_dmacflags {
510 	u_int32_t	flags;
511 #define	STI_DMACF_WAIT	0x80000000
512 #define	STI_DMACF_PRIV	0x40000000	/* priv dma */
513 #define	STI_DMACF_DIS	0x20000000	/* disable */
514 #define	STI_DMACF_BUF	0x10000000	/* buffered */
515 #define	STI_DMACF_MRK	0x08000000	/* write a marker */
516 #define	STI_DMACF_ABRT	0x04000000	/* abort dma xfer */
517 	void		*future;
518 } __packed *sti_dmacflags_t;
519 
520 typedef struct sti_dmacin {
521 	u_int32_t	pa_upper;
522 	u_int32_t	pa_lower;
523 	u_int32_t	len;
524 	u_int32_t	mrk_data;
525 	u_int32_t	mrk_off;
526 	void		*future;
527 } __packed *sti_dmacin_t;
528 
529 typedef struct sti_dmacout {
530 	u_int32_t	errno;
531 	void		*future;
532 } __packed *sti_dmacout_t;
533 
534 STI_DEP(dmac);
535 
536 typedef struct sti_flowcflags {
537 	u_int32_t	flags;
538 #define	STI_FLOWCF_WAIT	0x80000000
539 #define	STI_FLOWCF_CHW	0x40000000	/* check high water */
540 #define	STI_FLOWCF_WHW	0x20000000	/* write high water */
541 #define	STI_FLOWCF_WLW	0x10000000	/* write low water */
542 #define	STI_FLOWCF_PCSE	0x08000000	/* preserve cse */
543 #define	STI_FLOWCF_CSE	0x04000000
544 #define	STI_FLOWCF_CSWF	0x02000000	/* cs write fine */
545 #define	STI_FLOWCF_CSWC	0x01000000	/* cs write coarse */
546 #define	STI_FLOWCF_CSWQ	0x00800000	/* cs write fifo */
547 	void		*future;
548 } __packed *sti_flowcflags_t;
549 
550 typedef struct sti_flowcin {
551 	u_int32_t	retry;
552 	u_int32_t	bufz;
553 	u_int32_t	hwcnt;
554 	u_int32_t	lwcnt;
555 	u_int32_t	csfv;	/* cs fine value */
556 	u_int32_t	cscv;	/* cs coarse value */
557 	u_int32_t	csqc;	/* cs fifo count */
558 	void		*future;
559 } __packed *sti_flowcin_t;
560 
561 typedef struct sti_flowcout {
562 	u_int32_t	errno;
563 	u_int32_t	retry_result;
564 	u_int32_t	fifo_size;
565 	void		*future;
566 } __packed *sti_flowcout_t;
567 
568 STI_DEP(flowc);
569 
570 typedef struct sti_utimingflags {
571 	u_int32_t	flags;
572 #define	STI_UTIMF_WAIT	0x80000000
573 #define	STI_UTIMF_HKS	0x40000000	/* has kbuf_size */
574 	void		*future;
575 } __packed *sti_utimingflags_t;
576 
577 typedef struct sti_utimingin {
578 	void		*data;
579 	void		*kbuf;
580 	void		*future;
581 } __packed *sti_utimingin_t;
582 
583 typedef struct sti_utimingout {
584 	u_int32_t	errno;
585 	u_int32_t	kbuf_size;	/* buffer required size */
586 	void		*future;
587 } __packed *sti_utimingout_t;
588 
589 STI_DEP(utiming);
590 
591 typedef struct sti_pmgrflags {
592 	u_int32_t	flags;
593 #define	STI_UTIMF_WAIT	0x80000000
594 #define	STI_UTIMOP_CLEANUP	0x00000000
595 #define	STI_UTIMOP_BAC		0x10000000
596 #define	STI_UTIMF_CRIT	0x04000000
597 #define	STI_UTIMF_BUFF	0x02000000
598 #define	STI_UTIMF_IBUFF	0x01000000
599 	void		*future;
600 } __packed *sti_pmgrflags_t;
601 
602 typedef struct sti_pmgrin {
603 	u_int32_t	reserved[4];
604 	void		*future;
605 } __packed *sti_pmgrin_t;
606 
607 typedef struct sti_pmgrout {
608 	int32_t		errno;
609 	void		*future;
610 } __packed *sti_pmgrout_t;
611 
612 STI_DEP(pmgr);
613 
614 typedef struct sti_utilflags {
615 	u_int32_t	flags;
616 #define	STI_UTILF_ROOT	0x80000000	/* was called as root */
617 	void		*future;
618 } __packed *sti_utilflags_t;
619 
620 typedef struct sti_utilin {
621 	u_int32_t	in_size;
622 	u_int32_t	out_size;
623 	u_int8_t	*buf;
624 } __packed *sti_utilin_t;
625 
626 typedef struct sti_utilout {
627 	int32_t		errno;
628 	void		*future;
629 } __packed *sti_utilout_t;
630 
631 STI_DEP(util);
632 
633 /*
634  * NGLE register layout.
635  * Based upon xc/programs/Xserver/hw/hp/ngle/dregs.h
636  */
637 #define	NGLE_REG_1		0x000118
638 #define	NGLE_REG_28		0x000420
639 #define	NGLE_REG_2		0x000480
640 #define	NGLE_REG_3		0x0004a0	/* palette index */
641 #define	NGLE_REG_22		0x0005a0
642 #define	NGLE_REG_23		0x0005c0
643 #define	NGLE_REG_4		0x000600	/* palette data */
644 #define	NGLE_REG_5		0x0006a0	/* cursor data */
645 #define	NGLE_REG_6		0x000800
646 #define	NGLE_REG_7		0x000804
647 #define	NGLE_REG_24		0x000808
648 #define	NGLE_REG_8		0x000820
649 #define	NGLE_REG_73		0x000944
650 #define	NGLE_REG_9		0x000a04
651 #define	NGLE_REG_25		0x000b00
652 #define	NGLE_REG_RAMDAC		0x001000
653 #define	NGLE_REG_10		0x018000
654 #define	NGLE_REG_11		0x018004	/* dest coords */
655 #define	NGLE_REG_12		0x01800c	/* control plane register */
656 #define	NGLE_REG_35		0x018010	/* fg color */
657 #define	NGLE_REG_36		0x018014
658 #define	NGLE_REG_13		0x018018	/* image planemask */
659 #define	NGLE_REG_14		0x01801c	/* raster op */
660 #define	NGLE_REG_15		0x200000
661 #define	NGLE_REG_15b0		0x200000	/* busy register */
662 #define	NGLE_REG_16		0x200004
663 #define	NGLE_REG_16b1		0x200005
664 #define	NGLE_REG_16b3		0x200007
665 #define	NGLE_REG_34		0x200008	/* # of fifo slots */
666 #define	NGLE_REG_17		0x200100	/* cursor coordinates */
667 #define	NGLE_REG_18		0x200104	/* cursor enable */
668 #define	NGLE_REG_26		0x200118
669 #define	NGLE_REG_19		0x200200
670 #define	NGLE_REG_20		0x200208	/* cursor geometry */
671 #define	NGLE_REG_21		0x200218	/* Artist misc video */
672 #define	NGLE_REG_27		0x200308	/* Artist misc ctrl */
673 #define	NGLE_REG_29		0x210000	/* HCRX cursor coord & enable */
674 #define	NGLE_REG_30		0x210004	/* HCRX cursor address */
675 #define	NGLE_REG_31		0x210008	/* HCRX cursor data */
676 #define	NGLE_REG_38		0x210020	/* colormap data */
677 #define	NGLE_REG_41		0x210024
678 #define	NGLE_REG_42		0x210028
679 #define	NGLE_REG_43		0x21002c
680 #define	NGLE_REG_44		0x210030
681 #define	NGLE_REG_45		0x210034
682 #define	NGLE_REG_32		0x21003c
683 #define	NGLE_REG_33		0x210040	/* HCRX misc video */
684 #define	NGLE_REG_39		0x210120
685 #define	NGLE_REG_40		0x210130
686 
687 #define	NGLE_BUFF0_CMAP0	0x00001e02
688 #define	NGLE_BUFF1_CMAP0	0x02001e02
689 #define	NGLE_BUFF1_CMAP3	0x0c001e02
690 #define	NGLE_ARTIST_CMAP0	0x00000102
691 
692 #endif /* _IC_STIREG_H_ */
693