vb_util.c revision f5b571fa24f523265b6bf9a282e0aa7eeff8098a
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/* --------------------------------------------------------------------- */
12/* Function : XGINew_SetReg1 */
13/* Input : */
14/* Output : */
15/* Description : SR CRTC GR */
16/* --------------------------------------------------------------------- */
17void XGINew_SetReg1(unsigned long port, unsigned short index,
18		unsigned short data)
19{
20	outb(index, port);
21	outb(data, port + 1);
22}
23
24void XGINew_SetReg3(unsigned long port, unsigned short data)
25{
26	outb(data, port);
27}
28
29void XGINew_SetReg4(unsigned long port, unsigned long data)
30{
31	outl(data, port);
32}
33
34unsigned char XGINew_GetReg1(unsigned long port, unsigned short index)
35{
36	unsigned char data;
37
38	outb(index, port);
39	data = inb(port + 1);
40	return data;
41}
42
43void XGINew_SetRegANDOR(unsigned long Port, unsigned short Index,
44		unsigned short DataAND, unsigned short DataOR)
45{
46	unsigned short temp;
47
48	temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */
49	temp = (temp & (DataAND)) | DataOR;
50	XGINew_SetReg1(Port, Index, temp);
51}
52
53void XGINew_SetRegAND(unsigned long Port, unsigned short Index,
54		unsigned short DataAND)
55{
56	unsigned short temp;
57
58	temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */
59	temp &= DataAND;
60	XGINew_SetReg1(Port, Index, temp);
61}
62
63void XGINew_SetRegOR(unsigned long Port, unsigned short Index,
64		unsigned short DataOR)
65{
66	unsigned short temp;
67
68	temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */
69	temp |= DataOR;
70	XGINew_SetReg1(Port, Index, temp);
71}
72