1 /* $NetBSD: gffbreg.h,v 1.6 2025/10/06 07:51:44 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.6 2025/10/06 07:51:44 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 #define GFFB_BL_MIN 0x100 72 #define GFFB_BL_MAX 0x534 73 74 #define NV40_PMC_BACKLIGHT 0x000015f0 75 # define NV40_PMC_BACKLIGHT_MASK 0x001f0000 76 77 /* CRTC registers */ 78 #define GFFB_DISPLAYSTART 0x800 79 #define GFFB_PCRTC_GPIO 0x818 80 #define GFFB_PCRTC_GPIO_EXT 0x81c 81 82 /* VGA registers */ 83 #define GFFB_PEL_MASK 0x3c6 84 #define GFFB_PEL_IR 0x3c7 85 #define GFFB_PEL_IW 0x3c8 86 #define GFFB_PEL_D 0x3c9 87 88 /* engine command definitions from xf86_video_nv/nv_dma.h */ 89 90 /* 91 * Copyright (c) 2003 NVIDIA, Corporation 92 * 93 * Permission is hereby granted, free of charge, to any person obtaining a 94 * copy of this software and associated documentation files (the 95 * "Software"), to deal in the Software without restriction, including 96 * without limitation the rights to use, copy, modify, merge, publish, 97 * distribute, sublicense, and/or sell copies of the Software, and to 98 * permit persons to whom the Software is furnished to do so, subject to 99 * the following conditions: 100 * 101 * The above copyright notice and this permission notice shall be included 102 * in all copies or substantial portions of the Software. 103 * 104 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 105 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 106 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 107 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 108 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 109 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 110 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 111 */ 112 113 #define SURFACE_FORMAT 0x00000300 114 #define SURFACE_FORMAT_DEPTH8 0x00000001 115 #define SURFACE_FORMAT_DEPTH15 0x00000002 116 #define SURFACE_FORMAT_DEPTH16 0x00000004 117 #define SURFACE_FORMAT_DEPTH24 0x00000006 118 #define SURFACE_PITCH 0x00000304 119 #define SURFACE_PITCH_SRC 15:0 120 #define SURFACE_PITCH_DST 31:16 121 #define SURFACE_OFFSET_SRC 0x00000308 122 #define SURFACE_OFFSET_DST 0x0000030C 123 124 #define ROP_SET 0x00002300 125 126 #define PATTERN_FORMAT 0x00004300 127 #define PATTERN_FORMAT_DEPTH8 0x00000003 128 #define PATTERN_FORMAT_DEPTH16 0x00000001 129 #define PATTERN_FORMAT_DEPTH24 0x00000003 130 #define PATTERN_COLOR_0 0x00004310 131 #define PATTERN_COLOR_1 0x00004314 132 #define PATTERN_PATTERN_0 0x00004318 133 #define PATTERN_PATTERN_1 0x0000431C 134 135 #define CLIP_POINT 0x00006300 136 #define CLIP_POINT_X 15:0 137 #define CLIP_POINT_Y 31:16 138 #define CLIP_SIZE 0x00006304 139 #define CLIP_SIZE_WIDTH 15:0 140 #define CLIP_SIZE_HEIGHT 31:16 141 142 #define LINE_FORMAT 0x00008300 143 #define LINE_FORMAT_DEPTH8 0x00000003 144 #define LINE_FORMAT_DEPTH16 0x00000001 145 #define LINE_FORMAT_DEPTH24 0x00000003 146 #define LINE_COLOR 0x00008304 147 #define LINE_MAX_LINES 16 148 #define LINE_LINES(i) 0x00008400\ 149 +(i)*8 150 #define LINE_LINES_POINT0_X 15:0 151 #define LINE_LINES_POINT0_Y 31:16 152 #define LINE_LINES_POINT1_X 47:32 153 #define LINE_LINES_POINT1_Y 63:48 154 155 #define BLIT_POINT_SRC 0x0000A300 156 #define BLIT_POINT_SRC_X 15:0 157 #define BLIT_POINT_SRC_Y 31:16 158 #define BLIT_POINT_DST 0x0000A304 159 #define BLIT_POINT_DST_X 15:0 160 #define BLIT_POINT_DST_Y 31:16 161 #define BLIT_SIZE 0x0000A308 162 #define BLIT_SIZE_WIDTH 15:0 163 #define BLIT_SIZE_HEIGHT 31:16 164 165 #define RECT_FORMAT 0x0000C300 166 #define RECT_FORMAT_DEPTH8 0x00000003 167 #define RECT_FORMAT_DEPTH16 0x00000001 168 #define RECT_FORMAT_DEPTH24 0x00000003 169 #define RECT_SOLID_COLOR 0x0000C3FC 170 #define RECT_SOLID_RECTS_MAX_RECTS 32 171 #define RECT_SOLID_RECTS(i) 0x0000C400\ 172 +(i)*8 173 #define RECT_SOLID_RECTS_Y 15:0 174 #define RECT_SOLID_RECTS_X 31:16 175 #define RECT_SOLID_RECTS_HEIGHT 47:32 176 #define RECT_SOLID_RECTS_WIDTH 63:48 177 178 #define RECT_EXPAND_ONE_COLOR_CLIP 0x0000C7EC 179 #define RECT_EXPAND_ONE_COLOR_CLIP_POINT0_X 15:0 180 #define RECT_EXPAND_ONE_COLOR_CLIP_POINT0_Y 31:16 181 #define RECT_EXPAND_ONE_COLOR_CLIP_POINT1_X 47:32 182 #define RECT_EXPAND_ONE_COLOR_CLIP_POINT1_Y 63:48 183 #define RECT_EXPAND_ONE_COLOR_COLOR 0x0000C7F4 184 #define RECT_EXPAND_ONE_COLOR_SIZE 0x0000C7F8 185 #define RECT_EXPAND_ONE_COLOR_SIZE_WIDTH 15:0 186 #define RECT_EXPAND_ONE_COLOR_SIZE_HEIGHT 31:16 187 #define RECT_EXPAND_ONE_COLOR_POINT 0x0000C7FC 188 #define RECT_EXPAND_ONE_COLOR_POINT_X 15:0 189 #define RECT_EXPAND_ONE_COLOR_POINT_Y 31:16 190 #define RECT_EXPAND_ONE_COLOR_DATA_MAX_DWORDS 128 191 #define RECT_EXPAND_ONE_COLOR_DATA(i) 0x0000C800\ 192 +(i)*4 193 194 #define RECT_EXPAND_TWO_COLOR_CLIP 0x0000CBE4 195 #define RECT_EXPAND_TWO_COLOR_CLIP_POINT0_X 15:0 196 #define RECT_EXPAND_TWO_COLOR_CLIP_POINT0_Y 31:16 197 #define RECT_EXPAND_TWO_COLOR_CLIP_POINT1_X 47:32 198 #define RECT_EXPAND_TWO_COLOR_CLIP_POINT1_Y 63:48 199 #define RECT_EXPAND_TWO_COLOR_COLOR_0 0x0000CBEC 200 #define RECT_EXPAND_TWO_COLOR_COLOR_1 0x0000CBF0 201 #define RECT_EXPAND_TWO_COLOR_SIZE_IN 0x0000CBF4 202 #define RECT_EXPAND_TWO_COLOR_SIZE_IN_WIDTH 15:0 203 #define RECT_EXPAND_TWO_COLOR_SIZE_IN_HEIGHT 31:16 204 #define RECT_EXPAND_TWO_COLOR_SIZE_OUT 0x0000CBF8 205 #define RECT_EXPAND_TWO_COLOR_SIZE_OUT_WIDTH 15:0 206 #define RECT_EXPAND_TWO_COLOR_SIZE_OUT_HEIGHT 31:16 207 #define RECT_EXPAND_TWO_COLOR_POINT 0x0000CBFC 208 #define RECT_EXPAND_TWO_COLOR_POINT_X 15:0 209 #define RECT_EXPAND_TWO_COLOR_POINT_Y 31:16 210 #define RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS 128 211 #define RECT_EXPAND_TWO_COLOR_DATA(i) 0x0000CC00\ 212 +(i)*4 213 214 #define STRETCH_BLIT_FORMAT 0x0000E300 215 #define STRETCH_BLIT_FORMAT_DEPTH8 0x00000004 216 #define STRETCH_BLIT_FORMAT_DEPTH16 0x00000007 217 #define STRETCH_BLIT_FORMAT_DEPTH24 0x00000004 218 #define STRETCH_BLIT_FORMAT_A8R8G8B8 0x00000003 219 #define STRETCH_BLIT_FORMAT_X8R8G8B8 0x00000004 220 #define STRETCH_BLIT_FORMAT_YUYV 0x00000005 221 #define STRETCH_BLIT_FORMAT_UYVY 0x00000006 222 /* STRETCH_BLIT_OPERATION is only supported on TNT2 and newer */ 223 #define STRETCH_BLIT_OPERATION 0x0000E304 224 #define STRETCH_BLIT_OPERATION_ROP 0x00000001 225 #define STRETCH_BLIT_OPERATION_COPY 0x00000003 226 #define STRETCH_BLIT_OPERATION_BLEND 0x00000002 227 #define STRETCH_BLIT_CLIP_POINT 0x0000E308 228 #define STRETCH_BLIT_CLIP_POINT_X 15:0 229 #define STRETCH_BLIT_CLIP_POINT_Y 31:16 230 #define STRETCH_BLIT_CLIP_POINT 0x0000E308 231 #define STRETCH_BLIT_CLIP_SIZE 0x0000E30C 232 #define STRETCH_BLIT_CLIP_SIZE_WIDTH 15:0 233 #define STRETCH_BLIT_CLIP_SIZE_HEIGHT 31:16 234 #define STRETCH_BLIT_DST_POINT 0x0000E310 235 #define STRETCH_BLIT_DST_POINT_X 15:0 236 #define STRETCH_BLIT_DST_POINT_Y 31:16 237 #define STRETCH_BLIT_DST_SIZE 0x0000E314 238 #define STRETCH_BLIT_DST_SIZE_WIDTH 15:0 239 #define STRETCH_BLIT_DST_SIZE_HEIGHT 31:16 240 #define STRETCH_BLIT_DU_DX 0x0000E318 241 #define STRETCH_BLIT_DV_DY 0x0000E31C 242 #define STRETCH_BLIT_SRC_SIZE 0x0000E400 243 #define STRETCH_BLIT_SRC_SIZE_WIDTH 15:0 244 #define STRETCH_BLIT_SRC_SIZE_HEIGHT 31:16 245 #define STRETCH_BLIT_SRC_FORMAT 0x0000E404 246 #define STRETCH_BLIT_SRC_FORMAT_PITCH 15:0 247 #define STRETCH_BLIT_SRC_FORMAT_ORIGIN 23:16 248 #define STRETCH_BLIT_SRC_FORMAT_ORIGIN_CENTER 0x00000001 249 #define STRETCH_BLIT_SRC_FORMAT_ORIGIN_CORNER 0x00000002 250 #define STRETCH_BLIT_SRC_FORMAT_FILTER 31:24 251 #define STRETCH_BLIT_SRC_FORMAT_FILTER_POINT_SAMPLE 0x00000000 252 #define STRETCH_BLIT_SRC_FORMAT_FILTER_BILINEAR 0x00000001 253 #define STRETCH_BLIT_SRC_OFFSET 0x0000E408 254 #define STRETCH_BLIT_SRC_POINT 0x0000E40C 255 #define STRETCH_BLIT_SRC_POINT_U 15:0 256 #define STRETCH_BLIT_SRC_POINT_V 31:16 257 258 259 #endif /* GFFBREG_H */ 260