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" |
Kenji Toyama | f432879 | 2011-04-24 13:35:35 +0800 | [diff] [blame] | 6 | #include <linux/io.h> |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7 | #include <linux/types.h> |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8 | |
Aaro Koskinen | 0998e1d | 2011-03-13 12:26:16 +0200 | [diff] [blame] | 9 | #include "vb_util.h" |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10 | |
Aaro Koskinen | d0e23bd | 2011-03-13 12:26:27 +0200 | [diff] [blame] | 11 | void xgifb_reg_set(unsigned long port, u8 index, u8 data) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 12 | { |
Bill Pemberton | 1e59f71 | 2010-06-17 13:10:41 -0400 | [diff] [blame] | 13 | outb(index, port); |
| 14 | outb(data, port + 1); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 15 | } |
| 16 | |
Aaro Koskinen | d0e23bd | 2011-03-13 12:26:27 +0200 | [diff] [blame] | 17 | u8 xgifb_reg_get(unsigned long port, u8 index) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 18 | { |
Aaro Koskinen | d0e23bd | 2011-03-13 12:26:27 +0200 | [diff] [blame] | 19 | u8 data; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 20 | |
Prashant P. Shah | 602f2c9 | 2010-09-04 12:09:32 +0530 | [diff] [blame] | 21 | outb(index, port); |
| 22 | data = inb(port + 1); |
| 23 | return data; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 24 | } |
| 25 | |
Aaro Koskinen | 459d2ea | 2011-03-13 12:26:28 +0200 | [diff] [blame] | 26 | void xgifb_reg_and_or(unsigned long port, u8 index, |
| 27 | unsigned data_and, unsigned data_or) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 28 | { |
Aaro Koskinen | d0e23bd | 2011-03-13 12:26:27 +0200 | [diff] [blame] | 29 | u8 temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 30 | |
Aaro Koskinen | 459d2ea | 2011-03-13 12:26:28 +0200 | [diff] [blame] | 31 | temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */ |
| 32 | temp = (temp & data_and) | data_or; |
| 33 | xgifb_reg_set(port, index, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 34 | } |
| 35 | |
Aaro Koskinen | 459d2ea | 2011-03-13 12:26:28 +0200 | [diff] [blame] | 36 | void xgifb_reg_and(unsigned long port, u8 index, unsigned data_and) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 37 | { |
Aaro Koskinen | d0e23bd | 2011-03-13 12:26:27 +0200 | [diff] [blame] | 38 | u8 temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 39 | |
Aaro Koskinen | 459d2ea | 2011-03-13 12:26:28 +0200 | [diff] [blame] | 40 | temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */ |
| 41 | temp &= data_and; |
| 42 | xgifb_reg_set(port, index, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 43 | } |
| 44 | |
Aaro Koskinen | 459d2ea | 2011-03-13 12:26:28 +0200 | [diff] [blame] | 45 | void xgifb_reg_or(unsigned long port, u8 index, unsigned data_or) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 46 | { |
Aaro Koskinen | d0e23bd | 2011-03-13 12:26:27 +0200 | [diff] [blame] | 47 | u8 temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 48 | |
Aaro Koskinen | 459d2ea | 2011-03-13 12:26:28 +0200 | [diff] [blame] | 49 | temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */ |
| 50 | temp |= data_or; |
| 51 | xgifb_reg_set(port, index, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 52 | } |