blob: 2c40368ceee2c497de7bcfabd6f320f59c900a6d [file] [log] [blame]
apatard@mandriva.comd7636e02010-05-19 10:44:14 +02001#include "vb_def.h"
2#include "vgatypes.h"
3#include "vb_struct.h"
4
apatard@mandriva.comd7636e02010-05-19 10:44:14 +02005#include "XGIfb.h"
6#include <asm/io.h>
7#include <linux/types.h>
apatard@mandriva.comd7636e02010-05-19 10:44:14 +02008
Bill Pemberton82d6eb52010-06-17 13:10:46 -04009void XGINew_SetReg1(unsigned long,unsigned short,unsigned short);
10void XGINew_SetReg2(unsigned long,unsigned short,unsigned short);
11void XGINew_SetReg3(unsigned long,unsigned short);
12void XGINew_SetReg4(unsigned long,unsigned long);
Bill Pemberton108afbf2010-06-17 13:10:47 -040013unsigned char XGINew_GetReg1(unsigned long, unsigned short);
14unsigned char XGINew_GetReg2(unsigned long);
Bill Pemberton82d6eb52010-06-17 13:10:46 -040015unsigned long XGINew_GetReg3(unsigned long);
16void XGINew_ClearDAC(unsigned char *);
17void XGINew_SetRegANDOR(unsigned long Port,unsigned short Index,
18 unsigned short DataAND,unsigned short DataOR);
19void XGINew_SetRegOR(unsigned long Port,unsigned short Index,
20 unsigned short DataOR);
21void XGINew_SetRegAND(unsigned long Port,unsigned short Index,
22 unsigned short DataAND);
apatard@mandriva.comd7636e02010-05-19 10:44:14 +020023
24
25/* --------------------------------------------------------------------- */
26/* Function : XGINew_SetReg1 */
27/* Input : */
28/* Output : */
29/* Description : SR CRTC GR */
30/* --------------------------------------------------------------------- */
Bill Pemberton82d6eb52010-06-17 13:10:46 -040031void XGINew_SetReg1( unsigned long port , unsigned short index , unsigned short data )
apatard@mandriva.comd7636e02010-05-19 10:44:14 +020032{
Bill Pemberton1e59f712010-06-17 13:10:41 -040033 outb(index, port);
34 outb(data, port + 1);
apatard@mandriva.comd7636e02010-05-19 10:44:14 +020035}
36
37
38/* --------------------------------------------------------------------- */
39/* Function : XGINew_SetReg2 */
40/* Input : */
41/* Output : */
42/* Description : AR( 3C0 ) */
43/* --------------------------------------------------------------------- */
Bill Pemberton82d6eb52010-06-17 13:10:46 -040044/*void XGINew_SetReg2( unsigned long port , unsigned short index , unsigned short data )
apatard@mandriva.comd7636e02010-05-19 10:44:14 +020045{
Bill Pemberton108afbf2010-06-17 13:10:47 -040046 InPortByte((P unsigned char )port + 0x3da - 0x3c0) ;
apatard@mandriva.comd7636e02010-05-19 10:44:14 +020047 OutPortByte( XGINew_P3c0 , index ) ;
48 OutPortByte( XGINew_P3c0 , data ) ;
49 OutPortByte( XGINew_P3c0 , 0x20 ) ;
50}*/
51
52
53/* --------------------------------------------------------------------- */
54/* Function : */
55/* Input : */
56/* Output : */
57/* Description : */
58/* --------------------------------------------------------------------- */
Bill Pemberton82d6eb52010-06-17 13:10:46 -040059void XGINew_SetReg3( unsigned long port , unsigned short data )
apatard@mandriva.comd7636e02010-05-19 10:44:14 +020060{
Bill Pemberton1e59f712010-06-17 13:10:41 -040061 outb(data, port);
apatard@mandriva.comd7636e02010-05-19 10:44:14 +020062}
63
64
65/* --------------------------------------------------------------------- */
66/* Function : XGINew_SetReg4 */
67/* Input : */
68/* Output : */
69/* Description : */
70/* --------------------------------------------------------------------- */
Bill Pemberton82d6eb52010-06-17 13:10:46 -040071void XGINew_SetReg4( unsigned long port , unsigned long data )
apatard@mandriva.comd7636e02010-05-19 10:44:14 +020072{
Bill Pemberton1e59f712010-06-17 13:10:41 -040073 outl(data, port);
apatard@mandriva.comd7636e02010-05-19 10:44:14 +020074}
75
76
77/* --------------------------------------------------------------------- */
78/* Function : XGINew_GetReg1 */
79/* Input : */
80/* Output : */
81/* Description : */
82/* --------------------------------------------------------------------- */
Bill Pemberton108afbf2010-06-17 13:10:47 -040083unsigned char XGINew_GetReg1(unsigned long port, unsigned short index)
apatard@mandriva.comd7636e02010-05-19 10:44:14 +020084{
Bill Pemberton108afbf2010-06-17 13:10:47 -040085 unsigned char data ;
apatard@mandriva.comd7636e02010-05-19 10:44:14 +020086
Bill Pemberton1e59f712010-06-17 13:10:41 -040087 outb(index, port);
88 data = inb(port + 1) ;
apatard@mandriva.comd7636e02010-05-19 10:44:14 +020089 return( data ) ;
90}
91
92
93/* --------------------------------------------------------------------- */
94/* Function : XGINew_GetReg2 */
95/* Input : */
96/* Output : */
97/* Description : */
98/* --------------------------------------------------------------------- */
Bill Pemberton108afbf2010-06-17 13:10:47 -040099unsigned char XGINew_GetReg2(unsigned long port)
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200100{
Bill Pemberton108afbf2010-06-17 13:10:47 -0400101 unsigned char data ;
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200102
Bill Pemberton1e59f712010-06-17 13:10:41 -0400103 data = inb(port) ;
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200104
105 return( data ) ;
106}
107
108
109/* --------------------------------------------------------------------- */
110/* Function : XGINew_GetReg3 */
111/* Input : */
112/* Output : */
113/* Description : */
114/* --------------------------------------------------------------------- */
Bill Pemberton82d6eb52010-06-17 13:10:46 -0400115unsigned long XGINew_GetReg3( unsigned long port )
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200116{
Bill Pemberton82d6eb52010-06-17 13:10:46 -0400117 unsigned long data ;
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200118
Bill Pemberton1e59f712010-06-17 13:10:41 -0400119 data = inl(port) ;
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200120
121 return( data ) ;
122}
123
124
125
126/* --------------------------------------------------------------------- */
127/* Function : XGINew_SetRegANDOR */
128/* Input : */
129/* Output : */
130/* Description : */
131/* --------------------------------------------------------------------- */
Bill Pemberton82d6eb52010-06-17 13:10:46 -0400132void XGINew_SetRegANDOR( unsigned long Port , unsigned short Index , unsigned short DataAND , unsigned short DataOR )
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200133{
Bill Pemberton82d6eb52010-06-17 13:10:46 -0400134 unsigned short temp ;
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200135
136 temp = XGINew_GetReg1( Port , Index ) ; /* XGINew_Part1Port index 02 */
137 temp = ( temp & ( DataAND ) ) | DataOR ;
138 XGINew_SetReg1( Port , Index , temp ) ;
139}
140
141
142/* --------------------------------------------------------------------- */
143/* Function : XGINew_SetRegAND */
144/* Input : */
145/* Output : */
146/* Description : */
147/* --------------------------------------------------------------------- */
Bill Pemberton82d6eb52010-06-17 13:10:46 -0400148void XGINew_SetRegAND(unsigned long Port,unsigned short Index,unsigned short DataAND)
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200149{
Bill Pemberton82d6eb52010-06-17 13:10:46 -0400150 unsigned short temp ;
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200151
152 temp = XGINew_GetReg1( Port , Index ) ; /* XGINew_Part1Port index 02 */
153 temp &= DataAND ;
154 XGINew_SetReg1( Port , Index , temp ) ;
155}
156
157
158/* --------------------------------------------------------------------- */
159/* Function : XGINew_SetRegOR */
160/* Input : */
161/* Output : */
162/* Description : */
163/* --------------------------------------------------------------------- */
Bill Pemberton82d6eb52010-06-17 13:10:46 -0400164void XGINew_SetRegOR( unsigned long Port , unsigned short Index , unsigned short DataOR )
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200165{
Bill Pemberton82d6eb52010-06-17 13:10:46 -0400166 unsigned short temp ;
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200167
168 temp = XGINew_GetReg1( Port , Index ) ; /* XGINew_Part1Port index 02 */
169 temp |= DataOR ;
170 XGINew_SetReg1( Port , Index , temp ) ;
171}
172
173
174/* --------------------------------------------------------------------- */
175/* Function : NewDelaySecond */
176/* Input : */
177/* Output : */
178/* Description : */
179/* --------------------------------------------------------------------- */
180void NewDelaySeconds( int seconds )
181{
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200182 int i ;
183
184
185 for( i = 0 ; i < seconds ; i++ )
186 {
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200187
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200188
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200189
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200190 }
191}
192
193
194/* --------------------------------------------------------------------- */
195/* Function : Newdebugcode */
196/* Input : */
197/* Output : */
198/* Description : */
199/* --------------------------------------------------------------------- */
Bill Pemberton108afbf2010-06-17 13:10:47 -0400200void Newdebugcode(unsigned char code)
apatard@mandriva.comd7636e02010-05-19 10:44:14 +0200201{
202// OutPortByte ( 0x80 , code ) ;
203 /* OutPortByte ( 0x300 , code ) ; */
204 /* NewDelaySeconds( 0x3 ) ; */
205}
206
207
208