apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1 | #include "vb_def.h" |
| 2 | #include "vgatypes.h" |
| 3 | #include "vb_struct.h" |
| 4 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5 | #include "XGIfb.h" |
| 6 | #include <asm/io.h> |
| 7 | #include <linux/types.h> |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9 | void XGINew_SetReg1(unsigned long,unsigned short,unsigned short); |
| 10 | void XGINew_SetReg2(unsigned long,unsigned short,unsigned short); |
| 11 | void XGINew_SetReg3(unsigned long,unsigned short); |
| 12 | void XGINew_SetReg4(unsigned long,unsigned long); |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 13 | unsigned char XGINew_GetReg1(unsigned long, unsigned short); |
| 14 | unsigned char XGINew_GetReg2(unsigned long); |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 15 | unsigned long XGINew_GetReg3(unsigned long); |
| 16 | void XGINew_ClearDAC(unsigned char *); |
| 17 | void XGINew_SetRegANDOR(unsigned long Port,unsigned short Index, |
| 18 | unsigned short DataAND,unsigned short DataOR); |
| 19 | void XGINew_SetRegOR(unsigned long Port,unsigned short Index, |
| 20 | unsigned short DataOR); |
| 21 | void XGINew_SetRegAND(unsigned long Port,unsigned short Index, |
| 22 | unsigned short DataAND); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 23 | |
| 24 | |
| 25 | /* --------------------------------------------------------------------- */ |
| 26 | /* Function : XGINew_SetReg1 */ |
| 27 | /* Input : */ |
| 28 | /* Output : */ |
| 29 | /* Description : SR CRTC GR */ |
| 30 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 31 | void XGINew_SetReg1( unsigned long port , unsigned short index , unsigned short data ) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 32 | { |
Bill Pemberton | 1e59f71 | 2010-06-17 13:10:41 -0400 | [diff] [blame] | 33 | outb(index, port); |
| 34 | outb(data, port + 1); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | |
| 38 | /* --------------------------------------------------------------------- */ |
| 39 | /* Function : XGINew_SetReg2 */ |
| 40 | /* Input : */ |
| 41 | /* Output : */ |
| 42 | /* Description : AR( 3C0 ) */ |
| 43 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 44 | /*void XGINew_SetReg2( unsigned long port , unsigned short index , unsigned short data ) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 45 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 46 | InPortByte((P unsigned char )port + 0x3da - 0x3c0) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 47 | 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 Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 59 | void XGINew_SetReg3( unsigned long port , unsigned short data ) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 60 | { |
Bill Pemberton | 1e59f71 | 2010-06-17 13:10:41 -0400 | [diff] [blame] | 61 | outb(data, port); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | |
| 65 | /* --------------------------------------------------------------------- */ |
| 66 | /* Function : XGINew_SetReg4 */ |
| 67 | /* Input : */ |
| 68 | /* Output : */ |
| 69 | /* Description : */ |
| 70 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 71 | void XGINew_SetReg4( unsigned long port , unsigned long data ) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 72 | { |
Bill Pemberton | 1e59f71 | 2010-06-17 13:10:41 -0400 | [diff] [blame] | 73 | outl(data, port); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | |
| 77 | /* --------------------------------------------------------------------- */ |
| 78 | /* Function : XGINew_GetReg1 */ |
| 79 | /* Input : */ |
| 80 | /* Output : */ |
| 81 | /* Description : */ |
| 82 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 83 | unsigned char XGINew_GetReg1(unsigned long port, unsigned short index) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 84 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 85 | unsigned char data ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 86 | |
Bill Pemberton | 1e59f71 | 2010-06-17 13:10:41 -0400 | [diff] [blame] | 87 | outb(index, port); |
| 88 | data = inb(port + 1) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 89 | return( data ) ; |
| 90 | } |
| 91 | |
| 92 | |
| 93 | /* --------------------------------------------------------------------- */ |
| 94 | /* Function : XGINew_GetReg2 */ |
| 95 | /* Input : */ |
| 96 | /* Output : */ |
| 97 | /* Description : */ |
| 98 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 99 | unsigned char XGINew_GetReg2(unsigned long port) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 100 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 101 | unsigned char data ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 102 | |
Bill Pemberton | 1e59f71 | 2010-06-17 13:10:41 -0400 | [diff] [blame] | 103 | data = inb(port) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 104 | |
| 105 | return( data ) ; |
| 106 | } |
| 107 | |
| 108 | |
| 109 | /* --------------------------------------------------------------------- */ |
| 110 | /* Function : XGINew_GetReg3 */ |
| 111 | /* Input : */ |
| 112 | /* Output : */ |
| 113 | /* Description : */ |
| 114 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 115 | unsigned long XGINew_GetReg3( unsigned long port ) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 116 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 117 | unsigned long data ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 118 | |
Bill Pemberton | 1e59f71 | 2010-06-17 13:10:41 -0400 | [diff] [blame] | 119 | data = inl(port) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 120 | |
| 121 | return( data ) ; |
| 122 | } |
| 123 | |
| 124 | |
| 125 | |
| 126 | /* --------------------------------------------------------------------- */ |
| 127 | /* Function : XGINew_SetRegANDOR */ |
| 128 | /* Input : */ |
| 129 | /* Output : */ |
| 130 | /* Description : */ |
| 131 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 132 | void XGINew_SetRegANDOR( unsigned long Port , unsigned short Index , unsigned short DataAND , unsigned short DataOR ) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 133 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 134 | unsigned short temp ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 135 | |
| 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 Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 148 | void XGINew_SetRegAND(unsigned long Port,unsigned short Index,unsigned short DataAND) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 149 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 150 | unsigned short temp ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 151 | |
| 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 Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 164 | void XGINew_SetRegOR( unsigned long Port , unsigned short Index , unsigned short DataOR ) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 165 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 166 | unsigned short temp ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 167 | |
| 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 | /* --------------------------------------------------------------------- */ |
| 180 | void NewDelaySeconds( int seconds ) |
| 181 | { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 182 | int i ; |
| 183 | |
| 184 | |
| 185 | for( i = 0 ; i < seconds ; i++ ) |
| 186 | { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 187 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 188 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 189 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 190 | } |
| 191 | } |
| 192 | |
| 193 | |
| 194 | /* --------------------------------------------------------------------- */ |
| 195 | /* Function : Newdebugcode */ |
| 196 | /* Input : */ |
| 197 | /* Output : */ |
| 198 | /* Description : */ |
| 199 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 200 | void Newdebugcode(unsigned char code) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 201 | { |
| 202 | // OutPortByte ( 0x80 , code ) ; |
| 203 | /* OutPortByte ( 0x300 , code ) ; */ |
| 204 | /* NewDelaySeconds( 0x3 ) ; */ |
| 205 | } |
| 206 | |
| 207 | |
| 208 | |