1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
4  * All rights reserved.
5  *
6  * Purpose: Macros to access device
7  *
8  * Author: Tevin Chen
9  *
10  * Date: Mar 17, 1997
11  *
12  */
13 
14 #ifndef __UPC_H__
15 #define __UPC_H__
16 
17 #include "device.h"
18 
19 /*---------------------  Export Definitions -------------------------*/
20 
21 /* For memory mapped IO */
22 
23 #define VNSvInPortB(dwIOAddress, pbyData) \
24 	(*(pbyData) = ioread8(dwIOAddress))
25 
26 #define VNSvInPortW(dwIOAddress, pwData) \
27 	(*(pwData) = ioread16(dwIOAddress))
28 
29 #define VNSvInPortD(dwIOAddress, pdwData) \
30 	(*(pdwData) = ioread32(dwIOAddress))
31 
32 #define VNSvOutPortB(dwIOAddress, byData) \
33 	iowrite8((u8)(byData), dwIOAddress)
34 
35 #define VNSvOutPortW(dwIOAddress, wData) \
36 	iowrite16((u16)(wData), dwIOAddress)
37 
38 #define VNSvOutPortD(dwIOAddress, dwData) \
39 	iowrite32((u32)(dwData), dwIOAddress)
40 
41 #define PCAvDelayByIO(uDelayUnit)				\
42 do {								\
43 	unsigned char __maybe_unused byData;			\
44 	unsigned long ii;					\
45 								\
46 	if (uDelayUnit <= 50) {					\
47 		udelay(uDelayUnit);				\
48 	} else {						\
49 		for (ii = 0; ii < (uDelayUnit); ii++)		\
50 			byData = inb(0x61);			\
51 	}							\
52 } while (0)
53 
54 /*---------------------  Export Classes  ----------------------------*/
55 
56 /*---------------------  Export Variables  --------------------------*/
57 
58 /*---------------------  Export Functions  --------------------------*/
59 
60 #endif /* __UPC_H__ */
61