]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/staging/xgifb/vb_util.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-bionic-kernel.git] / drivers / staging / xgifb / vb_util.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
d7636e0b 2#ifndef _VBUTIL_
3#define _VBUTIL_
fb44d9a5
PH
4static inline void xgifb_reg_set(unsigned long port, u8 index, u8 data)
5{
6 outb(index, port);
7 outb(data, port + 1);
8}
9
10static inline u8 xgifb_reg_get(unsigned long port, u8 index)
11{
12 outb(index, port);
13 return inb(port + 1);
14}
15
16static inline void xgifb_reg_and_or(unsigned long port, u8 index,
d3120076 17 unsigned int data_and, unsigned int data_or)
fb44d9a5
PH
18{
19 u8 temp;
20
21 temp = xgifb_reg_get(port, index);
2a3d1079 22 temp = (u8)((temp & data_and) | data_or);
fb44d9a5
PH
23 xgifb_reg_set(port, index, temp);
24}
25
d3120076
CB
26static inline void xgifb_reg_and(unsigned long port, u8 index,
27 unsigned int data_and)
fb44d9a5
PH
28{
29 u8 temp;
30
31 temp = xgifb_reg_get(port, index);
2a3d1079 32 temp = (u8)(temp & data_and);
fb44d9a5
PH
33 xgifb_reg_set(port, index, temp);
34}
35
d3120076
CB
36static inline void xgifb_reg_or(unsigned long port, u8 index,
37 unsigned int data_or)
fb44d9a5
PH
38{
39 u8 temp;
40
41 temp = xgifb_reg_get(port, index);
42 temp |= data_or;
43 xgifb_reg_set(port, index, temp);
44}
d7636e0b 45#endif
46