1/* $XFree86$ */ 2/* $XdotOrg$ */ 3/* 4 * General type definitions for universal mode switching modules 5 * 6 * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria 7 * 8 * If distributed as part of the Linux kernel, the following license terms 9 * apply: 10 * 11 * * This program is free software; you can redistribute it and/or modify 12 * * it under the terms of the GNU General Public License as published by 13 * * the Free Software Foundation; either version 2 of the named License, 14 * * or any later version. 15 * * 16 * * This program is distributed in the hope that it will be useful, 17 * * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * * GNU General Public License for more details. 20 * * 21 * * You should have received a copy of the GNU General Public License 22 * * along with this program; if not, write to the Free Software 23 * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA 24 * 25 * Otherwise, the following license terms apply: 26 * 27 * * Redistribution and use in source and binary forms, with or without 28 * * modification, are permitted provided that the following conditions 29 * * are met: 30 * * 1) Redistributions of source code must retain the above copyright 31 * * notice, this list of conditions and the following disclaimer. 32 * * 2) Redistributions in binary form must reproduce the above copyright 33 * * notice, this list of conditions and the following disclaimer in the 34 * * documentation and/or other materials provided with the distribution. 35 * * 3) The name of the author may not be used to endorse or promote products 36 * * derived from this software without specific prior written permission. 37 * * 38 * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 39 * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 40 * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 41 * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 42 * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 43 * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 44 * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 45 * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 46 * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 47 * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 * 49 * Author: Thomas Winischhofer <thomas@winischhofer.net> 50 * 51 */ 52 53#ifndef _VGATYPES_ 54#define _VGATYPES_ 55 56#include "osdef.h" 57 58#ifdef LINUX_XF86 59#include "xorgVersion.h" 60#include "xf86Pci.h" 61#endif 62 63#ifdef LINUX_KERNEL /* We don't want the X driver to depend on kernel source */ 64#include <linux/ioctl.h> 65#endif 66 67#ifndef FALSE 68#define FALSE 0 69#endif 70 71#ifndef TRUE 72#define TRUE 1 73#endif 74 75#ifndef NULL 76#define NULL 0 77#endif 78 79#ifndef CHAR 80typedef char CHAR; 81#endif 82 83#ifndef SHORT 84typedef short SHORT; 85#endif 86 87#ifndef LONG 88typedef long LONG; 89#endif 90 91#ifndef UCHAR 92typedef unsigned char UCHAR; 93#endif 94 95#ifndef USHORT 96typedef unsigned short USHORT; 97#endif 98 99#ifndef ULONG 100typedef unsigned long ULONG; 101#endif 102 103#ifndef PUCHAR 104typedef UCHAR *PUCHAR; 105#endif 106 107#ifndef PUSHORT 108typedef USHORT *PUSHORT; 109#endif 110 111#ifndef PLONGU 112typedef ULONG *PULONG; 113#endif 114 115#ifndef VOID 116typedef void VOID; 117#endif 118 119#ifndef PVOID 120typedef void *PVOID; 121#endif 122 123#ifndef BOOLEAN 124typedef UCHAR BOOLEAN; 125#endif 126 127#ifndef bool 128typedef UCHAR bool; 129#endif 130 131#ifdef LINUX_KERNEL 132typedef unsigned long XGIIOADDRESS; 133#endif 134 135#ifdef LINUX_XF86 136typedef IOADDRESS XGIIOADDRESS; 137#endif 138 139#ifndef VBIOS_VER_MAX_LENGTH 140#define VBIOS_VER_MAX_LENGTH 4 141#endif 142 143#ifndef LINUX_KERNEL /* For the linux kernel, this is defined in xgifb.h */ 144#ifndef XGI_CHIP_TYPE 145typedef enum _XGI_CHIP_TYPE { 146 XGI_VGALegacy = 0, 147 XG40 = 32, 148 XG41, 149 XG42, 150 XG45, 151 XG20 = 48, 152 XG21, 153 XG27, 154 MAX_XGI_CHIP 155} XGI_CHIP_TYPE; 156#endif 157#endif 158 159#ifndef XGI_VB_CHIP_TYPE 160typedef enum _XGI_VB_CHIP_TYPE { 161 VB_CHIP_Legacy = 0, 162 VB_CHIP_301, 163 VB_CHIP_301B, 164 VB_CHIP_301LV, 165 VB_CHIP_302, 166 VB_CHIP_302B, 167 VB_CHIP_302LV, 168 VB_CHIP_301C, 169 VB_CHIP_302ELV, 170 VB_CHIP_UNKNOWN, /* other video bridge or no video bridge */ 171 MAX_VB_CHIP 172} XGI_VB_CHIP_TYPE; 173#endif 174 175#ifndef XGI_LCD_TYPE 176typedef enum _XGI_LCD_TYPE { 177 LCD_INVALID = 0, 178 LCD_320x480, /* FSTN, DSTN */ 179 LCD_640x480, 180 LCD_640x480_2, /* FSTN, DSTN */ 181 LCD_640x480_3, /* FSTN, DSTN */ 182 LCD_800x600, 183 LCD_848x480, 184 LCD_1024x600, 185 LCD_1024x768, 186 LCD_1152x768, 187 LCD_1152x864, 188 LCD_1280x720, 189 LCD_1280x768, 190 LCD_1280x800, 191 LCD_1280x960, 192 LCD_1280x1024, 193 LCD_1400x1050, 194 LCD_1600x1200, 195 LCD_1680x1050, 196 LCD_1920x1440, 197 LCD_2048x1536, 198 LCD_CUSTOM, 199 LCD_UNKNOWN 200} XGI_LCD_TYPE; 201#endif 202 203#ifndef PXGI_DSReg 204typedef struct _XGI_DSReg 205{ 206 UCHAR jIdx; 207 UCHAR jVal; 208} XGI_DSReg, *PXGI_DSReg; 209#endif 210 211#ifndef XGI_HW_DEVICE_INFO 212 213typedef struct _XGI_HW_DEVICE_INFO XGI_HW_DEVICE_INFO, *PXGI_HW_DEVICE_INFO; 214 215typedef BOOLEAN (*PXGI_QUERYSPACE) (PXGI_HW_DEVICE_INFO, ULONG, ULONG, CARD32 *); 216 217struct _XGI_HW_DEVICE_INFO 218{ 219 ULONG ulExternalChip; /* NO VB or other video bridge*/ 220 /* if ujVBChipID = VB_CHIP_UNKNOWN, */ 221 PUCHAR pjVirtualRomBase; /* ROM image */ 222 223 BOOLEAN UseROM; /* Use the ROM image if provided */ 224 225 PVOID pDevice; 226 227 PUCHAR pjVideoMemoryAddress;/* base virtual memory address */ 228 /* of Linear VGA memory */ 229 230 ULONG ulVideoMemorySize; /* size, in bytes, of the memory on the board */ 231 232 XGIIOADDRESS pjIOAddress; /* base I/O address of VGA ports (0x3B0) */ 233 234 PUCHAR pjCustomizedROMImage; 235 236 PUCHAR pj2ndVideoMemoryAddress; 237 ULONG ul2ndVideoMemorySize; 238 239 PUCHAR pj2ndIOAddress; 240 UCHAR jChipType; /* Used to Identify Graphics Chip */ 241 /* defined in the data structure type */ 242 /* "XGI_CHIP_TYPE" */ 243 244 UCHAR jChipRevision; /* Used to Identify Graphics Chip Revision */ 245 246 UCHAR ujVBChipID; /* the ID of video bridge */ 247 /* defined in the data structure type */ 248 /* "XGI_VB_CHIP_TYPE" */ 249 250 BOOLEAN bNewScratch; 251 252 ULONG ulCRT2LCDType; /* defined in the data structure type */ 253 254 ULONG usExternalChip; /* NO VB or other video bridge (other than */ 255 /* video bridge) */ 256 257 BOOLEAN bIntegratedMMEnabled;/* supporting integration MM enable */ 258 259 BOOLEAN bSkipDramSizing; /* True: Skip video memory sizing. */ 260 261 BOOLEAN bSkipSense; 262 263 BOOLEAN bIsPowerSaving; /* True: XGIInit() is invoked by power management, 264 otherwise by 2nd adapter's initialzation */ 265 266 PXGI_DSReg pSR; /* restore SR registers in initial function. */ 267 /* end data :(idx, val) = (FF, FF). */ 268 /* Note : restore SR registers if */ 269 /* bSkipDramSizing = TRUE */ 270 271 PXGI_DSReg pCR; /* restore CR registers in initial function. */ 272 /* end data :(idx, val) = (FF, FF) */ 273 /* Note : restore cR registers if */ 274 /* bSkipDramSizing = TRUE */ 275/* 276#endif 277*/ 278 279 PXGI_QUERYSPACE pQueryVGAConfigSpace; 280 281 UCHAR szVBIOSVer[VBIOS_VER_MAX_LENGTH]; 282 283 /* Jong 09/18/2007; patch to GIT */ 284 /* Jong 08/17/2007; Alan's code to support custom mode of modeline */ 285 /* --------------------------------------------------------------------- */ 286 UCHAR BPP; 287 UCHAR Frequency; 288 USHORT Horizontal_ACTIVE; 289 USHORT Vertical_ACTIVE; 290 UCHAR SpecialMode; 291 292 UCHAR SpecifyTiming; /* Set 1 for specifying timing*/ 293 USHORT Horizontal_FP; /* Alan 08/10/2007; HSyncStart - HDisplay */ 294 USHORT Horizontal_BP; /* Alan 08/10/2007; HTotal - HSyncEnd */ 295 USHORT Horizontal_SYNC; /* Alan 08/10/2007; HSyncEnd - HSyncStart */ 296 USHORT Vertical_FP; 297 USHORT Vertical_BP; 298 USHORT Vertical_SYNC; 299 double DCLK; 300 UCHAR Interlace; /* Alan 08/10/2007; specify interlace or not */ 301 /* --------------------------------------------------------------------- */ 302 303 /* Jong 08/03/2009; support I2C */ 304 unsigned long I2CDelay; 305 UCHAR ucI2cCRT; 306 UCHAR ucI2cDVI; 307 UCHAR ucI2cFCNT; 308 int crtno; 309}; 310#endif 311 312/* Addtional IOCTL for communication xgifb <> X driver */ 313/* If changing this, xgifb.h must also be changed (for xgifb) */ 314 315#ifdef LINUX_XF86 /* We don't want the X driver to depend on the kernel source */ 316 317/* ioctl for identifying and giving some info (esp. memory heap start) */ 318#define XGIFB_GET_INFO 0x80046ef8 /* Wow, what a terrible hack... */ 319 320/* Structure argument for XGIFB_GET_INFO ioctl */ 321typedef struct _XGIFB_INFO xgifb_info, *pxgifb_info; 322 323struct _XGIFB_INFO { 324 CARD32 xgifb_id; /* for identifying xgifb */ 325#ifndef XGIFB_ID 326#define XGIFB_ID 0x53495346 /* Identify myself with 'XGIF' */ 327#endif 328 CARD32 chip_id; /* PCI ID of detected chip */ 329 CARD32 memory; /* video memory in KB which xgifb manages */ 330 CARD32 heapstart; /* heap start (= xgifb "mem" argument) in KB */ 331 CARD8 fbvidmode; /* current xgifb mode */ 332 333 CARD8 xgifb_version; 334 CARD8 xgifb_revision; 335 CARD8 xgifb_patchlevel; 336 337 CARD8 xgifb_caps; /* xgifb's capabilities */ 338 339 CARD32 xgifb_tqlen; /* turbo queue length (in KB) */ 340 341 CARD32 xgifb_pcibus; /* The card's PCI ID */ 342 CARD32 xgifb_pcislot; 343 CARD32 xgifb_pcifunc; 344 345 CARD8 xgifb_lcdpdc; 346 347 CARD8 xgifb_lcda; 348 349 CARD32 xgifb_vbflags; 350 CARD32 xgifb_currentvbflags; 351 352 CARD32 xgifb_scalelcd; 353 CARD32 xgifb_specialtiming; 354 355 CARD8 xgifb_haveemi; 356 CARD8 xgifb_emi30,xgifb_emi31,xgifb_emi32,xgifb_emi33; 357 CARD8 xgifb_haveemilcd; 358 359 CARD8 xgifb_lcdpdca; 360 361 CARD8 reserved[212]; /* for future use */ 362}; 363#endif 364 365#endif 366 367