1 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_driver.h,v 1.7 2003/11/06 18:38:11 tsi Exp $ */
3 * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
4 * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sub license,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
29 #if 0 /* DEBUG is use in VIA DRI code as a flag */
30 /* #define DEBUG_PRINT */
41 #include "xf86Resources.h"
42 #include "xf86_ansic.h"
44 #include "xf86PciInfo.h"
45 #include "xf86_OSproc.h"
47 #include "xf86Cursor.h"
48 #include "mipointer.h"
66 #include "via_gpioi2c.h"
71 #define _XF86DRI_SERVER_
74 #include "GL/glxint.h"
80 #include "GL/internal/dri_interface.h"
84 /* _SOLO : copied from via_bios.h */
85 /* System Memory CLK */
86 #define VIA_MEM_SDR66 0x00
87 #define VIA_MEM_SDR100 0x01
88 #define VIA_MEM_SDR133 0x02
89 #define VIA_MEM_DDR200 0x03
90 #define VIA_MEM_DDR266 0x04
91 #define VIA_MEM_DDR333 0x05
92 #define VIA_MEM_DDR400 0x06
94 #define DRIVER_NAME "via"
95 #define DRIVER_VERSION "4.1.0"
96 #define VERSION_MAJOR 4
97 #define VERSION_MINOR 1
99 #define VIA_VERSION ((VERSION_MAJOR<<24) | (VERSION_MINOR<<16) | PATCHLEVEL)
101 #define VGAIN8(addr) MMIO_IN8(pVia->MapBase+0x8000, addr)
102 #define VGAIN16(addr) MMIO_IN16(pVia->MapBase+0x8000, addr)
103 #define VGAIN(addr) MMIO_IN32(pVia->MapBase+0x8000, addr)
105 #define VGAOUT8(addr, val) MMIO_OUT8(pVia->MapBase+0x8000, addr, val)
106 #define VGAOUT16(addr, val) MMIO_OUT16(pVia->MapBase+0x8000, addr, val)
107 #define VGAOUT(addr, val) MMIO_OUT32(pVia->MapBase+0x8000, addr, val)
109 #define INREG(addr) MMIO_IN32(pVia->MapBase, addr)
110 #define OUTREG(addr, val) MMIO_OUT32(pVia->MapBase, addr, val)
111 #define INREG16(addr) MMIO_IN16(pVia->MapBase, addr)
112 #define OUTREG16(addr, val) MMIO_OUT16(pVia->MapBase, addr, val)
114 #define VIA_PIXMAP_CACHE_SIZE (256 * 1024)
115 #define VIA_CURSOR_SIZE (4 * 1024)
116 #define VIA_VQ_SIZE (256 * 1024)
119 unsigned int mode
, refresh
, resMode
;
120 int countWidthByQWord
;
121 int offsetWidthByQWord
;
122 unsigned char SR08
, SR0A
, SR0F
;
124 /* extended Sequencer registers */
125 unsigned char SR10
, SR11
, SR12
, SR13
,SR14
,SR15
,SR16
;
126 unsigned char SR17
, SR18
, SR19
, SR1A
,SR1B
,SR1C
,SR1D
,SR1E
;
127 unsigned char SR1F
, SR20
, SR21
, SR22
,SR23
,SR24
,SR25
,SR26
;
128 unsigned char SR27
, SR28
, SR29
, SR2A
,SR2B
,SR2C
,SR2D
,SR2E
;
129 unsigned char SR2F
, SR30
, SR31
, SR32
,SR33
,SR34
,SR40
,SR41
;
130 unsigned char SR42
, SR43
, SR44
, SR45
,SR46
,SR47
;
134 /* extended CRTC registers */
135 unsigned char CR13
, CR30
, CR31
, CR32
, CR33
, CR34
, CR35
, CR36
;
136 unsigned char CR37
, CR38
, CR39
, CR3A
, CR40
, CR41
, CR42
, CR43
;
137 unsigned char CR44
, CR45
, CR46
, CR47
, CR48
, CR49
, CR4A
;
138 unsigned char CRTCRegs
[83];
139 unsigned char TVRegs
[0xCF];
140 unsigned char TVRegs2
[0xCF];
141 /* unsigned char LCDRegs[0x40];*/
143 } VIARegRec
, *VIARegPtr
;
146 typedef struct _VIA
{
150 xf86CursorInfoPtr CursorInfoRec
;
152 VIAModeInfoPtr VIAModeList
;
155 int Bpp
, Bpl
, ScissB
;
158 unsigned long videoRambytes
;
166 /* These are physical addresses. */
167 unsigned long FrameBufferBase
;
168 unsigned long MmioBase
;
170 /* These are linear addresses. */
171 unsigned char* MapBase
;
172 unsigned char* VidMapBase
;
173 unsigned char* BltBase
;
174 unsigned char* MapBaseDense
;
175 unsigned char* FBBase
;
176 unsigned char* FBStart
;
178 int PrimaryVidMapped
;
180 int minClock
, maxClock
;
181 int MCLK
, REFCLK
, LCDclk
;
184 /* Here are all the Options */
195 CloseScreenProcPtr CloseScreen
;
205 /* Support for shadowFB and rotation */
206 unsigned char* ShadowPtr
;
208 void (*PointerMoved
)(int index
, int x
, int y
);
210 /* Support for XAA acceleration */
212 XAAInfoRecPtr AccelInfoRec
;
216 u_int32_t SavedFgColor
;
217 u_int32_t SavedBgColor
;
218 u_int32_t SavedPattern0
;
219 u_int32_t SavedPattern1
;
220 u_int32_t SavedPatternAddr
;
223 /* Support for Int10 processing */
224 xf86Int10InfoPtr pInt10
;
227 VIABIOSInfoPtr pBIOSInfo
;
228 VGABIOSVERPtr pBIOSVer
;
231 /* Support for DGA */
233 /*DGAModePtr DGAModes;*/
235 int DGAViewportStatus
;
237 /* The various wait handlers. */
238 int (*myWaitIdle
)(struct _VIA
*);
253 /* Capture information */
254 VIACAPINFO CapInfo
[2]; /* 2 capture information */
258 u_int32_t Cap0_Deinterlace;
259 u_int32_t Cap1_Deinterlace;
263 int Capture_OverScanOff;
264 int NoMPEGHQV_VFilter;
267 int directRenderingEnabled
;
270 int numVisualConfigs
;
271 __GLXvisualConfig
* pVisualConfigs
;
272 VIAConfigPrivPtr pVisualConfigsPriv
;
273 unsigned long agpHandle
;
274 unsigned long registerHandle
;
276 unsigned char *agpBase
;
277 unsigned int agpSize
;
282 unsigned long agpHandle
;
283 unsigned long registerHandle
;
284 unsigned long agpAddr
;
285 unsigned char *agpBase
;
286 unsigned int agpSize
;
291 u_int16_t ActiveDevice
; /* if SAMM, non-equal pBIOSInfo->ActiveDevice */
292 unsigned char *CursorImage
;
297 unsigned char MemClk
;
298 int EnableExtendedFIFO
;
299 VIADRIPtr devPrivate
;
303 /* Shortcuts. These depend on a local symbol "pVia". */
305 #define WaitIdle() pVia->myWaitIdle(pVia)
306 #define VIAPTR(p) ((VIAPtr)((p)->driverPrivate))
308 #endif /* _VIA_DRIVER_H */