gffbreg.h revision 1.3 1 /* $NetBSD: gffbreg.h,v 1.3 2013/10/23 13:15:47 macallan Exp $ */
2
3 /*
4 * Copyright (c) 2013 Michael Lorenz
5 * 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 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 /*
29 * A console driver for nvidia geforce graphics controllers
30 * tested on macppc only so far
31 * register definitions are mostly from the xf86-video-nv driver
32 */
33
34 #include <sys/cdefs.h>
35 __KERNEL_RCSID(0, "$NetBSD: gffbreg.h,v 1.3 2013/10/23 13:15:47 macallan Exp $");
36
37 #ifndef GFFBREG_H
38 #define GFFBREG_H
39
40 #define GFFB_RAMDAC0 0x00680000
41 #define GFFB_RAMDAC1 0x00682000
42
43 #define GFFB_PCIO0 0x00601000
44 #define GFFB_PCIO1 0x00603000
45
46 /* VGA registers live here, one set for each head */
47 #define GFFB_PDIO0 0x00681000
48 #define GFFB_PDIO1 0x00683000
49
50 #define GFFB_CRTC0 0x00600000
51 #define GFFB_CRTC1 0x00602000
52
53 #define GFFB_FIFO 0x00800000
54 #define GFFB_FIFO_PUT 0x00800040 /* command list stop */
55 #define GFFB_FIFO_GET 0x00800044 /* command list pointer */
56
57 #define GFFB_PGRAPH 0x00400000
58 #define GFFB_BUSY 0x00400700
59
60 #define GFFB_PFB 0x00100000
61 #define GFFB_VRAM 0x0010020c /* vram size in 0xfff00000 */
62
63 #define GFFB_PRAMIN 0x00710000
64 #define GFFB_CMDSTART 0x00712098 /* ??? */
65
66 #define GFFB_PMC 0x00000000
67 #define GFFB_PFIFO 0x00002000
68 #define GFFB_PEXTDEV 0x00101000
69 #define GFFB_PTIMER 0x00009000
70
71 /* CRTC registers */
72 #define GFFB_DISPLAYSTART 0x800
73
74 /* VGA registers */
75 #define GFFB_PEL_MASK 0x3c6
76 #define GFFB_PEL_IR 0x3c7
77 #define GFFB_PEL_IW 0x3c8
78 #define GFFB_PEL_D 0x3c9
79
80 /* engine command definitions from xf86_video_nv/nv_dma.h */
81
82 /*
83 * Copyright (c) 2003 NVIDIA, Corporation
84 *
85 * Permission is hereby granted, free of charge, to any person obtaining a
86 * copy of this software and associated documentation files (the
87 * "Software"), to deal in the Software without restriction, including
88 * without limitation the rights to use, copy, modify, merge, publish,
89 * distribute, sublicense, and/or sell copies of the Software, and to
90 * permit persons to whom the Software is furnished to do so, subject to
91 * the following conditions:
92 *
93 * The above copyright notice and this permission notice shall be included
94 * in all copies or substantial portions of the Software.
95 *
96 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
97 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
98 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
99 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
100 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
101 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
102 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
103 */
104
105 #define SURFACE_FORMAT 0x00000300
106 #define SURFACE_FORMAT_DEPTH8 0x00000001
107 #define SURFACE_FORMAT_DEPTH15 0x00000002
108 #define SURFACE_FORMAT_DEPTH16 0x00000004
109 #define SURFACE_FORMAT_DEPTH24 0x00000006
110 #define SURFACE_PITCH 0x00000304
111 #define SURFACE_PITCH_SRC 15:0
112 #define SURFACE_PITCH_DST 31:16
113 #define SURFACE_OFFSET_SRC 0x00000308
114 #define SURFACE_OFFSET_DST 0x0000030C
115
116 #define ROP_SET 0x00002300
117
118 #define PATTERN_FORMAT 0x00004300
119 #define PATTERN_FORMAT_DEPTH8 0x00000003
120 #define PATTERN_FORMAT_DEPTH16 0x00000001
121 #define PATTERN_FORMAT_DEPTH24 0x00000003
122 #define PATTERN_COLOR_0 0x00004310
123 #define PATTERN_COLOR_1 0x00004314
124 #define PATTERN_PATTERN_0 0x00004318
125 #define PATTERN_PATTERN_1 0x0000431C
126
127 #define CLIP_POINT 0x00006300
128 #define CLIP_POINT_X 15:0
129 #define CLIP_POINT_Y 31:16
130 #define CLIP_SIZE 0x00006304
131 #define CLIP_SIZE_WIDTH 15:0
132 #define CLIP_SIZE_HEIGHT 31:16
133
134 #define LINE_FORMAT 0x00008300
135 #define LINE_FORMAT_DEPTH8 0x00000003
136 #define LINE_FORMAT_DEPTH16 0x00000001
137 #define LINE_FORMAT_DEPTH24 0x00000003
138 #define LINE_COLOR 0x00008304
139 #define LINE_MAX_LINES 16
140 #define LINE_LINES(i) 0x00008400\
141 +(i)*8
142 #define LINE_LINES_POINT0_X 15:0
143 #define LINE_LINES_POINT0_Y 31:16
144 #define LINE_LINES_POINT1_X 47:32
145 #define LINE_LINES_POINT1_Y 63:48
146
147 #define BLIT_POINT_SRC 0x0000A300
148 #define BLIT_POINT_SRC_X 15:0
149 #define BLIT_POINT_SRC_Y 31:16
150 #define BLIT_POINT_DST 0x0000A304
151 #define BLIT_POINT_DST_X 15:0
152 #define BLIT_POINT_DST_Y 31:16
153 #define BLIT_SIZE 0x0000A308
154 #define BLIT_SIZE_WIDTH 15:0
155 #define BLIT_SIZE_HEIGHT 31:16
156
157 #define RECT_FORMAT 0x0000C300
158 #define RECT_FORMAT_DEPTH8 0x00000003
159 #define RECT_FORMAT_DEPTH16 0x00000001
160 #define RECT_FORMAT_DEPTH24 0x00000003
161 #define RECT_SOLID_COLOR 0x0000C3FC
162 #define RECT_SOLID_RECTS_MAX_RECTS 32
163 #define RECT_SOLID_RECTS(i) 0x0000C400\
164 +(i)*8
165 #define RECT_SOLID_RECTS_Y 15:0
166 #define RECT_SOLID_RECTS_X 31:16
167 #define RECT_SOLID_RECTS_HEIGHT 47:32
168 #define RECT_SOLID_RECTS_WIDTH 63:48
169
170 #define RECT_EXPAND_ONE_COLOR_CLIP 0x0000C7EC
171 #define RECT_EXPAND_ONE_COLOR_CLIP_POINT0_X 15:0
172 #define RECT_EXPAND_ONE_COLOR_CLIP_POINT0_Y 31:16
173 #define RECT_EXPAND_ONE_COLOR_CLIP_POINT1_X 47:32
174 #define RECT_EXPAND_ONE_COLOR_CLIP_POINT1_Y 63:48
175 #define RECT_EXPAND_ONE_COLOR_COLOR 0x0000C7F4
176 #define RECT_EXPAND_ONE_COLOR_SIZE 0x0000C7F8
177 #define RECT_EXPAND_ONE_COLOR_SIZE_WIDTH 15:0
178 #define RECT_EXPAND_ONE_COLOR_SIZE_HEIGHT 31:16
179 #define RECT_EXPAND_ONE_COLOR_POINT 0x0000C7FC
180 #define RECT_EXPAND_ONE_COLOR_POINT_X 15:0
181 #define RECT_EXPAND_ONE_COLOR_POINT_Y 31:16
182 #define RECT_EXPAND_ONE_COLOR_DATA_MAX_DWORDS 128
183 #define RECT_EXPAND_ONE_COLOR_DATA(i) 0x0000C800\
184 +(i)*4
185
186 #define RECT_EXPAND_TWO_COLOR_CLIP 0x0000CBE4
187 #define RECT_EXPAND_TWO_COLOR_CLIP_POINT0_X 15:0
188 #define RECT_EXPAND_TWO_COLOR_CLIP_POINT0_Y 31:16
189 #define RECT_EXPAND_TWO_COLOR_CLIP_POINT1_X 47:32
190 #define RECT_EXPAND_TWO_COLOR_CLIP_POINT1_Y 63:48
191 #define RECT_EXPAND_TWO_COLOR_COLOR_0 0x0000CBEC
192 #define RECT_EXPAND_TWO_COLOR_COLOR_1 0x0000CBF0
193 #define RECT_EXPAND_TWO_COLOR_SIZE_IN 0x0000CBF4
194 #define RECT_EXPAND_TWO_COLOR_SIZE_IN_WIDTH 15:0
195 #define RECT_EXPAND_TWO_COLOR_SIZE_IN_HEIGHT 31:16
196 #define RECT_EXPAND_TWO_COLOR_SIZE_OUT 0x0000CBF8
197 #define RECT_EXPAND_TWO_COLOR_SIZE_OUT_WIDTH 15:0
198 #define RECT_EXPAND_TWO_COLOR_SIZE_OUT_HEIGHT 31:16
199 #define RECT_EXPAND_TWO_COLOR_POINT 0x0000CBFC
200 #define RECT_EXPAND_TWO_COLOR_POINT_X 15:0
201 #define RECT_EXPAND_TWO_COLOR_POINT_Y 31:16
202 #define RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS 128
203 #define RECT_EXPAND_TWO_COLOR_DATA(i) 0x0000CC00\
204 +(i)*4
205
206 #define STRETCH_BLIT_FORMAT 0x0000E300
207 #define STRETCH_BLIT_FORMAT_DEPTH8 0x00000004
208 #define STRETCH_BLIT_FORMAT_DEPTH16 0x00000007
209 #define STRETCH_BLIT_FORMAT_DEPTH24 0x00000004
210 #define STRETCH_BLIT_FORMAT_A8R8G8B8 0x00000003
211 #define STRETCH_BLIT_FORMAT_X8R8G8B8 0x00000004
212 #define STRETCH_BLIT_FORMAT_YUYV 0x00000005
213 #define STRETCH_BLIT_FORMAT_UYVY 0x00000006
214 /* STRETCH_BLIT_OPERATION is only supported on TNT2 and newer */
215 #define STRETCH_BLIT_OPERATION 0x0000E304
216 #define STRETCH_BLIT_OPERATION_ROP 0x00000001
217 #define STRETCH_BLIT_OPERATION_COPY 0x00000003
218 #define STRETCH_BLIT_OPERATION_BLEND 0x00000002
219 #define STRETCH_BLIT_CLIP_POINT 0x0000E308
220 #define STRETCH_BLIT_CLIP_POINT_X 15:0
221 #define STRETCH_BLIT_CLIP_POINT_Y 31:16
222 #define STRETCH_BLIT_CLIP_POINT 0x0000E308
223 #define STRETCH_BLIT_CLIP_SIZE 0x0000E30C
224 #define STRETCH_BLIT_CLIP_SIZE_WIDTH 15:0
225 #define STRETCH_BLIT_CLIP_SIZE_HEIGHT 31:16
226 #define STRETCH_BLIT_DST_POINT 0x0000E310
227 #define STRETCH_BLIT_DST_POINT_X 15:0
228 #define STRETCH_BLIT_DST_POINT_Y 31:16
229 #define STRETCH_BLIT_DST_SIZE 0x0000E314
230 #define STRETCH_BLIT_DST_SIZE_WIDTH 15:0
231 #define STRETCH_BLIT_DST_SIZE_HEIGHT 31:16
232 #define STRETCH_BLIT_DU_DX 0x0000E318
233 #define STRETCH_BLIT_DV_DY 0x0000E31C
234 #define STRETCH_BLIT_SRC_SIZE 0x0000E400
235 #define STRETCH_BLIT_SRC_SIZE_WIDTH 15:0
236 #define STRETCH_BLIT_SRC_SIZE_HEIGHT 31:16
237 #define STRETCH_BLIT_SRC_FORMAT 0x0000E404
238 #define STRETCH_BLIT_SRC_FORMAT_PITCH 15:0
239 #define STRETCH_BLIT_SRC_FORMAT_ORIGIN 23:16
240 #define STRETCH_BLIT_SRC_FORMAT_ORIGIN_CENTER 0x00000001
241 #define STRETCH_BLIT_SRC_FORMAT_ORIGIN_CORNER 0x00000002
242 #define STRETCH_BLIT_SRC_FORMAT_FILTER 31:24
243 #define STRETCH_BLIT_SRC_FORMAT_FILTER_POINT_SAMPLE 0x00000000
244 #define STRETCH_BLIT_SRC_FORMAT_FILTER_BILINEAR 0x00000001
245 #define STRETCH_BLIT_SRC_OFFSET 0x0000E408
246 #define STRETCH_BLIT_SRC_POINT 0x0000E40C
247 #define STRETCH_BLIT_SRC_POINT_U 15:0
248 #define STRETCH_BLIT_SRC_POINT_V 31:16
249
250
251 #endif /* GFFBREG_H */
252