xref: /netbsd-src/sys/dev/tc/sticvar.h (revision cbab9cadce21ae72fac13910001079fff214cc29)
1*cbab9cadSchs /* 	$NetBSD: sticvar.h,v 1.19 2012/10/27 17:18:38 chs Exp $	*/
2553c5108Sad 
3553c5108Sad /*-
41b4eef27Sad  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
5553c5108Sad  * All rights reserved.
6553c5108Sad  *
7553c5108Sad  * This code is derived from software contributed to The NetBSD Foundation
8553c5108Sad  * by Andrew Doran.
9553c5108Sad  *
10553c5108Sad  * Redistribution and use in source and binary forms, with or without
11553c5108Sad  * modification, are permitted provided that the following conditions
12553c5108Sad  * are met:
13553c5108Sad  * 1. Redistributions of source code must retain the above copyright
14553c5108Sad  *    notice, this list of conditions and the following disclaimer.
15553c5108Sad  * 2. Redistributions in binary form must reproduce the above copyright
16553c5108Sad  *    notice, this list of conditions and the following disclaimer in the
17553c5108Sad  *    documentation and/or other materials provided with the distribution.
18553c5108Sad  *
19553c5108Sad  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20553c5108Sad  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21553c5108Sad  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22553c5108Sad  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23553c5108Sad  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24553c5108Sad  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25553c5108Sad  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26553c5108Sad  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27553c5108Sad  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28553c5108Sad  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29553c5108Sad  * POSSIBILITY OF SUCH DAMAGE.
30553c5108Sad  */
31553c5108Sad 
32553c5108Sad #ifndef _TC_STICVAR_H_
33553c5108Sad #define	_TC_STICVAR_H_
34553c5108Sad 
35553c5108Sad #if defined(pmax)
36553c5108Sad #define	STIC_KSEG_TO_PHYS(x)	MIPS_KSEG0_TO_PHYS(x)
37553c5108Sad #elif defined(alpha)
38571ef6d8Sad #define	STIC_KSEG_TO_PHYS(x)	ALPHA_K0SEG_TO_PHYS((vaddr_t)x)
39070bb0afSwiz #else
40070bb0afSwiz #error No support for your architecture
41553c5108Sad #endif
42553c5108Sad 
434824a8d9Sad #define	STIC_MAXDV	5
444824a8d9Sad 
45553c5108Sad struct stic_hwcmap256 {
46553c5108Sad #define	CMAP_SIZE	256	/* 256 R/G/B entries */
47553c5108Sad 	u_int8_t	r[CMAP_SIZE];
48553c5108Sad 	u_int8_t	g[CMAP_SIZE];
49553c5108Sad 	u_int8_t	b[CMAP_SIZE];
50553c5108Sad };
51553c5108Sad 
52553c5108Sad struct stic_hwcursor64 {
53553c5108Sad 	struct	wsdisplay_curpos cc_pos;
54553c5108Sad 	struct	wsdisplay_curpos cc_hot;
55553c5108Sad 	struct	wsdisplay_curpos cc_size;
56553c5108Sad #define	CURSOR_MAX_SIZE	64
57553c5108Sad 	u_int8_t	cc_color[6];
58e07f0b93Schs 	u_int64_t	cc_image[CURSOR_MAX_SIZE];
59e07f0b93Schs 	u_int64_t	cc_mask[CURSOR_MAX_SIZE];
60553c5108Sad };
61553c5108Sad 
62553c5108Sad struct stic_screen {
63553c5108Sad 	struct	stic_info *ss_si;
64553c5108Sad 	u_int16_t	*ss_backing;
65553c5108Sad 	int	ss_flags;
66553c5108Sad 	int	ss_curx;
67553c5108Sad 	int	ss_cury;
68553c5108Sad };
69553c5108Sad 
701b4eef27Sad #define	SS_ALLOCED		0x01
711b4eef27Sad #define	SS_ACTIVE		0x02
72571ef6d8Sad #define	SS_CURENB		0x04
73553c5108Sad 
74553c5108Sad struct stic_info {
75*cbab9cadSchs 	device_t	si_dv;
764824a8d9Sad 
77553c5108Sad 	u_int32_t	*si_stamp;
78024d36d3Sad 	u_int32_t	*si_buf;
79553c5108Sad 	u_int32_t	*si_vdac;
80553c5108Sad 	u_int32_t	*si_vdac_reset;
81553c5108Sad 	volatile struct	stic_regs *si_stic;
824824a8d9Sad 	volatile struct stic_xcomm *si_sxc;
83553c5108Sad 
84553c5108Sad 	u_int32_t	*(*si_pbuf_get)(struct stic_info *);
85553c5108Sad 	int	(*si_pbuf_post)(struct stic_info *, u_int32_t *);
8653524e44Schristos 	int	(*si_ioctl)(struct stic_info *, u_long, void *, int,
8795e1ffb1Schristos 			   struct lwp *);
88553c5108Sad 	int	si_pbuf_select;
894824a8d9Sad 	int	si_hwflags;
90553c5108Sad 
91553c5108Sad 	struct	stic_screen *si_curscreen;
92553c5108Sad 	struct	wsdisplay_font *si_font;
93553c5108Sad 
94553c5108Sad 	int	si_consw;
95553c5108Sad 	int	si_consh;
96553c5108Sad 	int	si_fontw;
97553c5108Sad 	int	si_fonth;
98553c5108Sad 	int	si_stamph;
99287977b3Sad 	int	si_stamphm;
100553c5108Sad 	int	si_stampw;
101553c5108Sad 	int	si_depth;
1024824a8d9Sad 	int	si_disptype;
1034824a8d9Sad 	int	si_dispmode;
1044824a8d9Sad 	int	si_unit;
105553c5108Sad 
106553c5108Sad 	tc_addr_t si_slotbase;
107024d36d3Sad 	paddr_t	si_buf_phys;
108024d36d3Sad 	size_t	si_buf_size;
109553c5108Sad 
1101b4eef27Sad 	int	si_flags;
1111b4eef27Sad 	struct	stic_hwcursor64 si_cursor;
1121b4eef27Sad 	struct	stic_hwcmap256 si_cmap;
113553c5108Sad 
114553c5108Sad 	struct	callout si_switch_callout;
115553c5108Sad 	void	(*si_switchcb)(void *, int, int);
116553c5108Sad 	void	*si_switchcbarg;
117553c5108Sad };
118553c5108Sad 
1191b4eef27Sad #define	SI_CURENB_CHANGED	0x0001
1201b4eef27Sad #define	SI_CURCMAP_CHANGED	0x0002
1211b4eef27Sad #define	SI_CURSHAPE_CHANGED	0x0004
1221b4eef27Sad #define	SI_CMAP_CHANGED		0x0008
1231b4eef27Sad #define	SI_ALL_CHANGED		0x000f
1244824a8d9Sad #define	SI_DVOPEN		0x0010
1251b4eef27Sad 
126553c5108Sad void	stic_init(struct stic_info *);
12785d049a7Sjoerg void	stic_attach(device_t, struct stic_info *, int);
128553c5108Sad void	stic_cnattach(struct stic_info *);
129553c5108Sad void	stic_reset(struct stic_info *);
130553c5108Sad void	stic_flush(struct stic_info *);
131553c5108Sad 
132553c5108Sad extern struct stic_info stic_consinfo;
133553c5108Sad 
134553c5108Sad #endif	/* !_TC_STICVAR_H_ */
135