1#ifndef _VGATYPES_ 2#define _VGATYPES_ 3 4#ifdef LINUX_XF86 5#include "xf86Pci.h" 6#endif 7 8#ifdef LINUX_KERNEL /* TW: We don't want the X driver to depend on kernel source */ 9#include <linux/ioctl.h> 10#endif 11 12#ifndef TC 13#define far 14#endif 15 16#ifndef FALSE 17#define FALSE 0 18#endif 19 20#ifndef TRUE 21#define TRUE 1 22#endif 23 24#ifndef NULL 25#define NULL 0 26#endif 27 28#ifndef CHAR 29typedef char CHAR; 30#endif 31 32#ifndef SHORT 33typedef short SHORT; 34#endif 35 36#ifndef LONG 37typedef long LONG; 38#endif 39 40#ifndef UCHAR 41typedef unsigned char UCHAR; 42#endif 43 44#ifndef USHORT 45typedef unsigned short USHORT; 46#endif 47 48#ifndef ULONG 49typedef unsigned long ULONG; 50#endif 51 52#ifndef PUCHAR 53typedef UCHAR far *PUCHAR; 54#endif 55 56#ifndef PUSHORT 57typedef USHORT far *PUSHORT; 58#endif 59 60#ifndef PULONG 61typedef ULONG far *PULONG; 62#endif 63 64#ifndef PVOID 65typedef void far *PVOID; 66#endif 67#ifndef VOID 68typedef void VOID; 69#endif 70 71#ifndef BOOLEAN 72typedef UCHAR BOOLEAN; 73#endif 74 75#ifndef WINCE_HEADER 76#ifndef bool 77typedef UCHAR bool; 78#endif 79#endif /*WINCE_HEADER*/ 80 81#ifndef VBIOS_VER_MAX_LENGTH 82#define VBIOS_VER_MAX_LENGTH 4 83#endif 84 85#ifndef LINUX_KERNEL /* For kernel, this is defined in sisfb.h */ 86#ifndef WIN2000 87#ifndef SIS_CHIP_TYPE 88typedef enum _SIS_CHIP_TYPE { 89 SIS_VGALegacy = 0, 90#ifdef LINUX_XF86 91 SIS_530, /* TW */ 92 SIS_OLD, /* TW */ 93#endif 94 SIS_300, 95 SIS_630, 96 SIS_730, 97 SIS_540, 98 SIS_315H, /* SiS 310 */ 99 SIS_315, 100 SIS_315PRO, /* SiS 325 */ 101 SIS_550, 102 SIS_640, 103 SIS_740, 104 SIS_650, 105 SIS_330, 106 MAX_SIS_CHIP 107} SIS_CHIP_TYPE; 108#endif 109#endif 110#endif 111 112#ifndef WIN2000 113#ifndef SIS_VB_CHIP_TYPE 114typedef enum _SIS_VB_CHIP_TYPE { 115 VB_CHIP_Legacy = 0, 116 VB_CHIP_301, 117 VB_CHIP_301B, 118 VB_CHIP_301LV, 119 VB_CHIP_301LVX, 120 VB_CHIP_302, 121 VB_CHIP_302B, 122 VB_CHIP_302LV, 123 VB_CHIP_302LVX, 124 VB_CHIP_303, 125 VB_CHIP_UNKNOWN, /* other video bridge or no video bridge */ 126 MAX_VB_CHIP 127} SIS_VB_CHIP_TYPE; 128#endif 129#endif 130 131#ifndef WIN2000 132#ifndef SIS_LCD_TYPE 133typedef enum _SIS_LCD_TYPE { 134 LCD_INVALID = 0, 135 LCD_800x600, 136 LCD_1024x768, 137 LCD_1280x1024, 138 LCD_1280x960, 139 LCD_640x480, 140 LCD_1600x1200, 141 LCD_1920x1440, 142 LCD_2048x1536, 143 LCD_320x480, /* TW: FSTN */ 144 LCD_1400x1050, 145 LCD_1152x864, 146 LCD_1152x768, 147 LCD_1280x768, 148 LCD_1024x600, 149 LCD_UNKNOWN 150} SIS_LCD_TYPE; 151#endif 152#endif 153 154#ifndef WIN2000 /* mark by Paul, Move definition to sisv.h*/ 155#ifndef PSIS_DSReg 156typedef struct _SIS_DSReg 157{ 158 UCHAR jIdx; 159 UCHAR jVal; 160} SIS_DSReg, *PSIS_DSReg; 161#endif 162 163#ifndef SIS_HW_DEVICE_INFO 164 165typedef struct _SIS_HW_DEVICE_INFO SIS_HW_DEVICE_INFO, *PSIS_HW_DEVICE_INFO; 166 167typedef BOOLEAN (*PSIS_QUERYSPACE) (PSIS_HW_DEVICE_INFO, ULONG, ULONG, ULONG *); 168 169 170struct _SIS_HW_DEVICE_INFO 171{ 172 PVOID pDevice; /* The pointer to the physical device data structure 173 in each OS or NULL for unused. */ 174 UCHAR *pjVirtualRomBase; /* base virtual address of VBIOS ROM Space */ 175 /* or base virtual address of ROM image file. */ 176 /* if NULL, then read from pjROMImage; */ 177 /* Note:ROM image file is the file of VBIOS ROM */ 178 179 BOOLEAN UseROM; /* TW: Use the ROM image if provided */ 180 181 UCHAR *pjCustomizedROMImage;/* base virtual address of ROM image file. */ 182 /* wincE:ROM image file is the file for OEM */ 183 /* customized table */ 184 /* Linux: not used */ 185 /* NT : not used */ 186 /* Note : pjCustomizedROMImage=NULL if no ROM image file */ 187 188 UCHAR *pjVideoMemoryAddress;/* base virtual memory address */ 189 /* of Linear VGA memory */ 190 191 ULONG ulVideoMemorySize; /* size, in bytes, of the memory on the board */ 192 ULONG ulIOAddress; /* base I/O address of VGA ports (0x3B0) */ 193 UCHAR jChipType; /* Used to Identify SiS Graphics Chip */ 194 /* defined in the data structure type */ 195 /* "SIS_CHIP_TYPE" */ 196 197 UCHAR jChipRevision; /* Used to Identify SiS Graphics Chip Revision */ 198 UCHAR ujVBChipID; /* the ID of video bridge */ 199 /* defined in the data structure type */ 200 /* "SIS_VB_CHIP_TYPE" */ 201 202 USHORT usExternalChip; /* NO VB or other video bridge(not */ 203 /* SiS video bridge) */ 204 /* if ujVBChipID = VB_CHIP_UNKNOWN, */ 205 /* then bit0=1 : LVDS,bit1=1 : trumpion, */ 206 /* bit2=1 : CH7005 & no video bridge if */ 207 /* usExternalChip = 0. */ 208 /* Note: CR37[3:1]: */ 209 /* 001:SiS 301 */ 210 /* 010:LVDS */ 211 /* 011:Trumpion LVDS Scaling Chip */ 212 /* 100:LVDS(LCD-out)+Chrontel 7005 */ 213 /* 101:Single Chrontel 7005 */ 214 /* TW: This has changed on 310/325 series! */ 215 216 ULONG ulCRT2LCDType; /* defined in the data structure type */ 217 /* "SIS_LCD_TYPE" */ 218 219 BOOLEAN bIntegratedMMEnabled;/* supporting integration MM enable */ 220 221 BOOLEAN bSkipDramSizing; /* True: Skip video memory sizing. */ 222 PSIS_DSReg pSR; /* restore SR registers in initial function. */ 223 /* end data :(idx, val) = (FF, FF). */ 224 /* Note : restore SR registers if */ 225 /* bSkipDramSizing = TRUE */ 226 227 PSIS_DSReg pCR; /* restore CR registers in initial function. */ 228 /* end data :(idx, val) = (FF, FF) */ 229 /* Note : restore cR registers if */ 230 /* bSkipDramSizing = TRUE */ 231 232 PSIS_QUERYSPACE pQueryVGAConfigSpace; /* Get/Set VGA Configuration */ 233 /* space */ 234 235 PSIS_QUERYSPACE pQueryNorthBridgeSpace;/* Get/Set North Bridge */ 236 /* space */ 237 238 UCHAR szVBIOSVer[VBIOS_VER_MAX_LENGTH]; 239 240 UCHAR pdc; /* TW: PanelDelayCompensation */ 241 242#ifdef LINUX_XF86 243 PCITAG PciTag; /* PCI Tag for Linux XF86 */ 244#endif 245}; 246#endif 247#endif 248 249 250/* TW: Addtional IOCTL for communication sisfb <> X driver */ 251/* If changing this, sisfb.h must also be changed (for sisfb) */ 252 253#ifdef LINUX_XF86 /* We don't want the X driver to depend on the kernel source */ 254 255/* TW: ioctl for identifying and giving some info (esp. memory heap start) */ 256#define SISFB_GET_INFO 0x80046ef8 /* Wow, what a terrible hack... */ 257 258/* TW: Structure argument for SISFB_GET_INFO ioctl */ 259typedef struct _SISFB_INFO sisfb_info, *psisfb_info; 260 261struct _SISFB_INFO { 262 unsigned long sisfb_id; /* for identifying sisfb */ 263#ifndef SISFB_ID 264#define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */ 265#endif 266 int chip_id; /* PCI ID of detected chip */ 267 int memory; /* video memory in KB which sisfb manages */ 268 int heapstart; /* heap start (= sisfb "mem" argument) in KB */ 269 unsigned char fbvidmode; /* current sisfb mode */ 270 271 unsigned char sisfb_version; 272 unsigned char sisfb_revision; 273 unsigned char sisfb_patchlevel; 274 275 unsigned char sisfb_caps; /* sisfb's capabilities */ 276 277 int sisfb_tqlen; /* turbo queue length (in KB) */ 278 279 char reserved[249]; /* for future use */ 280}; 281#endif 282 283#ifndef WIN2000 284#ifndef WINCE_HEADER 285#ifndef BUS_DATA_TYPE 286typedef enum _BUS_DATA_TYPE { 287 ConfigurationSpaceUndefined = -1, 288 Cmos, 289 EisaConfiguration, 290 Pos, 291 CbusConfiguration, 292 PCIConfiguration, 293 VMEConfiguration, 294 NuBusConfiguration, 295 PCMCIAConfiguration, 296 MPIConfiguration, 297 MPSAConfiguration, 298 PNPISAConfiguration, 299 MaximumBusDataType 300} BUS_DATA_TYPE, *PBUS_DATA_TYPE; 301#endif 302#endif /* WINCE_HEADER */ 303 304#ifndef PCI_TYPE0_ADDRESSES 305#define PCI_TYPE0_ADDRESSES 6 306#endif 307 308#ifndef PCI_TYPE1_ADDRESSES 309#define PCI_TYPE1_ADDRESSES 2 310#endif 311 312#ifndef WINCE_HEADER 313#ifndef PCI_COMMON_CONFIG 314typedef struct _PCI_COMMON_CONFIG { 315 USHORT VendorID; /* (ro) */ 316 USHORT DeviceID; /* (ro) */ 317 USHORT Command; /* Device control */ 318 USHORT Status; 319 UCHAR RevisionID; /* (ro) */ 320 UCHAR ProgIf; /* (ro) */ 321 UCHAR SubClass; /* (ro) */ 322 UCHAR BaseClass; /* (ro) */ 323 UCHAR CacheLineSize; /* (ro+) */ 324 UCHAR LatencyTimer; /* (ro+) */ 325 UCHAR HeaderType; /* (ro) */ 326 UCHAR BIST; /* Built in self test */ 327 328 union { 329 struct _PCI_HEADER_TYPE_0 { 330 ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; 331 ULONG CIS; 332 USHORT SubVendorID; 333 USHORT SubSystemID; 334 ULONG ROMBaseAddress; 335 ULONG Reserved2[2]; 336 337 UCHAR InterruptLine; /* */ 338 UCHAR InterruptPin; /* (ro) */ 339 UCHAR MinimumGrant; /* (ro) */ 340 UCHAR MaximumLatency; /* (ro) */ 341 } type0; 342 343 344 } u; 345 346 UCHAR DeviceSpecific[192]; 347 348} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG; 349#endif 350#endif /* WINCE_HEADER */ 351 352#ifndef FIELD_OFFSET 353#define FIELD_OFFSET(type, field) ((LONG)&(((type *)0)->field)) 354#endif 355 356#ifndef PCI_COMMON_HDR_LENGTH 357#define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET (PCI_COMMON_CONFIG, DeviceSpecific)) 358#endif 359#endif 360 361#endif 362