Home | History | Annotate | Line # | Download | only in sun
cgsixreg.h revision 1.2
      1  1.2  eeh /*	$NetBSD: cgsixreg.h,v 1.2 2000/08/26 16:06:22 eeh Exp $ */
      2  1.1   pk 
      3  1.1   pk /*
      4  1.1   pk  * Copyright (c) 1993
      5  1.1   pk  *	The Regents of the University of California.  All rights reserved.
      6  1.1   pk  *
      7  1.1   pk  * This software was developed by the Computer Systems Engineering group
      8  1.1   pk  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
      9  1.1   pk  * contributed to Berkeley.
     10  1.1   pk  *
     11  1.1   pk  * All advertising materials mentioning features or use of this software
     12  1.1   pk  * must display the following acknowledgement:
     13  1.1   pk  *	This product includes software developed by the University of
     14  1.1   pk  *	California, Lawrence Berkeley Laboratory.
     15  1.1   pk  *
     16  1.1   pk  * Redistribution and use in source and binary forms, with or without
     17  1.1   pk  * modification, are permitted provided that the following conditions
     18  1.1   pk  * are met:
     19  1.1   pk  * 1. Redistributions of source code must retain the above copyright
     20  1.1   pk  *    notice, this list of conditions and the following disclaimer.
     21  1.1   pk  * 2. Redistributions in binary form must reproduce the above copyright
     22  1.1   pk  *    notice, this list of conditions and the following disclaimer in the
     23  1.1   pk  *    documentation and/or other materials provided with the distribution.
     24  1.1   pk  * 3. All advertising materials mentioning features or use of this software
     25  1.1   pk  *    must display the following acknowledgement:
     26  1.1   pk  *	This product includes software developed by the University of
     27  1.1   pk  *	California, Berkeley and its contributors.
     28  1.1   pk  * 4. Neither the name of the University nor the names of its contributors
     29  1.1   pk  *    may be used to endorse or promote products derived from this software
     30  1.1   pk  *    without specific prior written permission.
     31  1.1   pk  *
     32  1.1   pk  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     33  1.1   pk  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     34  1.1   pk  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     35  1.1   pk  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     36  1.1   pk  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     37  1.1   pk  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     38  1.1   pk  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     39  1.1   pk  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     40  1.1   pk  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     41  1.1   pk  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     42  1.1   pk  * SUCH DAMAGE.
     43  1.1   pk  *
     44  1.1   pk  *	@(#)cgsixreg.h	8.4 (Berkeley) 1/21/94
     45  1.1   pk  */
     46  1.1   pk 
     47  1.1   pk /*
     48  1.1   pk  * CG6 display registers.  (Note, I got tired of writing `cgsix' about
     49  1.1   pk  * halfway through and changed everything to cg6, but I probably missed
     50  1.1   pk  * some.  Unfortunately, the way config works, we need to spell out `six'
     51  1.1   pk  * in some places anyway.)
     52  1.1   pk  *
     53  1.1   pk  * The cg6 is a complicated beastie.  We have been unable to extract any
     54  1.1   pk  * documentation and most of the following are guesses based on a limited
     55  1.1   pk  * amount of reverse engineering.
     56  1.1   pk  *
     57  1.1   pk  * A cg6 is composed of numerous groups of control registers, all with TLAs:
     58  1.1   pk  *	FBC - frame buffer control?
     59  1.1   pk  *	FHC - fbc hardware configuration / control? register (32 bits)
     60  1.1   pk  *	DHC - ???
     61  1.1   pk  *	TEC - transform engine control?
     62  1.1   pk  *	THC - TEC Hardware Configuration
     63  1.1   pk  *	ROM - a 64Kbyte ROM with who knows what in it.
     64  1.1   pk  *	colormap - see below
     65  1.1   pk  *	frame buffer memory (video RAM)
     66  1.1   pk  *	possible other stuff
     67  1.1   pk  *
     68  1.1   pk  * Like the cg3, the cg6 uses a Brooktree Video DAC (see btreg.h).
     69  1.1   pk  *
     70  1.1   pk  * Various revisions of the cgsix have various hardware bugs.  So far,
     71  1.1   pk  * we have only seen rev 1 & 2.
     72  1.1   pk  */
     73  1.1   pk 
     74  1.1   pk /* Control register banks offsets */
     75  1.1   pk #define CGSIX_ROM_OFFSET	0x000000
     76  1.1   pk #define CGSIX_BT_OFFSET		0x200000
     77  1.1   pk #define CGSIX_DHC_OFFSET	0x240000
     78  1.1   pk #define CGSIX_ALT_OFFSET	0x280000
     79  1.1   pk #define CGSIX_FHC_OFFSET	0x300000
     80  1.1   pk #define CGSIX_THC_OFFSET	0x301000
     81  1.1   pk #define CGSIX_FBC_OFFSET	0x700000
     82  1.1   pk #define CGSIX_TEC_OFFSET	0x701000
     83  1.1   pk #define CGSIX_RAM_OFFSET	0x800000
     84  1.1   pk 
     85  1.1   pk /* bits in FHC register */
     86  1.1   pk #define	FHC_FBID_MASK	0xff000000	/* bits 24..31 are frame buffer ID */
     87  1.1   pk #define	FHC_FBID_SHIFT	24
     88  1.1   pk #define	FHC_REV_MASK	0x00f00000	/* bits 20..23 are revision */
     89  1.1   pk #define	FHC_REV_SHIFT	20
     90  1.1   pk #define	FHC_FROP_DISABLE 0x00080000	/* disable fast/font? rasterops */
     91  1.1   pk #define	FHC_ROW_DISABLE	0x00040000	/* ??? */
     92  1.1   pk #define	FHC_SRC_DISABLE	0x00020000	/* ??? */
     93  1.1   pk #define	FHC_DST_DISABLE	0x00010000	/* disable destination cache */
     94  1.1   pk #define	FHC_RESET	0x00008000	/* ??? */
     95  1.1   pk #define	FHC_XXX0	0x00004000	/* ??? */
     96  1.1   pk #define	FHC_LEBO	0x00002000	/* set little endian byte order? */
     97  1.1   pk #define	FHC_RES_MASK	0x00001800	/* bits 11&12 are resolution */
     98  1.1   pk #define	FHC_RES_1024	 0x00000000		/* res = 1024x768 */
     99  1.1   pk #define	FHC_RES_1152	 0x00000800		/* res = 1152x900 */
    100  1.1   pk #define	FHC_RES_1280	 0x00001000		/* res = 1280x1024 */
    101  1.1   pk #define	FHC_RES_1600	 0x00001800		/* res = 1600x1200 */
    102  1.1   pk #define	FHC_CPU_MASK	0x00000600	/* bits 9&10 are cpu type */
    103  1.1   pk #define	FHC_CPU_SPARC	 0x00000000		/* cpu = sparc */
    104  1.1   pk #define	FHC_CPU_68020	 0x00000200		/* cpu = 68020 */
    105  1.1   pk #define	FHC_CPU_386	 0x00000400		/* cpu = 80386 */
    106  1.1   pk #define	FHC_CPU_XXX	 0x00000600		/* ??? */
    107  1.1   pk #define	FHC_TEST	0x00000100	/* ??? test window ??? */
    108  1.1   pk #define	FHC_TESTX_MASK	0x000000f0	/* bits 4..7 are test window X */
    109  1.1   pk #define	FHC_TESTX_SHIFT	4
    110  1.1   pk #define	FHC_TESTY_MASK	0x0000000f	/* bits 0..3 are test window Y */
    111  1.1   pk #define	FHC_TESTY_SHIFT	0
    112  1.1   pk 
    113  1.1   pk /*
    114  1.1   pk  * The layout of the THC.
    115  1.1   pk  */
    116  1.1   pk struct cg6_thc {
    117  1.1   pk 	u_int32_t	thc_xxx0[512];	/* ??? */
    118  1.1   pk 	u_int32_t	thc_hsync1;	/* horizontal sync timing */
    119  1.1   pk 	u_int32_t	thc_hsync2;	/* more hsync timing */
    120  1.1   pk 	u_int32_t	thc_hsync3;	/* yet more hsync timing */
    121  1.1   pk 	u_int32_t	thc_vsync1;	/* vertical sync timing */
    122  1.1   pk 	u_int32_t	thc_vsync2;	/* only two of these */
    123  1.1   pk 	u_int32_t	thc_refresh;	/* refresh counter */
    124  1.1   pk 	u_int32_t	thc_misc;	/* miscellaneous control & status */
    125  1.1   pk 	u_int32_t	thc_xxx1[56];	/* ??? */
    126  1.1   pk 	u_int32_t	thc_cursxy;	/* cursor x,y position (16 bits each) */
    127  1.1   pk 	u_int32_t	thc_cursmask[32];/* cursor mask bits */
    128  1.1   pk 	u_int32_t	thc_cursbits[32];/* what to show where mask enabled */
    129  1.1   pk };
    130  1.1   pk 
    131  1.1   pk /* bits in thc_misc */
    132  1.1   pk #define	THC_MISC_XXX0		0xfff00000	/* unused */
    133  1.1   pk #define	THC_MISC_REVMASK	0x000f0000	/* cg6 revision? */
    134  1.1   pk #define	THC_MISC_REVSHIFT	16
    135  1.1   pk #define	THC_MISC_XXX1		0x0000e000	/* unused */
    136  1.1   pk #define	THC_MISC_RESET		0x00001000	/* ??? */
    137  1.1   pk #define	THC_MISC_XXX2		0x00000800	/* unused */
    138  1.1   pk #define	THC_MISC_VIDEN		0x00000400	/* video enable */
    139  1.1   pk #define	THC_MISC_SYNC		0x00000200	/* not sure what ... */
    140  1.1   pk #define	THC_MISC_VSYNC		0x00000100	/* ... these really are */
    141  1.1   pk #define	THC_MISC_SYNCEN		0x00000080	/* sync enable */
    142  1.1   pk #define	THC_MISC_CURSRES	0x00000040	/* cursor resolution */
    143  1.1   pk #define	THC_MISC_INTEN		0x00000020	/* v.retrace intr enable */
    144  1.1   pk #define	THC_MISC_INTR		0x00000010	/* intr pending / ack bit */
    145  1.1   pk #define	THC_MISC_XXX		0x0000000f	/* ??? */
    146  1.1   pk 
    147  1.1   pk /* cursor x / y position value for `off' */
    148  1.1   pk #define	THC_CURSOFF	(65536-32)	/* i.e., USHRT_MAX+1-32 */
    149  1.1   pk 
    150  1.1   pk /*
    151  1.1   pk  * Partial description of TEC (needed to get around FHC rev 1 bugs).
    152  1.1   pk  */
    153  1.1   pk struct cg6_tec_xxx {
    154  1.1   pk 	u_int32_t	tec_mv;		/* matrix stuff */
    155  1.1   pk 	u_int32_t	tec_clip;	/* clipping stuff */
    156  1.1   pk 	u_int32_t	tec_vdc;	/* ??? */
    157  1.1   pk };
    158  1.1   pk 
    159  1.1   pk /*
    160  1.1   pk  * Partial description of FBC
    161  1.1   pk  *
    162  1.1   pk  * Most of this we don't care about; here are only the portions
    163  1.1   pk  * we need, most notably the blitter.  Comments are merely my
    164  1.1   pk  * best guesses as to register functions, based largely on the
    165  1.1   pk  * X11R6.4 sunGX code.  Some of these are here only so we can
    166  1.1   pk  * stuff canned values in them (eg, offx).
    167  1.1   pk  */
    168  1.1   pk struct cg6_fbc {
    169  1.1   pk 	u_int32_t fbc_pad1[2];
    170  1.1   pk 	u_int32_t fbc_clip;		/* function unknown */
    171  1.1   pk 	u_int32_t fbc_pad2[1];
    172  1.1   pk 	u_int32_t fbc_s;		/* global status */
    173  1.1   pk 	u_int32_t fbc_draw;		/* drawing pipeline status */
    174  1.1   pk 	u_int32_t fbc_blit;		/* blitter status */
    175  1.1   pk 	u_int32_t fbc_pad3[25];
    176  1.1   pk 	u_int32_t fbc_x0;		/* blitter, src llx */
    177  1.1   pk 	u_int32_t fbc_y0;		/* blitter, src lly */
    178  1.1   pk 	u_int32_t fbc_pad4[2];
    179  1.1   pk 	u_int32_t fbc_x1;		/* blitter, src urx */
    180  1.1   pk 	u_int32_t fbc_y1;		/* blitter, src ury */
    181  1.1   pk 	u_int32_t fbc_pad5[2];
    182  1.1   pk 	u_int32_t fbc_x2;		/* blitter, dst llx */
    183  1.1   pk 	u_int32_t fbc_y2;		/* blitter, dst lly */
    184  1.1   pk 	u_int32_t fbc_pad6[2];
    185  1.1   pk 	u_int32_t fbc_x3;		/* blitter, dst urx */
    186  1.1   pk 	u_int32_t fbc_y3;		/* blitter, dst ury */
    187  1.1   pk 	u_int32_t fbc_pad7[2];
    188  1.1   pk 	u_int32_t fbc_offx;		/* x offset for drawing */
    189  1.1   pk 	u_int32_t fbc_offy;		/* y offset for drawing */
    190  1.1   pk 	u_int32_t fbc_pad8[6];
    191  1.1   pk 	u_int32_t fbc_clipminx;		/* clip rectangle llx */
    192  1.1   pk 	u_int32_t fbc_clipminy;		/* clip rectangle lly */
    193  1.1   pk 	u_int32_t fbc_pad9[2];
    194  1.1   pk 	u_int32_t fbc_clipmaxx;		/* clip rectangle urx */
    195  1.1   pk 	u_int32_t fbc_clipmaxy;		/* clip rectangle ury */
    196  1.1   pk 	u_int32_t fbc_pad10[2];
    197  1.1   pk 	u_int32_t fbc_fg;		/* fg value for rop */
    198  1.1   pk 	u_int32_t fbc_pad11[1];
    199  1.1   pk 	u_int32_t fbc_alu;		/* operation to be performed */
    200  1.1   pk 	u_int32_t fbc_pad12[509];
    201  1.1   pk 	u_int32_t fbc_arectx;		/* rectangle drawing, x coord */
    202  1.1   pk 	u_int32_t fbc_arecty;		/* rectangle drawing, y coord */
    203  1.1   pk 	/* actually much more, but nothing more we need */
    204  1.1   pk };
    205  1.1   pk 
    206  1.1   pk #if _CG6_LAYOUT_NOT_USED_ANYMORE
    207  1.1   pk /*
    208  1.1   pk  * This structure exists only to compute the layout of the CG6
    209  1.1   pk  * hardware.  Each of the individual substructures lives on a
    210  1.1   pk  * separate `page' (where a `page' is at least 4K), and many are
    211  1.1   pk  * very far apart.  We avoid large offsets (which make for lousy
    212  1.1   pk  * code) by using pointers to the individual interesting pieces,
    213  1.1   pk  * and map them in independently (to avoid using up PTEs unnecessarily).
    214  1.1   pk  */
    215  1.1   pk struct cg6_layout {
    216  1.1   pk 	/* ROM at 0 */
    217  1.1   pk 	union {
    218  1.2  eeh 		int un_id;		/* ID = ?? */
    219  1.1   pk 		char un_rom[65536];	/* 64K rom */
    220  1.1   pk 		char un_pad[0x200000];
    221  1.1   pk 	} cg6_rom_un;
    222  1.1   pk 
    223  1.1   pk 	/* Brooktree DAC at 0x200000 */
    224  1.1   pk 	union {
    225  1.1   pk 		struct bt_regs un_btregs;
    226  1.1   pk 		char un_pad[0x040000];
    227  1.1   pk 	} cg6_bt_un;
    228  1.1   pk 
    229  1.1   pk 	/* DHC, whatever that is, at 0x240000 */
    230  1.1   pk 	union {
    231  1.1   pk 		char un_pad[0x40000];
    232  1.1   pk 	} cg6_dhc_un;
    233  1.1   pk 
    234  1.1   pk 	/* ALT, whatever that is, at 0x280000 */
    235  1.1   pk 	union {
    236  1.1   pk 		char un_pad[0x80000];
    237  1.1   pk 	} cg6_alt_un;
    238  1.1   pk 
    239  1.1   pk 	/* FHC register at 0x300000 */
    240  1.1   pk 	union {
    241  1.1   pk 		int un_fhc;
    242  1.1   pk 		char un_pad[0x1000];
    243  1.1   pk 	} cg6_fhc_un;
    244  1.1   pk 
    245  1.1   pk 	/* THC at 0x301000 */
    246  1.1   pk 	union {
    247  1.1   pk 		struct cg6_thc un_thc;
    248  1.1   pk 		char un_pad[0x400000 - 0x1000];
    249  1.1   pk 	} cg6_thc_un;
    250  1.1   pk 
    251  1.1   pk 	/* FBC at 0x700000 */
    252  1.1   pk 	union {
    253  1.1   pk 		char un_pad[0x1000];
    254  1.1   pk 	} cg6_fbc_un;
    255  1.1   pk 
    256  1.1   pk 	/* TEC at 0x701000 */
    257  1.1   pk 	union {
    258  1.1   pk 		char un_pad[0x100000 - 0x1000];
    259  1.1   pk 		struct cg6_tec_xxx un_tec;
    260  1.1   pk 	} cg6_tec_un;
    261  1.1   pk 
    262  1.1   pk 	/* Video RAM at 0x800000 */
    263  1.1   pk 	char	cg6_ram[1024 * 1024];	/* approx.? */
    264  1.1   pk };
    265  1.1   pk #endif
    266