1/*
2 * Copyright (c) 2005 ASPEED Technology Inc.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of the authors not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission.  The authors makes no representations
11 * about the suitability of this software for any purpose.  It is provided
12 * "as is" without express or implied warranty.
13 *
14 * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
21 */
22
23/* Mode Limitation */
24#define MAX_HResolution		1920
25#define MAX_VResolution		1200
26
27/* Std. Table Index Definition */
28#define TextModeIndex 		0
29#define EGAModeIndex 		1
30#define VGAModeIndex 		2
31#define HiCModeIndex 		3
32#define TrueCModeIndex 		4
33
34/* DCLK Index */
35#define VCLK25_175     		0x00
36#define VCLK28_322     		0x01
37#define VCLK31_5       		0x02
38#define VCLK36         		0x03
39#define VCLK40         		0x04
40#define VCLK49_5       		0x05
41#define VCLK50         		0x06
42#define VCLK56_25      		0x07
43#define VCLK65		 	0x08
44#define VCLK75	        	0x09
45#define VCLK78_75      		0x0A
46#define VCLK94_5       		0x0B
47#define VCLK108        		0x0C
48#define VCLK135        		0x0D
49#define VCLK157_5      		0x0E
50#define VCLK162        		0x0F
51/* #define VCLK193_25     		0x10 */
52#define VCLK154     		0x10
53#define VCLK83_5    		0x11
54#define VCLK106_5   		0x12
55#define VCLK146_25  		0x13
56#define VCLK148_5   		0x14
57#define VCLK71      		0x15
58#define VCLK88_75   		0x16
59#define VCLK119     		0x17
60#define VCLK85_5     		0x18
61#define VCLK97_75     		0x19
62#define VCLK118_25     		0x1A
63
64/* Flags Definition */
65#define Charx8Dot               0x00000001
66#define HalfDCLK                0x00000002
67#define DoubleScanMode          0x00000004
68#define LineCompareOff          0x00000008
69#define HBorder                 0x00000020
70#define VBorder                 0x00000010
71#define WideScreenMode		0x00000100
72#define NewModeInfo		0x00000200
73#define NHSync			0x00000400
74#define PHSync			0x00000800
75#define NVSync			0x00001000
76#define PVSync			0x00002000
77#define	SyncPP			(PVSync | PHSync)
78#define	SyncPN			(PVSync | NHSync)
79#define	SyncNP			(NVSync | PHSync)
80#define	SyncNN			(NVSync | NHSync)
81#define AST2500PreCatchCRT		0x00004000
82
83/* DAC Definition */
84#define DAC_NUM_TEXT		64
85#define DAC_NUM_EGA		64
86#define DAC_NUM_VGA		256
87
88/* Data Structure declaration for internal use */
89typedef struct {
90
91    UCHAR MISC;
92    UCHAR SEQ[4];
93    UCHAR CRTC[25];
94    UCHAR AR[20];
95    UCHAR GR[9];
96
97} VBIOS_STDTABLE_STRUCT, *PVBIOS_STDTABLE_STRUCT;
98
99typedef struct {
100
101    ULONG HT;
102    ULONG HDE;
103    ULONG HFP;
104    ULONG HSYNC;
105    ULONG VT;
106    ULONG VDE;
107    ULONG VFP;
108    ULONG VSYNC;
109    ULONG DCLKIndex;
110    ULONG Flags;
111
112    ULONG ulRefreshRate;
113    ULONG ulRefreshRateIndex;
114    ULONG ulModeID;
115
116} VBIOS_ENHTABLE_STRUCT, *PVBIOS_ENHTABLE_STRUCT;
117
118typedef struct {
119    UCHAR Param1;
120    UCHAR Param2;
121    UCHAR Param3;
122} VBIOS_DCLK_INFO, *PVBIOS_DCLK_INFO;
123
124typedef struct {
125    UCHAR DACR;
126    UCHAR DACG;
127    UCHAR DACB;
128} VBIOS_DAC_INFO, *PVBIOS_DAC_INFO;
129
130typedef struct {
131    PVBIOS_STDTABLE_STRUCT pStdTableEntry;
132    PVBIOS_ENHTABLE_STRUCT pEnhTableEntry;
133
134} VBIOS_MODE_INFO, *PVBIOS_MODE_INFO;
135