1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
|
/*
* Copyright 2004-2005 The Unichrome Project [unichrome.sf.net]
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
* Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sub license,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef _VIA_BIOS_H_
#define _VIA_BIOS_H_ 1
#define VIA_PANEL6X4 0
#define VIA_PANEL8X6 1
#define VIA_PANEL10X7 2
#define VIA_PANEL12X7 3
#define VIA_PANEL12X10 4
#define VIA_PANEL14X10 5
#define VIA_PANEL16X12 6
#define VIA_PANEL12X8 7
#define VIA_PANEL8X4 8
#define VIA_PANEL1366X7 9
#define VIA_PANEL1360X7 10
#define VIA_PANEL1920x1080 11
#define VIA_PANEL1920x1200 12
#define VIA_PANEL10X6 13
#define VIA_PANEL14X9 14
#define VIA_PANEL1280X720 15
#define VIA_PANEL12X9 16
#define VIA_PANEL_INVALID 255
#define TVTYPE_NONE 0x00
#define TVTYPE_NTSC 0x01
#define TVTYPE_PAL 0x02
#define TVTYPE_480P 0X03
#define TVTYPE_576P 0X04
#define TVTYPE_720P 0X05
#define TVTYPE_1080I 0X06
#define TVOUTPUT_NONE 0x00
#define TVOUTPUT_COMPOSITE 0x01
#define TVOUTPUT_SVIDEO 0x02
#define TVOUTPUT_RGB 0x04
#define TVOUTPUT_YCBCR 0x08
#define TVOUTPUT_SC 0x16
#define VIA_NONETV 0
#define VIA_VT1621 1 /* TV2PLUS */
#define VIA_VT1622 2 /* TV3 */
#define VIA_VT1623 3 /* also VT1622A */
#define VIA_VT1625 4
#define VIA_CH7011 5
#define VIA_CH7019A 6
#define VIA_CH7019B 7
#define VIA_CH7017 8
#define VIA_CH7304 9
#define VIA_CH7305 10
#define VIA_TVNORMAL 0
#define VIA_TVOVER 1
#define VIA_DEVICE_NONE 0x00
#define VIA_DEVICE_CRT 0x01
#define VIA_DEVICE_LCD 0x02
#define VIA_DEVICE_TV 0x04
#define VIA_DEVICE_DFP 0x08
/* System Memory CLK */
#define VIA_MEM_SDR66 0x00
#define VIA_MEM_SDR100 0x01
#define VIA_MEM_SDR133 0x02
#define VIA_MEM_DDR200 0x03
#define VIA_MEM_DDR266 0x04
#define VIA_MEM_DDR333 0x05
#define VIA_MEM_DDR400 0x06
#define VIA_MEM_DDR533 0x07
#define VIA_MEM_DDR667 0x08
#define VIA_MEM_END 0x09
#define VIA_MEM_NONE 0xFF
/* Digital Output Bus Width */
#define VIA_DI_12BIT 0x00
#define VIA_DI_24BIT 0x01
/* Digital Port */
#define VIA_DI_PORT_NONE 0x0
#define VIA_DI_PORT_DVP0 0x1
#define VIA_DI_PORT_DVP1 0x2
#define VIA_DI_PORT_DFPLOW 0x4
#define VIA_DI_PORT_DFPHIGH 0x8
typedef struct ViaPanelMode {
int Width ;
int Height ;
} ViaPanelModeRec, *ViaPanelModePtr ;
typedef struct ViaPanelInfo {
Bool IsActive ;
/* current native resolution */
ViaPanelModePtr NativeMode ;
/* Native resolution index, see via_panel.c */
CARD8 NativeModeIndex;
/* Generated mode for native resolution */
DisplayModePtr NativeDisplayMode ;
#if 0
/* Panel size from configuration */
char* PanelSizeFromOption;
#endif
/* Current mode but centered */
DisplayModePtr CenteredMode ;
/* Determine if we must use the hardware scaler
* It might be false even if the "Center" option
* was specified
*/
Bool Scale;
} ViaPanelInfoRec, *ViaPanelInfoPtr ;
typedef struct ViaLVDSInfo {
Bool IsActive ;
} ViaLVDSInfoRec, *ViaLVDSInfoPtr ;
typedef struct ViaCRTCInfo {
Bool IsActive ;
/* TODO: add CRTC constraints here */
} ViaCRTCInfoRec, *ViaCRTCInfoPtr ;
typedef struct ViaSimultaneousInfo {
Bool IsActive ;
} ViaSimultaneousInfoRec, *ViaSimultaneousInfoPtr ;
typedef struct _VIABIOSINFO {
int scrnIndex;
Bool CrtPresent;
Bool CrtActive;
CARD16 ResolutionIndex;
CARD32 Clock; /* register value for the dotclock */
Bool ClockExternal;
CARD32 Bandwidth; /* available memory bandwidth */
/* Panel/LCD entries */
ViaPanelInfoPtr Panel ;
Bool PanelPresent;
Bool ForcePanel;
int PanelIndex;
Bool Center;
CARD8 BusWidth; /* Digital Output Bus Width */
Bool SetDVI;
/* LCD Simultaneous Expand Mode HWCursor Y Scale */
Bool scaleY;
int resY;
/* DFP */
Bool DfpPresent;
Bool DfpActive;
/* Integrated LVDS */
ViaLVDSInfoPtr Lvds;
/* CRTCs */
ViaCRTCInfoPtr FirstCRTC ;
ViaCRTCInfoPtr SecondCRTC ;
/* Simultaneous */
ViaSimultaneousInfoPtr Simultaneous ;
/* TV entries */
int TVEncoder;
int TVOutput;
Bool TVActive;
I2CDevPtr TVI2CDev;
int TVType;
Bool TVDotCrawl;
int TVDeflicker;
CARD8 TVRegs[0xFF];
int TVNumRegs;
int TVDIPort;
/* TV Callbacks */
void (*TVSave) (ScrnInfoPtr pScrn);
void (*TVRestore) (ScrnInfoPtr pScrn);
Bool (*TVDACSense) (ScrnInfoPtr pScrn);
ModeStatus (*TVModeValid) (ScrnInfoPtr pScrn, DisplayModePtr mode);
void (*TVModeI2C) (ScrnInfoPtr pScrn, DisplayModePtr mode);
void (*TVModeCrtc) (ScrnInfoPtr pScrn, DisplayModePtr mode);
void (*TVPower) (ScrnInfoPtr pScrn, Bool On);
void (*LCDPower) (ScrnInfoPtr pScrn, Bool On);
DisplayModePtr TVModes;
void (*TVPrintRegs) (ScrnInfoPtr pScrn);
} VIABIOSInfoRec, *VIABIOSInfoPtr;
/* Function prototypes */
/* via_vbe.c */
void ViaVbeAdjustFrame(int scrnIndex, int x, int y, int flags);
Bool ViaVbeSetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode);
Bool ViaVbeSaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function);
Bool ViaVbeModePreInit(ScrnInfoPtr pScrn);
void ViaVbeDPMS(ScrnInfoPtr pScrn, int mode, int flags);
void ViaVbeDoDPMS(ScrnInfoPtr pScrn, int mode);
/* via_mode.c */
void ViaOutputsDetect(ScrnInfoPtr pScrn);
Bool ViaOutputsSelect(ScrnInfoPtr pScrn);
void ViaModesAttach(ScrnInfoPtr pScrn, MonPtr monitorp);
CARD32 ViaGetMemoryBandwidth(ScrnInfoPtr pScrn);
ModeStatus ViaValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags);
void ViaModePrimaryLegacy(ScrnInfoPtr pScrn, DisplayModePtr mode);
void ViaModeSecondaryLegacy(ScrnInfoPtr pScrn, DisplayModePtr mode);
void ViaLCDPower(ScrnInfoPtr pScrn, Bool On);
void ViaDFPPower(ScrnInfoPtr pScrn, Bool On);
void ViaTVPower(ScrnInfoPtr pScrn, Bool On);
void ViaTVSave(ScrnInfoPtr pScrn);
void ViaTVRestore(ScrnInfoPtr pScrn);
#ifdef HAVE_DEBUG
void ViaTVPrintRegs(ScrnInfoPtr pScrn);
#endif
void ViaModeSecondCRTC(ScrnInfoPtr pScrn, DisplayModePtr mode);
void ViaModeFirstCRTC(ScrnInfoPtr pScrn, DisplayModePtr mode);
void ViaModeSet(ScrnInfoPtr pScrn, DisplayModePtr mode);
/* via_crtc.c */
void ViaPreInitCRTCConfig(ScrnInfoPtr pScrn);
void ViaCRTCInit(ScrnInfoPtr pScrn);
void ViaFirstCRTCSetStartingAddress(ScrnInfoPtr pSCrn, int x, int y);
void ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
void ViaSecondCRTCSetStartingAddress(ScrnInfoPtr pScrn, int x, int y);
void ViaSecondCRTCHorizontalOffset(ScrnInfoPtr pScrn);
void ViaSecondCRTCHorizontalQWCount(ScrnInfoPtr pScrn, int width);
void ViaSecondCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
ModeStatus ViaFirstCRTCModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode);
ModeStatus ViaSecondCRTCModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode);
void ViaShadowCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
/* via_panel.c */
void ViaPanelScale(ScrnInfoPtr pScrn, int resWidth, int resHeight, int panelWidth, int panelHeight );
void ViaPanelScaleDisable(ScrnInfoPtr pScrn);
void ViaPanelGetNativeModeFromScratchPad(ScrnInfoPtr pScrn);
void ViaPanelGetNativeModeFromOption(ScrnInfoPtr pScrn, char* name);
void ViaPanelPreInit(ScrnInfoPtr pScrn);
void ViaPanelCenterMode(DisplayModePtr centerMode, DisplayModePtr panelMode, DisplayModePtr mode);
Bool ViaPanelGetSizeFromDDCv1(ScrnInfoPtr pScrn, int* width, int* height);
Bool ViaPanelGetSizeFromDDCv2(ScrnInfoPtr pScrn, int* width);
Bool ViaPanelGetSizeFromEDID(ScrnInfoPtr pScrn, xf86MonPtr pMon, int* width, int* height);
/* via_lvds.c */
void ViaLVDSPower(ScrnInfoPtr pScrn, Bool on);
/* in via_bandwidth.c */
void ViaSetPrimaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode);
void ViaSetSecondaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode);
void ViaDisablePrimaryFIFO(ScrnInfoPtr pScrn);
/* via_vt162x.c */
I2CDevPtr ViaVT162xDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address);
void ViaVT162xInit(ScrnInfoPtr pScrn);
/* via_ch7xxx.c */
I2CDevPtr ViaCH7xxxDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address);
void ViaCH7xxxInit(ScrnInfoPtr pScrn);
/* via_display.c */
void ViaSecondDisplayChannelEnable(ScrnInfoPtr pScrn);
void ViaSecondDisplayChannelDisable(ScrnInfoPtr pScrn);
void ViaDisplayInit(ScrnInfoPtr pScrn);
void ViaDisplayEnableSimultaneous(ScrnInfoPtr pScrn);
void ViaDisplayDisableSimultaneous(ScrnInfoPtr pScrn);
void ViaDisplayEnableCRT(ScrnInfoPtr pScrn);
void ViaDisplayDisableCRT(ScrnInfoPtr pScrn);
#endif /* _VIA_BIOS_H_ */
|