Merge branch 'for-linus' of git://www.jni.nu/cris
[cascardo/linux.git] / drivers / staging / xgifb / vb_util.c
1 #include "vb_def.h"
2 #include "vgatypes.h"
3 #include "vb_struct.h"
4
5 #include "XGIfb.h"
6 #include <asm/io.h>
7 #include <linux/types.h>
8
9 #include "vb_util.h"
10
11 void xgifb_reg_set(unsigned long port, u8 index, u8 data)
12 {
13         outb(index, port);
14         outb(data, port + 1);
15 }
16
17 u8 xgifb_reg_get(unsigned long port, u8 index)
18 {
19         u8 data;
20
21         outb(index, port);
22         data = inb(port + 1);
23         return data;
24 }
25
26 void xgifb_reg_and_or(unsigned long port, u8 index,
27                 unsigned data_and, unsigned data_or)
28 {
29         u8 temp;
30
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);
34 }
35
36 void xgifb_reg_and(unsigned long port, u8 index, unsigned data_and)
37 {
38         u8 temp;
39
40         temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */
41         temp &= data_and;
42         xgifb_reg_set(port, index, temp);
43 }
44
45 void xgifb_reg_or(unsigned long port, u8 index, unsigned data_or)
46 {
47         u8 temp;
48
49         temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */
50         temp |= data_or;
51         xgifb_reg_set(port, index, temp);
52 }