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