xref: /netbsd/sys/dev/sun/cgsixvar.h (revision 6550d01e)
1 /*	$NetBSD: cgsixvar.h,v 1.12 2009/02/20 22:55:26 martin Exp $ */
2 
3 /*-
4  * Copyright (c) 1998 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Paul Kranenburg.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #include "wsdisplay.h"
33 #include <dev/wscons/wsdisplay_vconsvar.h>
34 
35 /*
36  * color display (cgsix) driver; common definitions.
37  */
38 
39 union cursor_cmap {		/* colormap, like bt_cmap, but tiny */
40 	u_char	cm_map[2][3];	/* 2 R/G/B entries */
41 	u_int	cm_chip[2];	/* 2 chip equivalents */
42 };
43 
44 struct cg6_cursor {		/* cg6 hardware cursor status */
45 	short	cc_enable;		/* cursor is enabled */
46 	struct	fbcurpos cc_pos;	/* position */
47 	struct	fbcurpos cc_hot;	/* hot-spot */
48 	struct	fbcurpos cc_size;	/* size of mask & image fields */
49 	u_int	cc_bits[2][32];		/* space for mask & image bits */
50 	union	cursor_cmap cc_color;	/* cursor colormap */
51 };
52 
53 /* per-display variables */
54 struct cgsix_softc {
55 	device_t	sc_dev;		/* base device */
56 	struct fbdevice	sc_fb;		/* frame buffer device */
57 	bus_space_tag_t	sc_bustag;
58 	bus_addr_t	sc_paddr;	/* phys address for device mmap() */
59 
60 	volatile struct bt_regs *sc_bt;		/* Brooktree registers */
61 	volatile int *sc_fhc;			/* FHC register */
62 	volatile struct cg6_thc *sc_thc;	/* THC registers */
63 	volatile struct cg6_tec_xxx *sc_tec;	/* TEC registers */
64 	volatile struct cg6_fbc *sc_fbc;	/* FBC registers */
65 	short	sc_fhcrev;		/* hardware rev */
66 	short	sc_blanked;		/* true if blanked */
67 	struct	cg6_cursor sc_cursor;	/* software cursor info */
68 
69 	uint32_t sc_width;
70 	uint32_t sc_height;	/* display width / height */
71 	uint32_t sc_stride;
72 	uint32_t sc_mono_width;	/* how many monochrome pixels to write */
73 	uint32_t sc_ramsize;		/* VRAM size in bytes */
74 #if NWSDISPLAY > 0
75 	int sc_mode;
76 	uint32_t sc_bg;
77 	struct vcons_data vd;
78 	uint8_t sc_default_cmap[768];
79 #endif
80 	union	bt_cmap sc_cmap;	/* Brooktree color map */
81 };
82 
83 #ifdef RASTERCONSOLE
84 extern int cgsix_use_rasterconsole;
85 #else
86 #define cgsix_use_rasterconsole 0
87 #endif
88 
89 void	cg6attach(struct cgsix_softc *, const char *, int);
90