Commit | Line | Data |
---|---|---|
7dc7e04a WN |
1 | /*- |
2 | * Copyright (c) 1990 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * This code is derived from software contributed to Berkeley by | |
6 | * William Jolitz. | |
7 | * | |
8 | * %sccs.include.noredist.c% | |
9 | * | |
3bcbb99c | 10 | * @(#)isa.h 5.2 (Berkeley) %G% |
7dc7e04a WN |
11 | */ |
12 | ||
13 | /* | |
14 | * AT bus specific definitions. | |
15 | */ | |
3bcbb99c | 16 | #ifndef LOCORE |
7dc7e04a WN |
17 | |
18 | #define Rd(s) ({u_char rtn; u_short ioa; \ | |
19 | ioa = (s); \ | |
20 | asm volatile ("movw %1,%%dx; nop ; in %%dx,%%al ; nop ; movb %%al,%0" \ | |
21 | : "=g" (rtn) \ | |
22 | : "g" (ioa) \ | |
23 | : "ax", "dx"); \ | |
24 | rtn; \ | |
25 | }) | |
26 | ||
27 | #define Wr(s,n) ({u_char val; u_short ioa; \ | |
28 | ioa = (s); \ | |
29 | val = (n); \ | |
30 | asm volatile ("movb %1,%%al; movw %0,%%dx; nop; out %%al,%%dx ; nop" \ | |
31 | : /* nothing returned */ \ | |
32 | : "g" (ioa), "g" (val) \ | |
33 | : "ax", "dx"); \ | |
34 | }) | |
35 | ||
36 | ||
37 | #define rdw(s) ({u_short rtn; u_short ioa; \ | |
38 | ioa = (s); \ | |
39 | asm volatile ("movw %1,%%dx; nop ; in %%dx,%%ax ; nop ; movw %%ax,%0" \ | |
40 | : "=g" (rtn) \ | |
41 | : "g" (ioa) \ | |
42 | : "ax", "dx"); \ | |
43 | rtn; \ | |
44 | }) | |
45 | ||
46 | #define wrw(s,n) ({u_short val; u_short ioa; \ | |
47 | ioa = (s); \ | |
48 | val = (n); \ | |
49 | asm volatile ("movw %1,%%ax; movw %0,%%dx; nop; out %%ax,%%dx; nop" \ | |
50 | : /* nothing returned */ \ | |
51 | : "g" (ioa), "g" (val) \ | |
52 | : "ax", "dx"); \ | |
53 | }) | |
54 | ||
55 | #define Outsw(s,a, n) ({short *addr; u_short ioa; int cnt,rtn; \ | |
56 | ioa = (s); \ | |
57 | addr = (a); \ | |
58 | cnt = (n); \ | |
59 | asm volatile ("movw %1,%%dx; movl %2,%%esi; movl %3,%%ecx; cld; nop; .byte 0x66,0xf2,0x6f; nop ; movl %%esi,%0" \ | |
60 | : "=g" (rtn) \ | |
61 | : "g" (ioa), "g" (addr), "g" (cnt) \ | |
62 | : "si", "dx", "cx"); \ | |
63 | rtn; \ | |
64 | }) | |
65 | #define Insw(s,a, n) ({short *addr; u_short ioa; int cnt,rtn; \ | |
66 | ioa = (s); \ | |
67 | addr = (a); \ | |
68 | cnt = (n); \ | |
69 | asm volatile ("movw %1,%%dx; movl %2,%%edi; movl %3,%%ecx; cld; nop; .byte 0x66,0xf2,0x6d; nop ; movl %%edi,%0" \ | |
70 | : "=g" (rtn) \ | |
71 | : "g" (ioa), "g" (addr), "g" (cnt) \ | |
72 | : "di", "dx", "cx"); \ | |
73 | rtn; \ | |
74 | }) | |
75 | ||
76 | unsigned char inb() ; | |
77 | extern outb(); | |
3bcbb99c | 78 | #endif |
7dc7e04a | 79 | |
3bcbb99c | 80 | #define IO_KBD 0x60 /* keyboard */ |
7dc7e04a WN |
81 | |
82 | #define IO_WD0 0x1f0 /* primary base i/o address */ | |
83 | #define IO_WD1 0x170 /* secondary base i/o address */ | |
3bcbb99c BJ |
84 | |
85 | #define IO_FD0 0x3f2 /* primary base i/o address */ | |
86 | #define IO_FD1 0x372 /* secondary base i/o address */ | |
87 | ||
88 | #define IO_COM0 0x3f8 /* COM1 i/o address */ | |
89 | #define IO_COM1 0x2f8 /* COM2 i/o address */ |