xref: /freebsd-12.1/sys/dev/fb/creatorreg.h (revision 7d0fc2f4)
1 /*-
2  * Copyright (c) 2003 Jake Burkholder.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 
29 #ifndef _DEV_FB_CREATOR_H_
30 #define	_DEV_FB_CREATOR_H_
31 
32 #define	FFB_NREG		24
33 
34 #define	FFB_DAC			1
35 #define	FFB_DAC_TYPE		0x0
36 #define	FFB_DAC_VALUE		0x4
37 #define	FFB_DAC_TYPE2		0x8
38 #define	FFB_DAC_VALUE2		0xc
39 
40 #define	FFB_FBC			2
41 #define	FFB_FBC_BY		0x60
42 #define	FFB_FBC_BX		0x64
43 #define	FFB_FBC_DY		0x68
44 #define	FFB_FBC_DX		0x6c
45 #define	FFB_FBC_BH		0x70
46 #define	FFB_FBC_BW		0x74
47 #define	FFB_FBC_PPC		0x200		/* Pixel Processor Control */
48 #define	FFB_FBC_FG		0x208		/* Foreground */
49 #define	FFB_FBC_BG		0x20c		/* Background */
50 #define	FFB_FBC_FBC		0x254		/* Frame Buffer Control */
51 #define	FFB_FBC_ROP		0x258		/* Raster Operation */
52 #define	FFB_FBC_PMASK		0x290		/* Pixel Mask */
53 #define	FFB_FBC_DRAWOP		0x300		/* Draw Operation */
54 #define	FFB_FBC_FONTXY		0x314		/* Font X/Y */
55 #define	FFB_FBC_FONTW		0x318		/* Font Width */
56 #define	FFB_FBC_FONTINC		0x31c		/* Font Increment */
57 #define	FFB_FBC_FONT		0x320		/* Font Data */
58 #define	FFB_FBC_UCSR		0x900		/* User Control & Status */
59 
60 #define	FBC_PPC_VCE_DIS		0x00001000
61 #define	FBC_PPC_APE_DIS		0x00000800
62 #define	FBC_PPC_TBE_OPAQUE	0x00000200
63 #define	FBC_PPC_CS_CONST	0x00000003
64 
65 #define	FFB_FBC_WB_A		0x20000000
66 #define	FFB_FBC_RB_A		0x00004000
67 #define	FFB_FBC_SB_BOTH		0x00003000
68 #define	FFB_FBC_XE_OFF		0x00000040
69 #define	FFB_FBC_RGBE_MASK	0x0000003f
70 
71 #define	FBC_ROP_NEW		0x83
72 
73 #define	FBC_DRAWOP_RECTANGLE	0x08
74 
75 #define	FBC_UCSR_FIFO_OVFL	0x80000000
76 #define	FBC_UCSR_READ_ERR	0x40000000
77 #define	FBC_UCSR_RP_BUSY	0x02000000
78 #define	FBC_UCSR_FB_BUSY	0x01000000
79 #define	FBC_UCSR_FIFO_MASK	0x00000fff
80 
81 #define	FFB_VIRT_SFB8R		0x00000000
82 #define	FFB_VIRT_SFB8G		0x00400000
83 #define	FFB_VIRT_SFB8B		0x00800000
84 #define	FFB_VIRT_SFB8X		0x00c00000
85 #define	FFB_VIRT_SFB32		0x01000000
86 #define	FFB_VIRT_SFB64		0x02000000
87 #define	FFB_VIRT_FBC		0x04000000
88 #define	FFB_VIRT_FBC_BM		0x04002000
89 #define	FFB_VIRT_DFB8R		0x04004000
90 #define	FFB_VIRT_DFB8G		0x04404000
91 #define	FFB_VIRT_DFB8B		0x04804000
92 #define	FFB_VIRT_DFB8X		0x04c04000
93 #define	FFB_VIRT_DFB24		0x05004000
94 #define	FFB_VIRT_DFB32		0x06004000
95 #define	FFB_VIRT_DFB422A	0x07004000
96 #define	FFB_VIRT_DFB422AD	0x07804000
97 #define	FFB_VIRT_DFB24B		0x08004000
98 #define	FFB_VIRT_DFB422B	0x09004000
99 #define	FFB_VIRT_DFB422BD	0x09804000
100 #define	FFB_VIRT_SFB16Z		0x0a004000
101 #define	FFB_VIRT_SFB8Z		0x0a404000
102 #define	FFB_VIRT_SFB422		0x0ac04000
103 #define	FFB_VIRT_SFB422D	0x0b404000
104 #define	FFB_VIRT_FBC_KREG	0x0bc04000
105 #define	FFB_VIRT_DAC		0x0bc06000
106 #define	FFB_VIRT_PROM		0x0bc08000
107 #define	FFB_VIRT_EXP		0x0bc18000
108 
109 #define	FFB_PHYS_SFB8R		0x04000000
110 #define	FFB_PHYS_SFB8G		0x04400000
111 #define	FFB_PHYS_SFB8B		0x04800000
112 #define	FFB_PHYS_SFB8X		0x04c00000
113 #define	FFB_PHYS_SFB32		0x05000000
114 #define	FFB_PHYS_SFB64		0x06000000
115 #define	FFB_PHYS_FBC		0x00600000
116 #define	FFB_PHYS_FBC_BM		0x00600000
117 #define	FFB_PHYS_DFB8R		0x01000000
118 #define	FFB_PHYS_DFB8G		0x01400000
119 #define	FFB_PHYS_DFB8B		0x01800000
120 #define	FFB_PHYS_DFB8X		0x01c00000
121 #define	FFB_PHYS_DFB24		0x02000000
122 #define	FFB_PHYS_DFB32		0x03000000
123 #define	FFB_PHYS_DFB422A	0x09000000
124 #define	FFB_PHYS_DFB422AD	0x09800000
125 #define	FFB_PHYS_DFB24B		0x0a000000
126 #define	FFB_PHYS_DFB422B	0x0b000000
127 #define	FFB_PHYS_DFB422BD	0x0b800000
128 #define	FFB_PHYS_SFB16Z		0x0c800000
129 #define	FFB_PHYS_SFB8Z		0x0c000000
130 #define	FFB_PHYS_SFB422		0x0d000000
131 #define	FFB_PHYS_SFB422D	0x0d800000
132 #define	FFB_PHYS_FBC_KREG	0x00610000
133 #define	FFB_PHYS_DAC		0x00400000
134 #define	FFB_PHYS_PROM		0x00000000
135 #define	FFB_PHYS_EXP		0x00200000
136 
137 #define	FFB_READ(sc, reg, off) \
138 	bus_space_read_4((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off))
139 #define	FFB_WRITE(sc, reg, off, val) \
140 	bus_space_write_4((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off), (val))
141 
142 struct creator_softc {
143 	video_adapter_t		sc_va;			/* XXX must be first */
144 
145 	struct cdev *sc_si;
146 
147 	struct resource		*sc_reg[FFB_NREG];
148 	bus_space_tag_t		sc_bt[FFB_NREG];
149 	bus_space_handle_t	sc_bh[FFB_NREG];
150 	char			sc_model[32];
151 	int			sc_console;
152 	int			sc_dac;
153 
154 	int			sc_height;
155 	int			sc_width;
156 	int			sc_ncol;
157 	int			sc_nrow;
158 
159 	int			sc_xmargin;
160 	int			sc_ymargin;
161 
162 	u_char			*sc_font;
163 	int			*sc_rowp;
164 	int			*sc_colp;
165 
166 	int			sc_bg_cache;
167 	int			sc_fg_cache;
168 	int			sc_fifo_cache;
169 };
170 
171 #endif
172