1 /* $NetBSD: stireg.h,v 1.1.2.3 2004/09/21 13:28:08 skrll Exp $ */
3 /* $OpenBSD: stireg.h,v 1.8 2003/08/19 02:52:38 mickey Exp $ */
6 * Copyright (c) 2000 Michael Shalayeff
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
22 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
34 /* #define STIDEBUG */
36 #define STI_REGION_MAX 8
37 #define STI_MONITOR_MAX 256
38 #define STI_DEVNAME_LEN 32
41 /* code ROM definitions */
43 #define STI_INIT_GRAPH 0
44 #define STI_STATE_MGMT 1
45 #define STI_FONT_UNPMV 2
46 #define STI_BLOCK_MOVE 3
47 #define STI_SELF_TEST 4
48 #define STI_EXCEP_HDLR 5
49 #define STI_INQ_CONF 6
51 #define STI_DMA_CTRL 8
52 #define STI_FLOW_CTRL 9
53 #define STI_UTIMING 10
54 #define STI_PROC_MGR 11
57 #define STI_CODECNT 16
65 #define STI_NOERRNO 0 /* no error */
66 #define STI_BADREENTLVL 1 /* bad reentry level */
67 #define STI_NOREGIONSDEF 2 /* region table is not setup */
68 #define STI_ILLNPLANES 3 /* invalid num of text planes */
69 #define STI_ILLINDEX 4 /* invalid fond index */
70 #define STI_ILLLOC 5 /* invalid font location */
71 #define STI_ILLCOLOUR 6 /* invalid colour */
72 #define STI_ILLBLKMVFROM 7 /* invalid from in blkmv */
73 #define STI_ILLBLKMVTO 8 /* invalid to in blkmv */
74 #define STI_ILLBLKMVSIZE 9 /* invalid siz in blkmv */
75 #define STI_BEIUNSUPP 10 /* bus error ints unsupported */
76 #define STI_UNXPBE 11 /* unexpected bus error */
77 #define STI_UNXHWF 12 /* unexpected hardware failure */
78 #define STI_NEGCFG 13 /* no ext global config struct */
79 #define STI_NEIG 14 /* no ext init struct */
80 #define STI_ILLSCME 15 /* invalid set cmap entry */
81 #define STI_ILLCMVAL 16 /* invalid cmap value */
82 #define STI_NORESMEM 17 /* no requested global memory */
83 #define STI_RESMEMCORR 18 /* reserved memory corrupted */
84 #define STI_ILLNTBLKMV 19 /* invalid non-text blkmv */
85 #define STI_ILLMONITOR 20 /* monitor selection is out of range */
86 #define STI_ILLEXCADDR 21 /* invalid excpt handler addr */
87 #define STI_ILLEXCFLAGS 22 /* invalid excpt handler flags */
88 #define STI_NOEHE 23 /* no ext exhdl struct */
89 #define STI_NOINQCE 24 /* no ext inq cfg struct */
90 #define STI_ILLRGNPTR 25 /* invalid region pointer */
91 #define STI_ILLUTLOP 26 /* invalid util opcode */
92 #define STI_UNKNOWN 250 /* unknown error */
93 #define STI_NOCFGPTR 251 /* no config ptr defined */
94 #define STI_NOFLPTR 252 /* no flag ptr defined */
95 #define STI_NOINPTR 253 /* no in ptr defined */
96 #define STI_NOOUTPTR 254 /* no way you can get it */
97 #define STI_NOLOCK 255 /* kernel dishonour graphics lock */
100 #define STI_COLOUR_BLACK 0
101 #define STI_COLOUR_WHITE 1
102 #define STI_COLOUR_RED 2
103 #define STI_COLOUR_YELLOW 3
104 #define STI_COLOUR_GREEN 4
105 #define STI_COLOUR_CYAN 5
106 #define STI_COLOUR_BLUE 6
107 #define STI_COLOUR_MAGENTA 7
113 u_int32_t dd_type
; /* 0x00 device type */
114 #define STI_DEVTYPE1 1
115 #define STI_DEVTYPE4 3
117 u_int8_t dd_nmon
; /* 0x05 number monitor rates */
118 u_int8_t dd_grrev
; /* 0x06 global rom revision */
119 u_int8_t dd_lrrev
; /* 0x07 local rom revision */
120 u_int8_t dd_grid
[8]; /* 0x08 graphics id */
121 #define STI_DEV4_DD_GRID 0x08 /* offset for STI_DEVTYPE4 */
122 #define STI_DEV1_DD_GRID 0x10 /* offset for STI_DEVTYPE1 */
123 u_int32_t dd_fntaddr
; /* 0x10 font start address */
124 u_int32_t dd_maxst
; /* 0x14 max state storage */
125 u_int32_t dd_romend
; /* 0x18 rom last address */
126 #define STI_DEV4_DD_ROMEND 0x18 /* offset for STI_DEVTYPE4 */
127 #define STI_DEV1_DD_ROMEND 0x50 /* offset for STI_DEVTYPE1 */
128 u_int32_t dd_reglst
; /* 0x1c device region list */
129 u_int16_t dd_maxreent
; /* 0x20 max reent storage */
130 u_int16_t dd_maxtimo
; /* 0x22 max execution timeout .1 sec */
131 u_int32_t dd_montbl
; /* 0x24 mon table address, array of
132 names num of dd_nmon */
133 u_int32_t dd_udaddr
; /* 0x28 user data address */
134 u_int32_t dd_stimemreq
; /* 0x2c sti memory request */
135 u_int32_t dd_udsize
; /* 0x30 user data size */
136 u_int16_t dd_pwruse
; /* 0x34 power usage */
137 u_int8_t dd_bussup
; /* 0x36 bus support */
138 #define STI_BUSSUPPORT_GSCINTL 0x01 /* supports pulling INTL for int */
139 #define STI_BUSSUPPORT_GSC15X 0x02 /* supports GSC 1.5X */
140 #define STI_BUSSUPPORT_GSC2X 0x04 /* supports GSC 2.X */
141 #define STI_BUSSUPPORT_PCIIOEIM 0x08 /* will use directed int */
142 #define STI_BUSSUPPORT_PCISTD 0x10 /* will use std PCI int */
143 #define STI_BUSSUPPORT_ILOCK 0x20 /* supports implicit locking */
144 #define STI_BUSSUPPORT_ROMMAP 0x40 /* rom is only in pci erom space */
145 #define STI_BUSSUPPORT_2DECODE 0x80 /* single address decoder */
146 u_int8_t dd_ebussup
; /* 0x37 extended bus support */
147 #define STI_EBUSSUPPORT_DMA 0x01 /* supports dma */
148 #define STI_EBUSSUPPORT_PIOLOCK 0x02 /* no implicit locking for dma */
149 u_int8_t dd_altcodet
; /* 0x38 alternate code type */
150 #define STI_ALTCODE_UNKNOWN 0x00
151 #define STI_ALTCODE_PA64 0x01 /* alt code is in pa64 */
152 u_int8_t dd_eddst
[3]; /* 0x39 extended DD struct */
153 u_int32_t dd_cfbaddr
; /* 0x3c CFB address, location of
154 X11 driver to be used for
156 u_int32_t dd_pacode
[16]; /* 0x40 routines for pa-risc */
157 u_int32_t dd_altcode
[16]; /* 0x80 routines for m68k/i386 */
160 /* after the last region there is one indirect list ptr */
162 u_int offset
:14; /* page offset dev io space relative */
163 u_int sys_only
: 1; /* whether allow user access */
164 u_int cache
: 1; /* map in cache */
165 u_int btlb
: 1; /* should use BTLB if available */
166 u_int last
: 1; /* last region in the list */
167 u_int length
:14; /* size in pages */
176 #define STI_FONT_HPROMAN8 1
177 #define STI_FONT_KANA8 2
196 typedef struct sti_ecfg
{
197 u_int8_t current_monitor
;
199 u_int16_t power
; /* power dissipation Watts */
201 u_int32_t
*addr
; /* memory block of size dd_stimemreq */
205 typedef struct sti_cfg
{
206 u_int32_t text_planes
;
208 u_int16_t scr_height
;
209 u_int16_t oscr_width
;
210 u_int16_t oscr_height
;
213 u_int32_t regions
[STI_REGION_MAX
];
214 u_int32_t reent_level
;
215 u_int32_t
*save_addr
;
222 typedef int (*sti_##n##_t)( \
223 sti_##n##flags_t, sti_##n##in_t, sti_##n##out_t, sti_cfg_t);
225 typedef struct sti_initflags
{
227 #define STI_INITF_WAIT 0x80000000
228 #define STI_INITF_RESET 0x40000000
229 #define STI_INITF_TEXT 0x20000000
230 #define STI_INITF_NTEXT 0x10000000
231 #define STI_INITF_CLEAR 0x08000000
232 #define STI_INITF_CMB 0x04000000 /* non-text planes cmap black */
233 #define STI_INITF_EBET 0x02000000 /* enable bus error timer */
234 #define STI_INITF_EBETI 0x01000000 /* enable bus error timer interrupt */
235 #define STI_INITF_PTS 0x00800000 /* preserve text settings */
236 #define STI_INITF_PNTS 0x00400000 /* preserve non-text settings */
237 #define STI_INITF_PBET 0x00200000 /* preserve BET settings */
238 #define STI_INITF_PBETI 0x00100000 /* preserve BETI settings */
239 #define STI_INITF_ICMT 0x00080000 /* init cmap for text planes */
240 #define STI_INITF_SCMT 0x00040000 /* change current monitor type */
241 #define STI_INITF_RIE 0x00020000 /* retain int enables */
245 typedef struct sti_einitin
{
248 u_int16_t inflight
; /* possible on pci */
252 typedef struct sti_initin
{
253 u_int32_t text_planes
; /* number of planes for text */
254 sti_einitin_t ext_in
;
257 typedef struct sti_initout
{
259 u_int32_t text_planes
; /* number of planes used for text */
265 typedef struct sti_mgmtflags
{
267 #define STI_MGMTF_WAIT 0x80000000
268 #define STI_MGMTF_SAVE 0x40000000
269 #define STI_MGMTF_RALL 0x20000000 /* restore all display planes */
273 typedef struct sti_mgmtin
{
278 typedef struct sti_mgmtout
{
285 typedef struct sti_unpmvflags
{
287 #define STI_UNPMVF_WAIT 0x80000000
288 #define STI_UNPMVF_NTXT 0x40000000 /* intp non-text planes */
292 typedef struct sti_unpmvin
{
293 u_int32_t
*font_addr
; /* font */
294 u_int16_t index
; /* character index in the font */
301 typedef struct sti_unpmvout
{
308 typedef struct sti_blkmvflags
{
310 #define STI_BLKMVF_WAIT 0x80000000
311 #define STI_BLKMVF_COLR 0x40000000 /* change colour on move */
312 #define STI_BLKMVF_CLR 0x20000000 /* clear on move */
313 #define STI_BLKMVF_NTXT 0x10000000 /* move in non-text planes */
317 typedef struct sti_blkmvin
{
320 u_int16_t srcx
, srcy
, dstx
, dsty
;
321 u_int16_t width
, height
;
326 typedef struct sti_blkmvout
{
333 typedef struct sti_testflags
{
335 #define STI_TESTF_WAIT 0x80000000
336 #define STI_TESTF_ETST 0x40000000
340 typedef struct sti_testin
{
344 typedef struct sti_testout
{
352 typedef struct sti_exhdlflags
{
354 #define STI_EXHDLF_WAIT 0x80000000
355 #define STI_EXHDLF_CINT 0x40000000 /* clear int */
356 #define STI_EXHDLF_CBE 0x20000000 /* clear BE */
357 #define STI_EXHDLF_PINT 0x10000000 /* preserve int */
358 #define STI_EXHDLF_RINT 0x08000000 /* restore int */
359 #define STI_EXHDLF_WEIM 0x04000000 /* write eim w/ sti_eexhdlin */
360 #define STI_EXHDLF_REIM 0x02000000 /* read eim to sti_eexhdlout */
361 #define STI_EXHDLF_GIE 0x01000000 /* global int enable */
362 #define STI_EXHDLF_PGIE 0x00800000
363 #define STI_EXHDLF_WIEM 0x00400000
364 #define STI_EXHDLF_EIEM 0x00200000
365 #define STI_EXHDLF_BIC 0x00100000 /* begin int cycle */
366 #define STI_EXHDLF_EIC 0x00080000 /* end int cycle */
367 #define STI_EXHDLF_RIE 0x00040000 /* reset do not clear int enables */
371 typedef struct sti_eexhdlin
{
374 u_int32_t iem
; /* enable mask */
375 u_int32_t icm
; /* clear mask */
379 typedef struct sti_exhdlint
{
381 #define STI_EXHDLINT_BET 0x80000000 /* bus error timer */
382 #define STI_EXHDLINT_HW 0x40000000 /* high water */
383 #define STI_EXHDLINT_LW 0x20000000 /* low water */
384 #define STI_EXHDLINT_TM 0x10000000 /* texture map */
385 #define STI_EXHDLINT_VB 0x08000000 /* vertical blank */
386 #define STI_EXHDLINT_UDC 0x04000000 /* unbuffered dma complete */
387 #define STI_EXHDLINT_BDC 0x02000000 /* buffered dma complete */
388 #define STI_EXHDLINT_UDPC 0x01000000 /* unbuf priv dma complete */
389 #define STI_EXHDLINT_BDPC 0x00800000 /* buffered priv dma complete */
392 typedef struct sti_exhdlin
{
397 typedef struct sti_eexhdlout
{
400 u_int32_t iem
; /* enable mask */
401 u_int32_t icm
; /* clear mask */
405 typedef struct sti_exhdlout
{
408 #define STI_EXHDLO_BE 0x80000000 /* BE was intercepted */
409 #define STI_EXHDLO_IP 0x40000000 /* there is int pending */
410 #define STI_EXHDLO_IE 0x20000000 /* global enable set */
416 typedef struct sti_inqconfflags
{
418 #define STI_INQCONFF_WAIT 0x80000000
420 } *sti_inqconfflags_t
;
422 typedef struct sti_inqconfin
{
426 typedef struct sti_einqconfout
{
427 u_int32_t crt_config
[3];
430 } *sti_einqconfout_t
;
432 typedef struct sti_inqconfout
{
434 u_int16_t width
, height
, owidth
, oheight
, fbwidth
, fbheight
;
435 u_int32_t bpp
; /* bits per pixel */
436 u_int32_t bppu
; /* accessible bpp */
438 u_int8_t name
[STI_DEVNAME_LEN
];
439 u_int32_t attributes
;
440 #define STI_INQCONF_Y2X 0x0001 /* pixel is higher tan wider */
441 #define STI_INQCONF_HWBLKMV 0x0002 /* hw blkmv is present */
442 #define STI_INQCONF_AHW 0x0004 /* adv hw accel */
443 #define STI_INQCONF_INT 0x0008 /* can interrupt */
444 #define STI_INQCONF_GONOFF 0x0010 /* supports on/off */
445 #define STI_INQCONF_AONOFF 0x0020 /* supports alpha on/off */
446 #define STI_INQCONF_VARY 0x0040 /* variable fb height */
447 #define STI_INQCONF_ODDBYTES 0x0080 /* use only odd fb bytes */
448 #define STI_INQCONF_FLUSH 0x0100 /* fb cache requires flushing */
449 #define STI_INQCONF_DMA 0x0200 /* supports dma */
450 #define STI_INQCONF_VDMA 0x0400 /* supports vdma */
451 #define STI_INQCONF_YUV1 0x2000 /* supports YUV type 1 */
452 #define STI_INQCONF_YUV2 0x4000 /* supports YUV type 2 */
453 #define STI_INQCONF_BITS \
454 "\020\001y2x\002hwblkmv\003ahw\004int\005gonoff\006aonoff\007vary"\
455 "\010oddb\011flush\012dma\013vdma\016yuv1\017yuv2"
456 sti_einqconfout_t ext
;
461 typedef struct sti_scmentflags
{
463 #define STI_SCMENTF_WAIT 0x80000000
465 } *sti_scmentflags_t
;
467 typedef struct sti_scmentin
{
473 typedef struct sti_scmentout
{
480 typedef struct sti_dmacflags
{
482 #define STI_DMACF_WAIT 0x80000000
483 #define STI_DMACF_PRIV 0x40000000 /* priv dma */
484 #define STI_DMACF_DIS 0x20000000 /* disable */
485 #define STI_DMACF_BUF 0x10000000 /* buffered */
486 #define STI_DMACF_MRK 0x08000000 /* write a marker */
487 #define STI_DMACF_ABRT 0x04000000 /* abort dma xfer */
491 typedef struct sti_dmacin
{
500 typedef struct sti_dmacout
{
507 typedef struct sti_flowcflags
{
509 #define STI_FLOWCF_WAIT 0x80000000
510 #define STI_FLOWCF_CHW 0x40000000 /* check high water */
511 #define STI_FLOWCF_WHW 0x20000000 /* write high water */
512 #define STI_FLOWCF_WLW 0x10000000 /* write low water */
513 #define STI_FLOWCF_PCSE 0x08000000 /* preserve cse */
514 #define STI_FLOWCF_CSE 0x04000000
515 #define STI_FLOWCF_CSWF 0x02000000 /* cs write fine */
516 #define STI_FLOWCF_CSWC 0x01000000 /* cs write coarse */
517 #define STI_FLOWCF_CSWQ 0x00800000 /* cs write fifo */
521 typedef struct sti_flowcin
{
526 u_int32_t csfv
; /* cs fine value */
527 u_int32_t cscv
; /* cs coarse value */
528 u_int32_t csqc
; /* cs fifo count */
532 typedef struct sti_flowcout
{
534 u_int32_t retry_result
;
541 typedef struct sti_utimingflags
{
543 #define STI_UTIMF_WAIT 0x80000000
544 #define STI_UTIMF_HKS 0x40000000 /* has kbuf_size */
546 } *sti_utimingflags_t
;
548 typedef struct sti_utimingin
{
554 typedef struct sti_utimingout
{
556 u_int32_t kbuf_size
; /* buffer required size */
562 typedef struct sti_pmgrflags
{
564 #define STI_UTIMF_WAIT 0x80000000
565 #define STI_UTIMOP_CLEANUP 0x00000000
566 #define STI_UTIMOP_BAC 0x10000000
567 #define STI_UTIMF_CRIT 0x04000000
568 #define STI_UTIMF_BUFF 0x02000000
569 #define STI_UTIMF_IBUFF 0x01000000
573 typedef struct sti_pmgrin
{
574 u_int32_t reserved
[4];
578 typedef struct sti_pmgrout
{
585 typedef struct sti_utilflags
{
587 #define STI_UTILF_ROOT 0x80000000 /* was called as root */
591 typedef struct sti_utilin
{
597 typedef struct sti_utilout
{
606 #endif /* _IC_STIREG_H_ */