]>
Commit | Line | Data |
---|---|---|
93afd047 MT |
1 | /* |
2 | * Copyright 1999 Egbert Eich | |
3 | * | |
4 | * Permission to use, copy, modify, distribute, and sell this software and its | |
5 | * documentation for any purpose is hereby granted without fee, provided that | |
6 | * the above copyright notice appear in all copies and that both that | |
7 | * copyright notice and this permission notice appear in supporting | |
8 | * documentation, and that the name of the authors not be used in | |
9 | * advertising or publicity pertaining to distribution of the software without | |
10 | * specific, written prior permission. The authors makes no representations | |
11 | * about the suitability of this software for any purpose. It is provided | |
12 | * "as is" without express or implied warranty. | |
13 | * | |
14 | * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | |
15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO | |
16 | * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR | |
17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | |
18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |
19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | |
20 | * PERFORMANCE OF THIS SOFTWARE. | |
21 | */ | |
22 | ||
23 | #include <stdio.h> | |
24 | #if defined(__alpha__) || defined (__ia64__) | |
25 | #include <sys/io.h> | |
26 | #endif | |
27 | #include "AsmMacros.h" | |
28 | #include "v86bios.h" | |
29 | #include "pci.h" | |
30 | ||
31 | ||
32 | int | |
33 | port_rep_inb(CARD16 port, CARD8 *base, int d_f, CARD32 count) | |
34 | { | |
35 | register int inc = d_f ? -1 : 1; | |
36 | CARD8 *dst = base; | |
37 | ||
38 | while (count--) { | |
39 | *dst = inb(port); | |
40 | dst += inc; | |
41 | } | |
42 | return (dst-base); | |
43 | } | |
44 | ||
45 | int | |
46 | port_rep_inw(CARD16 port, CARD16 *base, int d_f, CARD32 count) | |
47 | { | |
48 | register int inc = d_f ? -1 : 1; | |
49 | CARD16 *dst = base; | |
50 | ||
51 | while (count--) { | |
52 | *dst = inw(port); | |
53 | dst += inc; | |
54 | } | |
55 | return (dst-base); | |
56 | } | |
57 | ||
58 | int | |
59 | port_rep_inl(CARD16 port, CARD32 *base, int d_f, CARD32 count) | |
60 | { | |
61 | register int inc = d_f ? -1 : 1; | |
62 | CARD32 *dst = base; | |
63 | ||
64 | while (count--) { | |
65 | *dst = inl(port); | |
66 | dst += inc; | |
67 | } | |
68 | return (dst-base); | |
69 | } | |
70 | ||
71 | int | |
72 | port_rep_outb(CARD16 port, CARD8 *base, int d_f, CARD32 count) | |
73 | { | |
74 | register int inc = d_f ? -1 : 1; | |
75 | CARD8 *dst = base; | |
76 | ||
77 | while (count--) { | |
78 | outb(port,*dst); | |
79 | dst += inc; | |
80 | } | |
81 | return (dst-base); | |
82 | } | |
83 | ||
84 | int | |
85 | port_rep_outw(CARD16 port, CARD16 *base, int d_f, CARD32 count) | |
86 | { | |
87 | register int inc = d_f ? -1 : 1; | |
88 | CARD16 *dst = base; | |
89 | ||
90 | while (count--) { | |
91 | outw(port,*dst); | |
92 | dst += inc; | |
93 | } | |
94 | return (dst-base); | |
95 | } | |
96 | ||
97 | int | |
98 | port_rep_outl(CARD16 port, CARD32 *base, int d_f, CARD32 count) | |
99 | { | |
100 | register int inc = d_f ? -1 : 1; | |
101 | CARD32 *dst = base; | |
102 | ||
103 | while (count--) { | |
104 | outl(port,*dst); | |
105 | dst += inc; | |
106 | } | |
107 | return (dst-base); | |
108 | } |