xref: /netbsd-src/sys/arch/sparc/dev/cgfourteenvar.h (revision a5847cc334d9a7029f6352b847e9e8d71a0f9e0c)
1 /*	$NetBSD: cgfourteenvar.h,v 1.13 2010/08/31 21:14:57 macallan Exp $ */
2 
3 /*
4  * Copyright (c) 1996
5  *	The President and Fellows of Harvard College. 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  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *	This product includes software developed by Harvard University and
18  *	its contributors.
19  * 4. Neither the name of the University nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  */
35 struct sbus_reg {
36 	uint32_t	sbr_slot;
37 	uint32_t	sbr_offset;
38 	uint32_t	sbr_size;
39 };
40 /*
41  * Layout of cg14 hardware colormap
42  */
43 union cg14cmap {
44 	u_char  	cm_map[256][4];	/* 256 R/G/B/A entries (B is high)*/
45 	uint32_t   	cm_chip[256];	/* the way the chip gets loaded */
46 };
47 
48 /*
49  * cg14 hardware cursor colormap
50  */
51 union cg14cursor_cmap {		/* colormap, like bt_cmap, but tiny */
52 	u_char		cm_map[2][4];	/* 2 R/G/B/A entries */
53 	uint32_t	cm_chip[2];	/* 2 chip equivalents */
54 };
55 
56 /*
57  * cg14 hardware cursor status
58  */
59 struct cg14_cursor {		/* cg14 hardware cursor status */
60 	int	cc_enable;		/* cursor is enabled */
61 	struct	fbcurpos cc_pos;	/* position */
62 	struct	fbcurpos cc_hot;	/* hot-spot */
63 	struct	fbcurpos cc_size;	/* size of mask & image fields */
64 	uint	cc_eplane[32];		/* enable plane */
65 	uint	cc_cplane[32];		/* color plane */
66 	union	cg14cursor_cmap cc_color; /* cursor colormap */
67 };
68 
69 #define CG14_SET_PIXELMODE	_IOW('M', 3, int)
70 
71 /*
72  * per-cg14 variables/state
73  */
74 struct cgfourteen_softc {
75 	device_t	sc_dev;		/* base device */
76 	struct fbdevice	sc_fb;		/* frame buffer device */
77 #ifdef RASTERCONSOLE
78 	struct fbdevice	sc_rcfb;	/* sc_fb variant for rcons */
79 #endif
80 	bus_space_tag_t	sc_bustag;
81 	struct sbus_reg	sc_physadr[2];	/* phys addrs of h/w */
82 	bus_space_handle_t sc_regh;	/* register space */
83 #define CG14_CTL_IDX	0
84 #define CG14_PXL_IDX	1
85 
86 	union	cg14cmap sc_cmap;	/* current colormap */
87 	struct	cg14_cursor sc_cursor;	/* Hardware cursor state */
88 	union 	cg14cmap sc_saveclut; 	/* a place to stash PROM state */
89 	size_t	sc_vramsize;
90 	int 	sc_depth;	/* current colour depth */
91 #if NWSDISPLAY > 0
92 	struct  vcons_data sc_vd;
93 	struct 	vcons_screen sc_console_screen;
94 	struct 	wsscreen_descr sc_defaultscreen_descr;
95 	const struct wsscreen_descr *sc_screens[1];
96 	struct 	wsscreen_list sc_screenlist;
97 	int 	sc_mode;	/* wsdisplay mode - EMUL, DUMB etc. */
98 #endif
99 
100 	uint8_t	sc_savexlut[256];
101 	uint8_t	sc_savectl;
102 	uint8_t	sc_savehwc;
103 
104 	struct	cg14ctl  *sc_ctl; 	/* various registers */
105 	struct	cg14curs *sc_hwc;
106 	struct 	cg14dac	 *sc_dac;
107 	struct	cg14xlut *sc_xlut;
108 	struct 	cg14clut *sc_clut1;
109 	struct	cg14clut *sc_clut2;
110 	struct	cg14clut *sc_clut3;
111 	uint	*sc_clutincr;
112 	int	sc_opens;
113 	off_t	sc_regaddr, sc_fbaddr;
114 };
115 
116 /* Various offsets in virtual (ie. mmap()) spaces Linux and Solaris support. */
117 #define CG14_REGS_VOFF		0x00000000	/* registers */
118 #define CG14_XLUT_VOFF		0x00003000	/* X Look Up Table */
119 #define CG14_CLUT1_VOFF		0x00004000	/* Color Look Up Table */
120 #define CG14_CLUT2_VOFF		0x00005000	/* Color Look Up Table */
121 #define CG14_CLUT3_VOFF		0x00006000	/* Color Look Up Table */
122 #define CG14_DIRECT_VOFF	0x10000000
123 #define CG14_CTLREG_VOFF	0x20000000
124 #define CG14_CURSOR_VOFF	0x30000000
125 #define CG14_SHDW_VRT_VOFF	0x40000000
126 #define CG14_XBGR_VOFF		0x50000000
127 #define CG14_BGR_VOFF		0x60000000
128 #define CG14_X16_VOFF		0x70000000
129 #define CG14_C16_VOFF		0x80000000
130 #define CG14_X32_VOFF		0x90000000
131 #define CG14_B32_VOFF		0xa0000000
132 #define CG14_G32_VOFF		0xb0000000
133 #define CG14_R32_VOFF		0xc0000000
134