ソースを参照

[ioapi] Remove old io.h file and switch all users over to <gpxe/io.h>

tags/v0.9.6
Michael Brown 15年前
コミット
ee2df1d6d6

+ 1
- 1
src/arch/i386/core/i386_timer.c ファイルの表示

@@ -14,7 +14,7 @@
14 14
 #include <stddef.h>
15 15
 #include <bits/timer2.h>
16 16
 #include <gpxe/timer.h>
17
-#include <io.h>
17
+#include <gpxe/io.h>
18 18
 
19 19
 /* Timers tick over at this rate */
20 20
 #define TIMER2_TICK_RATE	1193180U

+ 1
- 1
src/arch/i386/core/relocate.c ファイルの表示

@@ -1,4 +1,4 @@
1
-#include <io.h>
1
+#include <gpxe/io.h>
2 2
 #include <registers.h>
3 3
 #include <gpxe/memmap.h>
4 4
 

+ 1
- 1
src/arch/i386/core/video_subr.c ファイルの表示

@@ -7,7 +7,7 @@
7 7
 
8 8
 #include "stddef.h"
9 9
 #include "string.h"
10
-#include "io.h"
10
+#include <gpxe/io.h>
11 11
 #include "console.h"
12 12
 #include <gpxe/init.h>
13 13
 #include "vga.h"

+ 1
- 1
src/arch/i386/drivers/timer_rdtsc.c ファイルの表示

@@ -5,7 +5,7 @@
5 5
 #include <stdio.h>
6 6
 #include <bits/cpu.h>
7 7
 #include <bits/timer2.h>
8
-#include <io.h>
8
+#include <gpxe/io.h>
9 9
 
10 10
 
11 11
 #define rdtsc(low,high) \

+ 6
- 6
src/arch/i386/firmware/pcbios/gateA20.c ファイルの表示

@@ -48,9 +48,9 @@ static void empty_8042 ( void ) {
48 48
 	time = currticks() + TICKS_PER_SEC;	/* max wait of 1 second */
49 49
 	while ( ( inb ( K_CMD ) & ( K_IBUF_FUL | K_OBUF_FUL ) ) &&
50 50
 		currticks() < time ) {
51
-		SLOW_DOWN_IO;
52
-		( void ) inb ( K_RDWR );
53
-		SLOW_DOWN_IO;
51
+		iodelay();
52
+		( void ) inb_p ( K_RDWR );
53
+		iodelay();
54 54
 	}
55 55
 }
56 56
 
@@ -77,7 +77,7 @@ static int gateA20_is_set ( int retries ) {
77 77
 		/* Avoid false negatives */
78 78
 		test_pattern++;
79 79
 
80
-		SLOW_DOWN_IO;
80
+		iodelay();
81 81
 
82 82
 		/* Always retry at least once, to avoid false negatives */
83 83
 	} while ( retries-- >= 0 );
