xref: /netbsd-src/sys/arch/sparc64/dev/ffbvar.h (revision aaf4ece63a859a04e37cf3a7229b5fab0157cc06)
1 /*	$NetBSD: ffbvar.h,v 1.6 2005/12/11 12:19:09 christos Exp $	*/
2 /*	$OpenBSD: creatorvar.h,v 1.6 2002/07/30 19:48:15 jason Exp $	*/
3 
4 /*
5  * Copyright (c) 2002 Jason L. Wright (jason@thought.net),
6  *  Federico G. Schwindt (fgsch@openbsd.org)
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  *    must display the following acknowledgement:
19  *	This product includes software developed by Jason L. Wright
20  * 4. The name of the author may not be used to endorse or promote products
21  *    derived from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
27  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #define FFB_CREATOR		0
37 #define FFB_AFB			1
38 
39 #define	FFB_CFFLAG_NOACCEL	0x1
40 
41 struct ffb_softc {
42 	struct device sc_dv;
43 	struct fbdevice sc_fb;
44 	bus_space_tag_t sc_bt;
45 	bus_space_handle_t sc_pixel_h;
46 	bus_space_handle_t sc_dac_h;
47 	bus_space_handle_t sc_fbc_h;
48 	bus_addr_t sc_addrs[FFB_NREGS];
49 	bus_size_t sc_sizes[FFB_NREGS];
50 	int sc_height, sc_width, sc_linebytes, sc_depth;
51 	int sc_nscreens, sc_nreg;
52 	int sc_console;
53 	int sc_node;
54 	int sc_type;
55 	u_int sc_dacrev;
56 	u_int sc_mode;
57 	int sc_accel;
58 	int32_t sc_fifo_cache, sc_fg_cache;
59 
60 	/* virtual console stuff */
61 	void (*putchar)(void *c, int row, int col, u_int uc, long attr);
62 	void (*copycols)(void *c, int row, int srccol, int dstcol, int ncols);
63 	void (*switchcb)(void *, int, int);
64 	void *switchcbarg;
65 	struct callout switch_callout;
66 	LIST_HEAD(, ffb_screen) screens;
67 	struct ffb_screen *active, *wanted;
68 	const struct wsscreen_descr *currenttype;
69 };
70 
71 struct ffb_screen {
72 	struct rasops_info ri;
73 	LIST_ENTRY(ffb_screen) next;
74 	struct ffb_softc *sc;
75 	const struct wsscreen_descr *type;
76 	int active;
77 	u_int16_t *chars;
78 	long *attrs;
79 
80 	int cursoron;
81 	int cursorcol;
82 	int cursorrow;
83 	int cursordrawn;
84 };
85 
86 #define	DAC_WRITE(sc,r,v) \
87     bus_space_write_4((sc)->sc_bt, (sc)->sc_dac_h, (r), (v))
88 #define	DAC_READ(sc,r) \
89     bus_space_read_4((sc)->sc_bt, (sc)->sc_dac_h, (r))
90 #define	FBC_WRITE(sc,r,v) \
91     bus_space_write_4((sc)->sc_bt, (sc)->sc_fbc_h, (r), (v))
92 #define	FBC_READ(sc,r) \
93     bus_space_read_4((sc)->sc_bt, (sc)->sc_fbc_h, (r))
94 
95 void	ffb_attach(struct ffb_softc *);
96