Get generic kernels to be as forgiving of users with lossy hardware
[unix-history] / sys / i386 / include / pio.h
CommitLineData
15637ed4
RG
1/*
2 * Mach Operating System
3 * Copyright (c) 1990 Carnegie-Mellon University
4 * All rights reserved. The CMU software License Agreement specifies
5 * the terms and conditions for use and redistribution.
15637ed4 6 *
db11a0e0 7 * from: Mach, unknown, 386BSD patch kit
126bd309 8 * $Id: pio.h,v 1.2 1993/10/16 14:39:23 rgrimes Exp $
15637ed4
RG
9 */
10
126bd309
GW
11#ifndef _MACHINE_PIO_H_
12#define _MACHINE_PIO_H_ 1
13
15637ed4
RG
14#define inl(y) \
15({ unsigned long _tmp__; \
16 asm volatile("inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
17 _tmp__; })
18
19#define inw(y) \
20({ unsigned short _tmp__; \
21 asm volatile(".byte 0x66; inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
22 _tmp__; })
23
24/*
25 * only do this if it has not already be defined.. this is a crock for the
26 * patch kit for right now. Need to clean up all the inx, outx stuff for
27 * 0.1.5 to use 1 common header file, that has Bruces fast mode inb/outb
28 * stuff in it. Rgrimes 5/27/93
29 */
30#ifndef inb
31#define inb(y) \
32({ unsigned char _tmp__; \
33 asm volatile("inb %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
34 _tmp__; })
35#endif
36
37
38#define outl(x, y) \
39{ asm volatile("outl %0, %1" : : "a" (y) , "d" ((unsigned short)(x))); }
40
41
42#define outw(x, y) \
43{asm volatile(".byte 0x66; outl %0, %1" : : "a" ((unsigned short)(y)) , "d" ((unsigned short)(x))); }
44
45
46#define outb(x, y) \
47{ asm volatile("outb %0, %1" : : "a" ((unsigned char)(y)) , "d" ((unsigned short)(x))); }
126bd309 48#endif /* _MACHINE_PIO_H_ */