xref: /csrg-svn/sys/sparc/sbus/cgsixreg.h (revision 65800)
164779Storek /*
2*65800Sbostic  * Copyright (c) 1993
3*65800Sbostic  *	The Regents of the University of California.  All rights reserved.
464779Storek  *
564779Storek  * This software was developed by the Computer Systems Engineering group
664779Storek  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
764779Storek  * contributed to Berkeley.
864779Storek  *
964779Storek  * All advertising materials mentioning features or use of this software
1064779Storek  * must display the following acknowledgement:
1164779Storek  *	This product includes software developed by the University of
1264779Storek  *	California, Lawrence Berkeley Laboratory.
1364779Storek  *
1464779Storek  * %sccs.include.redist.c%
1564779Storek  *
16*65800Sbostic  *	@(#)cgsixreg.h	8.4 (Berkeley) 01/21/94
1764779Storek  *
1864779Storek  * from: $Header: cgsixreg.h,v 1.1 93/10/12 15:29:24 torek Exp $
1964779Storek  */
2064779Storek 
2164779Storek /*
2264779Storek  * CG6 display registers.  (Note, I got tired of writing `cgsix' about
2364779Storek  * halfway through and changed everything to cg6, but I probably missed
2464779Storek  * some.  Unfortunately, the way config works, we need to spell out `six'
2564779Storek  * in some places anyway.)
2664779Storek  *
2764779Storek  * The cg6 is a complicated beastie.  We have been unable to extract any
2864779Storek  * documentation and most of the following are guesses based on a limited
2964779Storek  * amount of reverse engineering.
3064779Storek  *
3164779Storek  * A cg6 is composed of numerous groups of control registers, all with TLAs:
3264779Storek  *	FBC - frame buffer control?
3365111Storek  *	FHC - fbc hardware configuration / control? register (32 bits)
3464779Storek  *	DHC - ???
3564779Storek  *	TEC - transform engine control?
3665140Storek  *	THC - TEC Hardware Configuration
3764779Storek  *	ROM - a 64Kbyte ROM with who knows what in it.
3864779Storek  *	colormap - see below
3964779Storek  *	frame buffer memory (video RAM)
4064779Storek  *	possible other stuff
4164779Storek  *
4264779Storek  * Like the cg3, the cg6 uses a Brooktree Video DAC (see btreg.h).
4365111Storek  *
4465111Storek  * Various revisions of the cgsix have various hardware bugs.  So far,
4565111Storek  * we have only seen rev 1 & 2.
4664779Storek  */
4764779Storek 
4865111Storek /* bits in FHC register */
4965111Storek #define	FHC_FBID_MASK	0xff000000	/* bits 24..31 are frame buffer ID */
5065111Storek #define	FHC_FBID_SHIFT	24
5165111Storek #define	FHC_REV_MASK	0x00f00000	/* bits 20..23 are revision */
5265111Storek #define	FHC_REV_SHIFT	20
5365111Storek #define	FHC_FROP_DISABLE 0x00080000	/* disable fast/font? rasterops */
5465111Storek #define	FHC_ROW_DISABLE	0x00040000	/* ??? */
5565111Storek #define	FHC_SRC_DISABLE	0x00020000	/* ??? */
5665111Storek #define	FHC_DST_DISABLE	0x00010000	/* disable destination cache */
5765111Storek #define	FHC_RESET	0x00008000	/* ??? */
5865111Storek #define	FHC_XXX0	0x00004000	/* ??? */
5965111Storek #define	FHC_LEBO	0x00002000	/* set little endian byte order? */
6065111Storek #define	FHC_RES_MASK	0x00001800	/* bits 11&12 are resolution */
6165111Storek #define	FHC_RES_1024	 0x00000000		/* res = 1024x768 */
6265111Storek #define	FHC_RES_1152	 0x00000800		/* res = 1152x900 */
6365111Storek #define	FHC_RES_1280	 0x00001000		/* res = 1280x1024 */
6465111Storek #define	FHC_RES_1600	 0x00001800		/* res = 1600x1200 */
6565111Storek #define	FHC_CPU_MASK	0x00000600	/* bits 9&10 are cpu type */
6665111Storek #define	FHC_CPU_SPARC	 0x00000000		/* cpu = sparc */
6765111Storek #define	FHC_CPU_68020	 0x00000200		/* cpu = 68020 */
6865111Storek #define	FHC_CPU_386	 0x00000400		/* cpu = 80386 */
6965111Storek #define	FHC_CPU_XXX	 0x00000600		/* ??? */
7065111Storek #define	FHC_TEST	0x00000100	/* ??? test window ??? */
7165111Storek #define	FHC_TESTX_MASK	0x000000f0	/* bits 4..7 are test window X */
7265111Storek #define	FHC_TESTX_SHIFT	4
7365111Storek #define	FHC_TESTY_MASK	0x0000000f	/* bits 0..3 are test window Y */
7465111Storek #define	FHC_TESTY_SHIFT	0
7565111Storek 
7664779Storek /*
7764779Storek  * The layout of the THC.
7864779Storek  */
7964779Storek struct cg6_thc {
8064779Storek 	u_int	thc_xxx0[512];	/* ??? */
8164779Storek 	u_int	thc_hsync1;	/* horizontal sync timing */
8264779Storek 	u_int	thc_hsync2;	/* more hsync timing */
8364779Storek 	u_int	thc_hsync3;	/* yet more hsync timing */
8464779Storek 	u_int	thc_vsync1;	/* vertical sync timing */
8564779Storek 	u_int	thc_vsync2;	/* only two of these */
8664779Storek 	u_int	thc_refresh;	/* refresh counter */
8764779Storek 	u_int	thc_misc;	/* miscellaneous control & status */
8864779Storek 	u_int	thc_xxx1[56];	/* ??? */
8964779Storek 	u_int	thc_cursxy;	/* cursor x,y position (16 bits each) */
9064779Storek 	u_int	thc_cursmask[32];	/* cursor mask bits */
9164779Storek 	u_int	thc_cursbits[32];	/* what to show where mask enabled */
9264779Storek };
9364779Storek 
9464779Storek /* bits in thc_misc */
9564779Storek #define	THC_MISC_XXX0		0xfff00000	/* unused */
9664779Storek #define	THC_MISC_REVMASK	0x000f0000	/* cg6 revision? */
9764779Storek #define	THC_MISC_REVSHIFT	16
9864779Storek #define	THC_MISC_XXX1		0x0000e000	/* unused */
9964779Storek #define	THC_MISC_RESET		0x00001000	/* ??? */
10064779Storek #define	THC_MISC_XXX2		0x00000800	/* unused */
10164779Storek #define	THC_MISC_VIDEN		0x00000400	/* video enable */
10264779Storek #define	THC_MISC_SYNC		0x00000200	/* not sure what ... */
10364779Storek #define	THC_MISC_VSYNC		0x00000100	/* ... these really are */
10464779Storek #define	THC_MISC_SYNCEN		0x00000080	/* sync enable */
10564779Storek #define	THC_MISC_CURSRES	0x00000040	/* cursor resolution */
10664779Storek #define	THC_MISC_INTEN		0x00000020	/* v.retrace intr enable */
10764779Storek #define	THC_MISC_INTR		0x00000010	/* intr pending / ack bit */
10864779Storek #define	THC_MISC_XXX		0x0000000f	/* ??? */
10964779Storek 
11064779Storek /* cursor x / y position value for `off' */
11164779Storek #define	THC_CURSOFF	(65536-32)	/* i.e., USHRT_MAX+1-32 */
11264779Storek 
11364779Storek /*
11465140Storek  * Partial description of TEC (needed to get around FHC rev 1 bugs).
11565140Storek  */
11665140Storek struct cg6_tec_xxx {
11765140Storek 	u_int	tec_mv;		/* matrix stuff */
11865140Storek 	u_int	tec_clip;	/* clipping stuff */
11965140Storek 	u_int	tec_vdc;	/* ??? */
12065140Storek };
12165140Storek 
12265140Storek /*
12364779Storek  * This structure exists only to compute the layout of the CG6
12464779Storek  * hardware.  Each of the individual substructures lives on a
12564779Storek  * separate `page' (where a `page' is at least 4K), and many are
12664779Storek  * very far apart.  We avoid large offsets (which make for lousy
12764779Storek  * code) by using pointers to the individual interesting pieces,
12864779Storek  * and map them in independently (to avoid using up PTEs unnecessarily).
12964779Storek  */
13064779Storek struct cg6_layout {
13164779Storek 	/* ROM at 0 */
13264779Storek 	union {
13364779Storek 		long un_id;		/* ID = ?? */
13464779Storek 		char un_rom[65536];	/* 64K rom */
13564779Storek 		char un_pad[0x200000];
13664779Storek 	} cg6_rom_un;
13764779Storek 
13864779Storek 	/* Brooktree DAC at 0x200000 */
13964779Storek 	union {
14064779Storek 		struct bt_regs un_btregs;
14164779Storek 		char un_pad[0x040000];
14264779Storek 	} cg6_bt_un;
14364779Storek 
14464779Storek 	/* DHC, whatever that is, at 0x240000 */
14564779Storek 	union {
14664779Storek 		char un_pad[0x40000];
14764779Storek 	} cg6_dhc_un;
14864779Storek 
14964779Storek 	/* ALT, whatever that is, at 0x280000 */
15064779Storek 	union {
15164779Storek 		char un_pad[0x80000];
15264779Storek 	} cg6_alt_un;
15364779Storek 
15465111Storek 	/* FHC register at 0x300000 */
15564779Storek 	union {
15665111Storek 		int un_fhc;
15764779Storek 		char un_pad[0x1000];
15864779Storek 	} cg6_fhc_un;
15964779Storek 
16064779Storek 	/* THC at 0x301000 */
16164779Storek 	union {
16264779Storek 		struct cg6_thc un_thc;
16364779Storek 		char un_pad[0x400000 - 0x1000];
16464779Storek 	} cg6_thc_un;
16564779Storek 
16664779Storek 	/* FBC at 0x700000 */
16764779Storek 	union {
16864779Storek 		char un_pad[0x1000];
16964779Storek 	} cg6_fbc_un;
17064779Storek 
17164779Storek 	/* TEC at 0x701000 */
17264779Storek 	union {
17364779Storek 		char un_pad[0x100000 - 0x1000];
17465140Storek 		struct cg6_tec_xxx un_tec;
17564779Storek 	} cg6_tec_un;
17664779Storek 
17764779Storek 	/* Video RAM at 0x800000 */
17864779Storek 	char	cg6_ram[1024 * 1024];	/* approx.? */
17964779Storek };
180