@@ -145,9 +145,9 @@ void gateA20_set ( void ) {
145 145
 			scp_a = inb ( SCP_A );
146 146
 			scp_a &= ~0x01; /* Avoid triggering a reset */
147 147
 			scp_a |= 0x02; /* Enable A20 */
148
-			SLOW_DOWN_IO;
148
+			iodelay();
149 149
 			outb ( scp_a, SCP_A );
150
-			SLOW_DOWN_IO;
150
+			iodelay();
151 151
 			if ( gateA20_is_set ( A20_SCPA_RETRIES ) ) {
152 152
 				DBG ( "Enabled gate A20 using "
153 153
 				      "Fast Gate A20\n" );

+ 0
- 265
src/arch/i386/include/io.h ファイルの表示

@@ -1,265 +0,0 @@
1
-#ifndef	ETHERBOOT_IO_H
2
-#define ETHERBOOT_IO_H
3
-
4
-#include <stdint.h>
5
-#include "virtaddr.h"
6
-
7
-/* virt_to_bus converts an addresss inside of etherboot [_start, _end]
8
- * into a memory access cards can use.
9
- */
10
-#define virt_to_bus virt_to_phys
11
-
12
-
13
-/* bus_to_virt reverses virt_to_bus, the address must be output
14
- * from virt_to_bus to be valid.  This function does not work on
15
- * all bus addresses.
16
- */
17
-#define bus_to_virt phys_to_virt
18
-
19
-/* ioremap converts a random 32bit bus address into something
20
- * etherboot can access.
21
- */
22
-static inline void *ioremap(unsigned long bus_addr, unsigned long length __unused)
23
-{
24
-	return bus_to_virt(bus_addr);
25
-}
26
-
27
-/* iounmap cleans up anything ioremap had to setup */
28
-static inline void iounmap(void *virt_addr __unused)
29
-{
30
-	return;
31
-}
32
-
33
-/*
34
- * This file contains the definitions for the x86 IO instructions
35
- * inb/inw/inl/outb/outw/outl and the "string versions" of the same
36
- * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing"
37
- * versions of the single-IO instructions (inb_p/inw_p/..).
38
- *
39
- * This file is not meant to be obfuscating: it's just complicated
40
- * to (a) handle it all in a way that makes gcc able to optimize it
41
- * as well as possible and (b) trying to avoid writing the same thing
42
- * over and over again with slight variations and possibly making a
43
- * mistake somewhere.
44
- */
45
-
46
-/*
47
- * Thanks to James van Artsdalen for a better timing-fix than
48
- * the two short jumps: using outb's to a nonexistent port seems
49
- * to guarantee better timings even on fast machines.
50
- *
51
- * On the other hand, I'd like to be sure of a non-existent port:
52
- * I feel a bit unsafe about using 0x80 (should be safe, though)
53
- *
54
- *		Linus
55
- */
56
-
57
-#ifdef	SLOW_IO_BY_JUMPING
58
-#define __SLOW_DOWN_IO __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:")
59
-#else
60
-#define __SLOW_DOWN_IO __asm__ __volatile__("outb %al,$0x80")
61
-#endif
62
-
63
-#ifdef	REALLY_SLOW_IO
64
-#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; }
65
-#else
66
-#define SLOW_DOWN_IO __SLOW_DOWN_IO
67
-#endif
68
-
69
-/*
70
- * readX/writeX() are used to access memory mapped devices. On some
71
- * architectures the memory mapped IO stuff needs to be accessed
72
- * differently. On the x86 architecture, we just read/write the
73
- * memory location directly.
74
- */
75
-static inline __attribute__ (( always_inline )) unsigned long
76
-_readb ( volatile uint8_t *addr ) {
77
-	unsigned long data = *addr;
78
-	DBGIO ( "[%08lx] => %02lx\n", virt_to_phys ( addr ), data );
79
-	return data;
80
-}
81
-static inline __attribute__ (( always_inline )) unsigned long
82
-_readw ( volatile uint16_t *addr ) {
83
-	unsigned long data = *addr;
84
-	DBGIO ( "[%08lx] => %04lx\n", virt_to_phys ( addr ), data );
85
-	return data;
86
-}
87
-static inline __attribute__ (( always_inline )) unsigned long
88
-_readl ( volatile uint32_t *addr ) {
89
-	unsigned long data = *addr;
90
-	DBGIO ( "[%08lx] => %08lx\n", virt_to_phys ( addr ), data );
91
-	return data;
92
-}
93
-#define readb( addr ) _readb ( ( volatile uint8_t * ) (addr) )
94
-#define readw( addr ) _readw ( ( volatile uint16_t * ) (addr) )
95
-#define readl( addr ) _readl ( ( volatile uint32_t * ) (addr) )
96
-
97
-static inline __attribute__ (( always_inline )) void
98
-_writeb ( unsigned long data, volatile uint8_t *addr ) {
99
-	DBGIO ( "[%08lx] <= %02lx\n", virt_to_phys ( addr ), data );
100
-	*addr = data;
101
-}
102
-static inline __attribute__ (( always_inline )) void
103
-_writew ( unsigned long data, volatile uint16_t *addr ) {
104
-	DBGIO ( "[%08lx] <= %04lx\n", virt_to_phys ( addr ), data );
105
-	*addr = data;
106
-}
107
-static inline __attribute__ (( always_inline )) void
108
-_writel ( unsigned long data, volatile uint32_t *addr ) {
109
-	DBGIO ( "[%08lx] <= %08lx\n", virt_to_phys ( addr ), data );
110
-	*addr = data;
111
-}
112
-#define writeb( b, addr ) _writeb ( (b), ( volatile uint8_t * ) (addr) )
113
-#define writew( b, addr ) _writew ( (b), ( volatile uint16_t * ) (addr) )
114
-#define writel( b, addr ) _writel ( (b), ( volatile uint32_t * ) (addr) )
115
-
116
-#define memcpy_fromio(a,b,c)	memcpy((a),(void *)(b),(c))
117
-#define memcpy_toio(a,b,c)	memcpy((void *)(a),(b),(c))
118
-
119
-/*
120
- * Force strict CPU ordering.
121
- * And yes, this is required on UP too when we're talking
122
- * to devices.
123
- *
124
- * For now, "wmb()" doesn't actually do anything, as all
125
- * Intel CPU's follow what Intel calls a *Processor Order*,
126
- * in which all writes are seen in the program order even
127
- * outside the CPU.
128
- *
129
- * I expect future Intel CPU's to have a weaker ordering,
130
- * but I'd also expect them to finally get their act together
131
- * and add some real memory barriers if so.
132
- *
133
- * Some non intel clones support out of order store. wmb() ceases to be a
134
- * nop for these.
135
- */
136
- 
137
-#define mb() 	__asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
138
-#define rmb()	mb()
139
-#define wmb()	mb();
140
-
141
-
142
-/*
143
- * Talk about misusing macros..
144
- */
145
-
146
-#define __OUT1(s,x) \
147
-extern void __out##s(unsigned x value, unsigned short port); \
148
-extern inline void __out##s(unsigned x value, unsigned short port) {
149
-
150
-#define __OUT2(s,s1,s2) \
151
-__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1"
152
-
153
-#define __OUT(s,s1,x) \
154
-__OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); } \
155
-__OUT1(s##c,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); } \
156
-__OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); SLOW_DOWN_IO; } \
157
-__OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; }
158
-
159
-#define __IN1(s,x) \
160
-extern unsigned x __in##s(unsigned short port); \
161
-extern inline unsigned x __in##s(unsigned short port) { unsigned x _v;
162
-
163
-#define __IN2(s,s1,s2) \
164
-__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"
165
-
166
-#define __IN(s,s1,x,i...) \
167
-__IN1(s,x) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); return _v; } \
168
-__IN1(s##c,x) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); return _v; } \
169
-__IN1(s##_p,x) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); SLOW_DOWN_IO; return _v; } \
170
-__IN1(s##c_p,x) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; }
171
-
172
-#define __INS(s) \
173
-extern void ins##s(unsigned short port, void * addr, unsigned long count); \
174
-extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \
175
-{ __asm__ __volatile__ ("cld ; rep ; ins" #s \
176
-: "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
177
-
178
-#define __OUTS(s) \
179
-extern void outs##s(unsigned short port, const void * addr, unsigned long  count); \
180
-extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \
181
-{ __asm__ __volatile__ ("cld ; rep ; outs" #s \
182
-: "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
183
-
184
-__IN(b,"", char)
185
-__IN(w,"",short)
186
-__IN(l,"", long)
187
-
188
-__OUT(b,"b",char)
189
-__OUT(w,"w",short)
190
-__OUT(l,,int)
191
-
192
-__INS(b)
193
-__INS(w)
194
-__INS(l)
195
-
196
-__OUTS(b)
197
-__OUTS(w)
198
-__OUTS(l)
199
-
200
-/*
201
- * Note that due to the way __builtin_constant_p() works, you
202
- *  - can't use it inside a inline function (it will never be true)
203
- *  - you don't have to worry about side effects within the __builtin..
204
- */
205
-#define outb(val,port) \
206
-((__builtin_constant_p((port)) && (port) < 256) ? \
207
-	__outbc((val),(port)) : \
208
-	__outb((val),(port)))
209
-
210
-#define inb(port) \
211
-((__builtin_constant_p((port)) && (port) < 256) ? \
212
-	__inbc(port) : \
213
-	__inb(port))
214
-
215
-#define outb_p(val,port) \
216
-((__builtin_constant_p((port)) && (port) < 256) ? \
217
-	__outbc_p((val),(port)) : \
218
-	__outb_p((val),(port)))
219
-
220
-#define inb_p(port) \
221
-((__builtin_constant_p((port)) && (port) < 256) ? \
222
-	__inbc_p(port) : \
223
-	__inb_p(port))
224
-
225
-#define outw(val,port) \
226
-((__builtin_constant_p((port)) && (port) < 256) ? \
227
-	__outwc((val),(port)) : \
228
-	__outw((val),(port)))
229
-
230
-#define inw(port) \
231
-((__builtin_constant_p((port)) && (port) < 256) ? \
232
-	__inwc(port) : \
233
-	__inw(port))
234
-
235
-#define outw_p(val,port) \
236
-((__builtin_constant_p((port)) && (port) < 256) ? \
237
-	__outwc_p((val),(port)) : \
238
-	__outw_p((val),(port)))
239
-
240
-#define inw_p(port) \
241
-((__builtin_constant_p((port)) && (port) < 256) ? \
242
-	__inwc_p(port) : \
243
-	__inw_p(port))
244
-
245
-#define outl(val,port) \
246
-((__builtin_constant_p((port)) && (port) < 256) ? \
247
-	__outlc((val),(port)) : \
248
-	__outl((val),(port)))
249
-
250
-#define inl(port) \
251
-((__builtin_constant_p((port)) && (port) < 256) ? \
252
-	__inlc(port) : \
253
-	__inl(port))
254
-
255
-#define outl_p(val,port) \
256
-((__builtin_constant_p((port)) && (port) < 256) ? \
257
-	__outlc_p((val),(port)) : \
258
-	__outl_p((val),(port)))
259
-
260
-#define inl_p(port) \
261
-((__builtin_constant_p((port)) && (port) < 256) ? \
262
-	__inlc_p(port) : \
263
-	__inl_p(port))
264
-
265
-#endif /* ETHERBOOT_IO_H */

+ 1
- 1
src/arch/i386/include/pcidirect.h ファイルの表示

@@ -2,7 +2,7 @@
2 2
 #define _PCIDIRECT_H
3 3
 
4 4
 #include <stdint.h>
5
-#include <io.h>
5
+#include <gpxe/io.h>
6 6
 
7 7
 /** @file
8 8
  *

+ 1
- 1
src/arch/i386/include/realmode.h ファイルの表示

@@ -5,7 +5,7 @@
5 5
 
6 6
 #include "stdint.h"
7 7
 #include "registers.h"
8
-#include "io.h"
8
+#include <gpxe/io.h>
9 9
 
10 10
 /*
11 11
  * Data structures and type definitions

+ 1
- 1
src/core/debug.c ファイルの表示

@@ -1,7 +1,7 @@
1 1
 #include <stdio.h>
2 2
 #include <stdint.h>
3 3
 #include <stdarg.h>
4
-#include <io.h>
4
+#include <gpxe/io.h>
5 5
 #include <console.h>
6 6
 
7 7
 void pause ( void ) {

+ 1
- 1
src/core/malloc.c ファイルの表示

@@ -20,7 +20,7 @@
20 20
 #include <stdint.h>
21 21
 #include <string.h>
22 22
 #include <strings.h>
23
-#include <io.h>
23
+#include <gpxe/io.h>
24 24
 #include <gpxe/list.h>
25 25
 #include <gpxe/init.h>
26 26
 #include <gpxe/malloc.h>

+ 1
- 1
src/core/pc_kbd.c ファイルの表示

@@ -10,7 +10,7 @@
10 10
  *		yhlu@tyan.com
11 11
  */
12 12
 
13
-#include "io.h"
13
+#include <gpxe/io.h>
14 14
 #include "console.h"
15 15
 
16 16
 static char key_map[][128] = {

+ 1
- 1
src/core/serial.c ファイルの表示

@@ -13,7 +13,7 @@
13 13
 
14 14
 #include "stddef.h"
15 15
 #include <gpxe/init.h>
16
-#include "io.h"
16
+#include <gpxe/io.h>
17 17
 #include <unistd.h>
18 18
 #include <gpxe/serial.h>
19 19
 #include "config/serial.h"

+ 1
- 1
src/drivers/bus/eisa.c ファイルの表示

@@ -3,7 +3,7 @@
3 3
 #include <stdlib.h>
4 4
 #include <stdio.h>
5 5
 #include <errno.h>
6
-#include <io.h>
6
+#include <gpxe/io.h>
7 7
 #include <unistd.h>
8 8
 #include <gpxe/eisa.h>
9 9
 

+ 1
- 1
src/drivers/bus/isa.c ファイルの表示

@@ -3,7 +3,7 @@
3 3
 #include <stdlib.h>
4 4
 #include <stdio.h>
5 5
 #include <errno.h>
6
-#include <io.h>
6
+#include <gpxe/io.h>
7 7
 #include <gpxe/isa.h>
8 8
 
9 9
 /*

+ 1
- 1
src/drivers/bus/isapnp.c ファイルの表示

@@ -60,7 +60,7 @@
60 60
 #include <string.h>
61 61
 #include <stdio.h>
62 62
 #include <errno.h>
63
-#include <io.h>
63
+#include <gpxe/io.h>
64 64
 #include <unistd.h>
65 65
 #include <gpxe/isapnp.h>
66 66
 

+ 1
- 1
src/drivers/bus/mca.c ファイルの表示

@@ -10,7 +10,7 @@
10 10
 #include <stdlib.h>
11 11
 #include <stdio.h>
12 12
 #include <errno.h>
13
-#include <io.h>
13
+#include <gpxe/io.h>
14 14
 #include <gpxe/mca.h>
15 15
 
16 16
 static struct mca_driver mca_drivers[0]

+ 1
- 1
src/drivers/net/3c509.c ファイルの表示

@@ -8,7 +8,7 @@
8 8
 #include <stdlib.h>
9 9
 #include <string.h>
10 10
 #include <errno.h>
11
-#include <io.h>
11
+#include <gpxe/io.h>
12 12
 #include <unistd.h>
13 13
 #include <gpxe/device.h>
14 14
 #include <gpxe/isa.h>

+ 1
- 1
src/drivers/net/e1000/e1000.h ファイルの表示

@@ -34,7 +34,7 @@
34 34
 #include <stdint.h>
35 35
 #include <stdlib.h>
36 36
 #include <stdio.h>
37
-#include <io.h>
37
+#include <gpxe/io.h>
38 38
 #include <errno.h>
39 39
 #include <byteswap.h>
40 40
 #include <gpxe/pci.h>

+ 1
- 1
src/drivers/net/e1000/e1000_osdep.h ファイルの表示

@@ -37,7 +37,7 @@
37 37
 #include <stdint.h>
38 38
 #include <stdlib.h>
39 39
 #include <stdio.h>
40
-#include <io.h>
40
+#include <gpxe/io.h>
41 41
 #include <errno.h>
42 42
 #include <unistd.h>
43 43
 #include <byteswap.h>

+ 1
- 1
src/drivers/net/natsemi.c ファイルの表示

@@ -61,7 +61,7 @@
61 61
 #include <stdint.h>
62 62
 #include <stdlib.h>
63 63
 #include <stdio.h>
64
-#include <io.h>
64
+#include <gpxe/io.h>
65 65
 #include <errno.h>
66 66
 #include <byteswap.h>
67 67
 #include <unistd.h>

+ 1
- 1
src/drivers/net/pnic.c ファイルの表示

@@ -14,7 +14,7 @@ Bochs Pseudo NIC driver for Etherboot
14 14
 
15 15
 #include <stdint.h>
16 16
 #include <stdio.h>
17
-#include <io.h>
17
+#include <gpxe/io.h>
18 18
 #include <errno.h>
19 19
 #include <gpxe/pci.h>
20 20
 #include <gpxe/if_ether.h>

+ 1
- 1
src/drivers/net/rtl8139.c ファイルの表示

@@ -69,7 +69,7 @@
69 69
 #include <stdint.h>
70 70
 #include <stdlib.h>
71 71
 #include <stdio.h>
72
-#include <io.h>
72
+#include <gpxe/io.h>
73 73
 #include <errno.h>
74 74
 #include <unistd.h>
75 75
 #include <byteswap.h>

読み込み中…
キャンセル
保存