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 * 10 * @(#)isa.h 5.1 (Berkeley) 04/24/90 11 */ 12 13 /* 14 * AT bus specific definitions. 15 */ 16 17 #define Rd(s) ({u_char rtn; u_short ioa; \ 18 ioa = (s); \ 19 asm volatile ("movw %1,%%dx; nop ; in %%dx,%%al ; nop ; movb %%al,%0" \ 20 : "=g" (rtn) \ 21 : "g" (ioa) \ 22 : "ax", "dx"); \ 23 rtn; \ 24 }) 25 26 #define Wr(s,n) ({u_char val; u_short ioa; \ 27 ioa = (s); \ 28 val = (n); \ 29 asm volatile ("movb %1,%%al; movw %0,%%dx; nop; out %%al,%%dx ; nop" \ 30 : /* nothing returned */ \ 31 : "g" (ioa), "g" (val) \ 32 : "ax", "dx"); \ 33 }) 34 35 36 #define rdw(s) ({u_short rtn; u_short ioa; \ 37 ioa = (s); \ 38 asm volatile ("movw %1,%%dx; nop ; in %%dx,%%ax ; nop ; movw %%ax,%0" \ 39 : "=g" (rtn) \ 40 : "g" (ioa) \ 41 : "ax", "dx"); \ 42 rtn; \ 43 }) 44 45 #define wrw(s,n) ({u_short val; u_short ioa; \ 46 ioa = (s); \ 47 val = (n); \ 48 asm volatile ("movw %1,%%ax; movw %0,%%dx; nop; out %%ax,%%dx; nop" \ 49 : /* nothing returned */ \ 50 : "g" (ioa), "g" (val) \ 51 : "ax", "dx"); \ 52 }) 53 54 #define Outsw(s,a, n) ({short *addr; u_short ioa; int cnt,rtn; \ 55 ioa = (s); \ 56 addr = (a); \ 57 cnt = (n); \ 58 asm volatile ("movw %1,%%dx; movl %2,%%esi; movl %3,%%ecx; cld; nop; .byte 0x66,0xf2,0x6f; nop ; movl %%esi,%0" \ 59 : "=g" (rtn) \ 60 : "g" (ioa), "g" (addr), "g" (cnt) \ 61 : "si", "dx", "cx"); \ 62 rtn; \ 63 }) 64 #define Insw(s,a, n) ({short *addr; u_short ioa; int cnt,rtn; \ 65 ioa = (s); \ 66 addr = (a); \ 67 cnt = (n); \ 68 asm volatile ("movw %1,%%dx; movl %2,%%edi; movl %3,%%ecx; cld; nop; .byte 0x66,0xf2,0x6d; nop ; movl %%edi,%0" \ 69 : "=g" (rtn) \ 70 : "g" (ioa), "g" (addr), "g" (cnt) \ 71 : "di", "dx", "cx"); \ 72 rtn; \ 73 }) 74 75 unsigned char inb() ; 76 extern outb(); 77 78 #define IO_KBD1 0x60 /* keyboard */ 79 80 #define IO_WD0 0x1f0 /* primary base i/o address */ 81 #define IO_WD1 0x170 /* secondary base i/o address */ 82