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